Learn fundamental concepts in data analysis and statistical inference, focusing on one and two independent samples.

Loading...

From the course by Johns Hopkins University

Mathematical Biostatistics Boot Camp 2

41 ratings

Learn fundamental concepts in data analysis and statistical inference, focusing on one and two independent samples.

From the lesson

Two Binomials

In this module we'll be covering some methods for looking at two binomials. This includes the odds ratio, relative risk and risk difference. We'll discussing mostly confidence intervals in this module and will develop the delta method, the tool used to create these confidence intervals. After you've watched the videos and tried the homework, take a crack at the quiz!

- Brian Caffo, PhDProfessor, Biostatistics

Bloomberg School of Public Health

Hi, my name is Brian Caffo and this is Mathematical

Â Biostatistics Boot Camp Lecture 4 on Two Sample Binomial Tests.

Â Okay, in this lecture we're going to talk about the score

Â statistic, which is specific two sample binomial test that will.

Â Serve as motivation for creating a confidence interval, as well.

Â We'll talk about how you can do exact tests for two binomial proportions.

Â And then we'll talk about comparing two binomial proportions.

Â and then we'll go over a little bit about

Â Bayesian and likelihood methods for comparing binomial proportions.

Â We're, we'll actually spend quite a bit

Â of time on binomial proportions, because later

Â on we'll also talk about relative risks and odds ratios and that sort of thing.

Â [NOISE]

Â [NOISE]

Â [NOISE]

Â Okay, so let's put some context on this.

Â So imagine, a randomized trial where there was 40 subjects.

Â And 20 each were randomized to two drugs and the, the two

Â drugs have the same active ingredients,

Â but let's assume they had different expedients.

Â What, you know that, ways in which the drugs were delivered.

Â One, let's just say one was a capsule and one was a, was a different

Â kind of pill. Okay.

Â so consider counting the, the, the number of

Â side-effects for each drug among the 40 people.

Â So here we have a table where there's 40 total people.

Â 20 in drug A, 20 in drug B.

Â So this margin is fixed.

Â [INAUDIBLE]

Â 20 and 20, that margin is fixed.

Â And then 11 from Drug A receive side effects and then 9 didn't.

Â And then five from Drug B had side effects and 15 didn't.

Â So on face value there, there seems to be a greater

Â propensity for side effects from Drug A then from Drug B.

Â And what we'd like to do is to, to do a test of

Â whether or not the side effects are the propensity for side

Â effects is the same within the two, within the two drugs.

Â And there's a lot of different ways we could

Â formulate this problem even from a simple data set.

Â And we'll talk about some of the ways.

Â To do that.

Â but for right now lets just start with talking about score tests.

Â So the scores should seem fairly familiar to you because

Â it's just going to be constructed in the same way.

Â that the ordinary test is, the, sort of, ordinary Z

Â tests are constructed in the way that we have before.

Â So, let's consider a single binomial proportion,

Â not two binomial proportions, but i can set

Â a single binomial proportion, and later on

Â in the lecture, we'll consider two binomial proportions.

Â so imagine only looking at drug A and saying well lets test whether or not

Â drug A has a specific population proportion of side effects.

Â So we want to test h0 p equal to p0 and so our obvious

Â estimate of p0 is p hat the sample proportion of side effects.

Â Okay, so our obvious metric of the discrepancy between

Â p hat and p naught would be the difference or

Â maybe we can do a long ratio or something like

Â that but lets for right now lets do the difference.

Â Okay.

Â But that, but, you know, eh, you know, in order to compare this

Â to a statistical distribution, let's normalize it by the variance of p hat.

Â Well the variance

Â of p hat is p times 1 minus p over n. And, under the null hypothesis, that's p0

Â times 1 minus p0 over n, so the standard standard error is the square root of that.

Â And notice that were plugging in the p0 under

Â the null hypothesis, not plugging in p hat which

Â would give us the estimated standard error that we

Â used, for example, in the construction of the confidence interval.

Â So any rate, this, this test when we plug in

Â p0 in the denominator here, performs a little bit better

