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

Loading...

来自 约翰霍普金斯大学 的课程

Mathematical Biostatistics Boot Camp 2

40 评分

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

从本节课中

Hypothesis Testing

In this module, you'll get an introduction to hypothesis testing, a core concept in statistics. We'll cover hypothesis testing for basic one and two group settings as well as power. After you've watched the videos and tried the homework, take a stab at the quiz.

- Brian Caffo, PhDProfessor, Biostatistics

Bloomberg School of Public Health

OK so here's in a simple example of doing a two, a paired tea test.

So I took data from two exams from a particular class one year.

So I had two exams.

So clearly the data are paired because its the same students measured twice.

And so lets make up a questions so I have exam one and exam two,

and in the question I'm going to try and ask is there any evidence

that the second exam was easier or harder than the first.

And one way to investigate that question would be to ask whether the.

The mean of exam one or two is, mean of exam one is different than that of the

mean of exam two.

now you know again we're testing a

population mean so at some level I'm trying

to model this as if the students are some draw from some population of students.

which you know seems kind of reasonable in this setting.

even though it wasn't you know they weren't

exactly randomly they weren't randomly sampled but it seems

like a reasonable thing to try and do.

OK so let me take this summary for test one so at r I just take summary test

one and I found that the worst that the

students did which wasn't so bad was Was a 76%.

And the, the best, best people did 100%. And for test two, the, similarly

the worst people did was a 71%, and the best a person did was 100%.

Okay, so here's a plot scatter plot where I have test one on the horizontal axis.

Axis in test two on the vertical axis.

And, let's see, I've arranged it so the axis are

the same, so both starting at 70, and ending at 100.

And you know, maybe there's, there's some suggestion that, that,

that test to, the scores were a little bit higher.

It seems

like more points are, are lying above the identity line here than below.

the coloration was 0.21 and the standard deviation for test one

was, was six,and the standard deviation for test two was six also.

Oh, and the, the mean from the previous slide, the mean for test

one was, was, was 87, and the mean for test two was 90.

[SOUND]

Sample mean.

[SOUND]

and then on this next plot, what I'm showing

is the difference between test two and test one,

versus the average of test two and test one,

and this plot is basically the previous plot tilted.

for, 45 degrees sort of like kind of turning your head like that and and

the reason for doing that this, this is called a mean difference plot,

right?

The difference on the vertical axis and the mean

on the horizontal axis and There's, a very famous paper.

So, so Tukey was the person who came up with the mean difference plot.

but there's also a very famous paper on,

sort of, test retest reliability by Bland and Altman.

Where they, promote mean difference plots and actually

show how to, to, to do some inference.

Associated with them, so that these, these pots are, are quite well known.

And, and one of the reasons for doing them.

It's maybe not so necessary for this data set.

But, but if the correlation is high then you wind up with a

lot of blank space, if you do the scatter plot in the upper Left

hand corner and the lower right hand corner and, and, and rotating it in

this direction actually gives rid of a lot of that blank space and makes

for a far more efficient plot.

It, it, you know, so at any rate that's a, that's a, that's a well known technique

and whenever you're looking at paired observation I think for many people,

looking at the mean difference plot, is, is all, is more natural in,

in almost starting point of when looking at this kind of data.

Okay, so now let's actually perform our test.

I'm going to, I'm going to show R code here.

I'm hoping that everyone in the class at this point could actually do the test.

So the difference, I'm going to do the pair differences.

That's test two minus test one.

That's this first line. And is just the number of subjects.

I put a comment here that that worked out to be 49 subjects.

The mean in this case worked out to be 2.88.

The standard deviation worked out to be 7.61.

This is again the standard deviation of the det, tet, of the differences.

Okay, so my test statistic is the square root of the sample size.

Because remember that's in the denominator.

The denominator so we can just bring it

up to the numerator times the average difference.

Our null value that we're testing against is zero so I'm just going to leave

that out divided by the standard deviation and

the difference and I have a little comment

here that that works out to be 2.65. so The

the two, two sample t, t, p

value works out to be 0.01, so we reject, we, we

knew we were going to reject because 2.65 is is a big value

of of of Standard normal and you know, by the time we get

to 48 degrees of freedom, we're pretty close to a standard normal.

So we knew that 2.65 we were going to reject and the exact way we calculate

those p values, we would twice the probability of getting a test statistic.

as large or larger than 2.65.

for a t distribution with n minus one degress of freedom.

I, I think whether you do this with pt or p norm you're going to

get about the same answer and then because we're doing a two sided

test, we multiply it times two here so two times this t probability.

And that gives us our p value, works out to be around 0.01.

So we reject the null hypothesis.

And conclude that there does appear to be some, some

difference in the means between, test one and test two.

I would say you, you typically don't go through all these calculations.

you, you calculate your differences and then you just

use a function to, to do the work for you.

In this case, the function is t.test and r but.

Every statistical package has something to do paired to the test.

OK, so we're not going to spend too much more time on paired differences.

I'm hoping for everyone in this class that

this, this discussion is no great stretch for them.

so, but let me, let me raise some points.

wh-, you know, one, one thing that, that, When you're doing t tests, paired t tests.

it's, it's generally, worthwhile to ask the question,

are ratios more relevant than pairwise differences?

And if ratios are more relevant then they consider doing the paired tea

test on the log observations rather than the observations themselves.

so another thing is when considering matched Matched pairs

data you always want to do some plots first, plot the

first observation by the second, and then I showed you this mean/difference plot of

the average versus the difference. And again if you are interested

in, in relative quantities then do everything on the log scale,

what i mean by that is, is take the natural log of every observation.

And then proceed with the analysis.

with, with, with the log data, treating it

like you would treat the, the, the data normally.

so any way, this, this plot is called

the mean difference plot It was invented by Tukey.

And, and, and and, and, and is often

called a Bland/Altman plot from the very well-known

paper by Bland and Altman who, who added quite a big inference on top of it.

[NOISE]