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

52 ratings

At Coursera, you will find the best lectures in the world. Here are some of our personalized recommendations for you

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

Okay. So let's go through an example.

so, theta, le, let's consider an instance where theta is p1.

We're only going to consider x at this point.

Our theta hat, p1 hat x over n1. Our estimated standard error right,

the standard error for x over n1 is square root p1 hat, 1 minus p1 hat over n1.

I hope that's not used anywhere in this pa, case, and let's

assume that f we want to estimate is log.

So we're interested in log p1, for example.

So, f of x in this case is log x.

then f prime of x is 1 over x. Okay.

And then we know that theta hat minus theta over it's standard

error, that tends to a standard normal by the ordinary central limit theorem.

In this case, theta hat is an S simple average.

Okay. And we're just simply

subtracting off it's mean and dividing by a consistent standard error, so

it converges to a normal zero one by the ordinary central limit theorem.

So then its saying that the standard

error, the estimated standard error of the log

of the sample proportion is f prime theta hat times standard error of theta hat.

So lets go through that calculation.

So f prime of theta hat in this case is, f prime is one over its argument.

So in this case theta hat

is p1 hat.

So its one over p1 hat times the standard error, which

is square root p1 hat, 1 minus p1 hat over n1.

Rearrange terms then you get square root 1 minus

p1 hat divided by p1 hat, divided by n1.

And so, what this is saying is that log p1 hat minus p1 divided by this

standard error, square root 1 minus p1 hat over p1 hat times n1,

that tends to N(0,1).

So, if I want a confidence interval for p1, for log p1.

What I could do is take log p1 hat and add and

subtract to, a standard normal quartile, let's say 1.96 for a 95%

interval times this standard error here, square root 1 minus p 1

hat over p1 hat n1 hat and that would be an interval.

And so, that works out to be very convenient.

The only

complexity in this whole calculation, and it

was very mild complexity, was calculating the derivative

of the function that we are interested in, the rest of it was simple arithmatic.

And that is why the delta method is so powerful.

Okay.

So that actually doesn't give us a standard

error for the, the, the log relative risk.

and honestly to do that in its full glory, you need a multi-variant

version of the delta method, which there is

but we don't really cover it in this class.

So, let's look at the asymptotic standard error for the log relative risk.

Let's just kind of heuristically do it.

So the variance of the log relative risk is

the variance of log p1 hat divided by p2 hat.

And so, let's just say, you know, so, so

that is the variance of log p1 hat plus the

variance of log p2 hat, because we're assuming that x and y are independent.

The, the group one and group two binomial counts are independent.

And so this, from going from, these first three statements,

this variance to this variance to this second line here.

We, we, these are all exact equalities, we haven't done anything.

Now, if we were to use our delta method estimate

of variance for each of these things that

we calculated on the previous page, then we get

one minus p1 hat over p1 hat n1 plus 1 minus p2 hat over p2 hat n2.

And if we square root that, that is exactly the standard variance estimate for

the log relative risk that, that we gave at the beginning of the class.

Okay?

And so, that's where it comes from, and you

could do exactly the same thing for the odds ratio.

And you may have to do a little bit of arithmetic to show that it works

out to be 1 over n 1 1 plus 1 over n 1 2, and so on.

But, but the same exact rule applies.

And it's, it's relatively, it's relatively easy to do.

there's one small bit of fudging that we're doing here, in that, we're saying

that delta method variances add in the same way that, that, that random variable

variances add and, and that is the case. That is the case.

If you work out the multi-variant delta method, it,

it, it, the, the, the, the, the, the delta method

estimated variances of independent things works out to be the

sum of their delta method estimated variances worked out independently.

But for the purposes of the class, this is not an issue.

I think what, what hopefully what you can follow is that for the log relative

risk works out to be, for the variance of the log relative risk, we work out

to meeting the variance of the two component

parts, log p1 hat and log p2 hat.

And that we can calculate those associated variances with the delta method.

Now notice note, the delta doesn't just give you a standard

error and the variance calculation, It also gives you the asymptotic normality.

So that it, so that not only do you

get the variance estimate, but you get the inference too.

You get the actual confidence interval that you want to create

as well, or the hypothesis test that you'd like to perform.

So the delta method isn't just the standard error variance calculation.

That's just the, the neat part of it.

The, the rest of it, the, the delta method also tells you

you can put the whole thing together as a confidence interval estimate.

So, for my final thought on the delta method,

I thought I'd just show you quickly why it works.

And it, it's very easy.

It's surprisingly easy to prove. now we're going to do a heuristic here.

but the actual full proof is just not that different.

So, let's you know, assume you have a large sample size and the delta

method is an asymptotic technique, so we can assume there's a large sample size.

And if theta hat is close

to theta. Alright?

Then f of theta hat minus f of theta over theta hat minus theta.

Well that should be approximately, approximate to

approximately close to f prime of theta hat.

Now why is that?

Well, on the left hand side here as theta approaches

theta hat or theta hat approaches theta, either way this

is just the definition of a derivative of f.

Okay?

That's loo, if, if, if you're not familiar with

it, just look up the definition of a derivative.

It's the change in the function divided by the change in

the arguments as the change in the arguments goes to zero.

So this is exactly just the derivative of f.

Okay?

And then, you know, here you know, we're assuming that theta hat is

close to theta because theta hat converges to theta.

And so, consistent estimate.

Okay.

So this first line is true, and let's just assume

we multiply both sides by theta hat minus theta and divide

both sides by f prime of theta hat and we

get this left-hand expression here and this right hand expression here.

And then let's just suppose we divide both sides by the standard error.

The estimated standard error.

And then what you get is that the

right hand side is roughly equal to the left hand side.

And so, si, since the right hand side converges to a normal 0,1,

the left hand side should similarly converge to a normal 0,1.

And it, it also kind of gives you the heuristic of kind of why it works.

If we assume f is a smooth enough function.

Right?

And we appropriately derive, divide by the derivative,

then we're really kind of estimating the same thing as theta minus theta hat.

as provided theta hat is close to theta.

And that that's ultimately why it works, it's nothing other than

a, a, an instance of, of, of applying the definition of differentiation.

And if you want the formal proof, if you really want that kind of detail.

Any way, incidentally by the way my office is in a

way on a medical campus, and I'm right near the emergency

room, which is probably why you constantly hear the sirens going by.

so those are the ambulances going to

the emergency room, in case you were wondering.

so any way, if you want to improve, prove the mean value theorem identically.

Right? if you want to prove the delta method

exactly, what you have to use is, is a thing called the mean

value theorem, and then you, you get a very formal proof of it.

this heuristic is just based on the definition of, of a derivative, but if

you use the exact mean value theorem, then, then you get the full proof.

And and that's it, and so in case you're wondering where

you know, how in the world do people pull out these crazy

standard errors for the odds ratio and the

relative risk, where do these formulas come from?

It's a surprisingly easy little argument involving this

quantity, this, this, this concept called the delta method.

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