Â than the so called wall test where in the denominator

Â rather than plugging in p0, we plug in p hat.

Â So remember how we can invert this test statistic

Â to perform a confidence, to create a confidence interval.

Â And we can, you know, of course we can use the test statistic to

Â just perform the test, so I should have said this on the previous slide.

Â but, that Z statistic you compare

Â to quantiles from the standard normal distribution,

Â the upper Alpha over Tuth quantile if you're doing a two sided test.

Â The upper alpha over two quantile if you're doing

Â the one sided greater than test, the lower alpha, the

Â upper alpha quantile if you're doing the one sided test

Â where the alternative is greater than, p greater than p0.

Â And the alpha quantile if you're doing in one sided test well where you're testing

Â p less than p0.

Â Okay so and this, this should be obvious to you at this point in the class

Â how you would create take a Z statistic and then use it to perform a test.

Â And then, of course, we've already talked at length, in other

Â settings, for example, in inverting the T test, and the standard

Â Z interval, on how we can invert a confidence interval, and

Â create, I'm sorry, invert a hypothesis test, and create a confidence interval,

Â namely, calculate those values of p0 for which we'd failed to reject.

Â If we invert the Wald test, we get the Wald confidence interval.

Â P hat plus or minus Z one minus alpha over

Â two square root p hat one minus p hat over n.

Â And if we invert the Score test we get a

Â so called Score interval which is a lot more complicated.

Â We get p hat times this quantitiy times

Â one half times this quantitiy plus and minus our

Â normal quantal, our upper Alpha over 2

Â normal quantile and then this standard error formula.

Â I want to point out one thing about the that, that the, this

Â is not a numerator here by the way this is this quantity p

Â hat times thing plus 1 half times this thing and then I ran

Â out of space, ten on the next line I put plus or minus.

Â The normal quantile times the standard error.

Â So this is p hat times n over n plus Z squared and

Â then plus one half times Z squared over n plus Z squared.

Â So, look at this two factors n over n plus Z squared

Â and Z squared over n plus Z squared, they add up to one.

Â So they are they are two proportions that add up that, that, that,

Â um,add up to one.

Â So in other words a point on the two

Â dimensional simplex is what you might call, say in mathematical

Â parlance but whats important is as n gets very big,

Â this first term gets very big and p hat dominates.

Â if n is small then, then, then this term in front of the one, this term in

Â front of the one half gets a little bit

Â bigger and, well, the one half probably hopefully doesn't

Â dominate but, but, but there's more a greater

Â fraction placed on the, on the one half.

Â And just to give you context, the Z One minus alpha over 2,

Â well you know that's usually going to be around 2 so this is about 4.

Â So it's n over, it's about n over n plus 4 plus one half,

Â 4 over n plus 4 so at any rate, and as n gets very

Â large it just becomes very similar. To the Wald interval.

Â so what this, this does, is it takes p hat and it shrinks it towards one half.

Â And that's, that, that turns out to be a good

Â thing to do, because the binomial confidence interval you don't

Â want it centered exactly at p hat, because the binomial

Â distribution is p hat is Further away from one half

Â gets more asymmetric.

Â It gets more skewed, and because of that,

Â you don't want that point right in the middle.

Â At any rate, so we, we talked

Â previously about confidence intervals for binomial proportions.

Â And plugging in Z one minus alpha over two equal to two

Â yields the so called Agresti Coull interval that we talked about before.

Â So this is actually the motivation for the Agresti Coull interval is that most people

Â do 95% intervals and if we take our 1.96 and just round it up to two then and

Â plug it into the score interval we get exactly the Agresti Coull interval.

Â [INAUDIBLE]

Â [NOISE]

Â Okay, so let's do our example.

Â In our previous example consider testing whether or not Drug

Â A's percentage of subjects with side effects is greater than 10%.

Â So, I don't know, I made up 10%.

Â So let's assume that the FDA gets really mad for

Â this kind of drug if you have more than 10%.

Â Prevalance of side effects.

Â so H0 PA is equal to 0.1 versus HA PA greater than one,

Â where PA is the population proportion of side effects for Drug A.

Â And then our p hat is 11 over 20 which is 0.55.

Â Our test statistic is 0.55 minus 0.1 divided by square root remember to plug in

Â the p naught from the null hypothesis 0.1 times 0.9 divided 20 you get 6.7.

Â We reject the p value we reject you know our, our critical value is going to

Â be, or for one-sided, test is going to be about 1.65 or a two-sided test,

Â it would, it would be about 2.

Â Either way, 6.7's going to be bigger than it.

Â And then, our P value, the probability of, of getting

Â a Z bigger than 6.7 is of course, nearly around 0.

Â six, almost seven standard deviations away from, from

Â zero, for a standard normal, is, is quite.

Â Quite far out in the tails, remember the

Â three standard evasions covered the majority of the distribution.

Â and then if we were doing a two-sided

Â test remember that we would double this P value.

Â Okay.

Â Now let's, let's discuss this problem a little bit.

Â So what, what do we have to do to get this to work.

Â so mechanically I, I hope you find this easy, but

Â let's talk a little bit about the thinking of this.

Â So we're, we're postulating that, that, the number of side effects out of 20 is

Â a binomial trial.

Â Well that, implicit in that is the idea that, and we have I

Â ID g/ Data, every person is independent

Â and identically distributed, draw from a population.

Â So we're using those assumptions, the IID assumptions to create the idea of a

Â population, super population, that has a prevalence of side effects of p a.

Â of course, we cannot, in general you can't know that unless

Â your action is sending more people or going to great

Â pains to actually sample independently from the population you're interested in.

Â which is usually not the case.

Â In general the sample is, what you're, what you are doing is you're

Â doing a statistical model where you're hoping

Â that the people are a representative sample.

Â You're hoping that there's no crossover of side effects.

Â So let's suppose some of the people receiving

Â the drug are friends, or in the same family, or in the same

Â neighborhood, or something like that that there's no reason if one person gets.

Â Side effects.

Â That it's more likely for anyone else around them

Â to get side effects who also received the drug.

Â So no interference is what they would call that.

Â and so so, so our IID model is what's giving

Â us here, this idea of a population proportion.

Â And then we're, we're testing relative to that proportion.

Â But it's good, I think, whenever you're doing these.

Â Kinds of test actually think about what you're modeling

Â is random and what your population model is that

Â you're trying to do, because, you know, modeling is

Â a modeling the, the calculations here are very simple.

Â Right?

Â I hope we all agree that the calculations are very simple.

Â but the, the principles, the idea of how the

Â modeling is going is, is a lot more delicate.

Â And, and, and actually on a lot more

Â shaking ground so that's why its a good idea

Â to always sort of make through your model

Â assumptions and what they imply for your actual hypothesis.

Â So just give you an example lets assume that our sample of people.

Â Are all people who are professional drug takers for pharmaceutical companies?

Â Sort of professional guinea pigs.

Â They, whenever a drug company says, oh, well, we

Â want to test out this headache medication, they sign up.

Â And then, there are, there are people who

Â do is, of cours, of course, right, you know.

Â You can, you can make, maybe not a, a

Â tremendous living doing it, but, but, you know, they,

Â the drug companies of course pay people for their

Â time, to, to, to test out these sorts of drugs.

Â then the, it would be hard

Â to, to, to to declare that population IID draw.

Â From the general population, because this is a very, very different sort of people.

Â They probably adhere to their medication schedule very very precisely and, and

Â other things like that, they're probably very good takers of medications.

Â They probably do the instructions quite well.

Â They know And so on.

Â so so any way, my point, my point, my larger point

Â being is that, that, when you, when you get this number 6.7,

Â which is very easy to obtain, you know, think about what it

Â means in the, in the context of the model that you've used.

Â And in this case the model is seemingly very benign, but

Â the, you know, the big part of the model is that.

Â The IID draw from a population. think about what that means in the context

Â of the problem that you're studying.

Â Coursera provides universal access to the worldâ€™s best education,
partnering with top universities and organizations to offer courses online.