Variance of differences of random variables

WEBVTT
Kind: captions
Language: en

00:00:00.370 --> 00:00:03.470
What I want to do in this video
is build up some tools

00:00:03.470 --> 00:00:07.720
in our tool kit for dealing with
sums and differences of

00:00:07.720 --> 00:00:08.740
random variables.

00:00:08.740 --> 00:00:13.650
So let's say that we have two
random variables, x and y, and

00:00:13.650 --> 00:00:15.660
they are completely
independent.

00:00:15.660 --> 00:00:20.280
They are independent
random variables.

00:00:24.770 --> 00:00:26.090
And I'm just going to
go over a little bit

00:00:26.090 --> 00:00:27.440
of a notation here.

00:00:27.440 --> 00:00:30.730
If we wanted to know the
expected, or if we talked

00:00:30.730 --> 00:00:34.960
about the expected value of this
random variable x, that

00:00:34.960 --> 00:00:39.670
is the same thing as the
mean value of this

00:00:39.670 --> 00:00:41.130
random variable x.

00:00:41.130 --> 00:00:48.540
If we talk about the expected
the value of y, that is the

00:00:48.540 --> 00:00:53.080
same thing as the mean of y.

00:00:53.080 --> 00:01:00.350
If we talk about the variance of
the random variable x, that

00:01:00.350 --> 00:01:05.670
is it the same thing as the
expected value of the squared

00:01:05.670 --> 00:01:11.210
distances between our random
variable x and its mean.

00:01:11.210 --> 00:01:13.270
And that right there squared.

00:01:13.270 --> 00:01:19.790
So the expected value of these
squared differences, and that

00:01:19.790 --> 00:01:24.120
you could also use the notation
sigma squared for the

00:01:24.120 --> 00:01:25.560
random variable x.

00:01:25.560 --> 00:01:27.670
This is just a review of things
we already know, but I

00:01:27.670 --> 00:01:30.920
just want to reintroduce it
because I'll use this to build

00:01:30.920 --> 00:01:32.770
up some of our tools.

00:01:32.770 --> 00:01:35.390
So you do the same thing with
this with random variable y.

00:01:35.390 --> 00:01:40.090
The variance of random variable
y is the expected

00:01:40.090 --> 00:01:44.030
value of the squared difference
between our random

00:01:44.030 --> 00:01:50.960
variable y and the
mean of y, or the

00:01:50.960 --> 00:01:53.790
expected value of y, squared.

00:01:53.790 --> 00:01:59.000
And that's the same thing
as sigma squared of y.

00:01:59.000 --> 00:02:01.570
There is the variance of y.

00:02:01.570 --> 00:02:05.180
Now you may or may not already
know these properties of

00:02:05.180 --> 00:02:07.360
expected values and variances,
but I will

00:02:07.360 --> 00:02:08.330
reintroduce them to you.

00:02:08.330 --> 00:02:10.500
And I won't go into some
rigorous proof-- actually, I

00:02:10.500 --> 00:02:12.890
think they're fairly
easy to digest.

00:02:12.890 --> 00:02:17.080
So one is is that if I have some
third random variable,

00:02:17.080 --> 00:02:19.100
let's say I have some third
random variable that is

00:02:19.100 --> 00:02:23.070
defined as being the random
variable x plus the random

00:02:23.070 --> 00:02:23.620
variable y.

00:02:23.620 --> 00:02:25.760
Let me stay with my
colors just so

00:02:25.760 --> 00:02:27.210
everything becomes clear.

00:02:27.210 --> 00:02:33.260
The random variable x plus
the random variable y.

00:02:33.260 --> 00:02:36.400
What is the expected value
of z going to be?

00:02:36.400 --> 00:02:40.720
The expected the value of z is
going to be equal to the

00:02:40.720 --> 00:02:44.090
expected value of x plus y.

00:02:44.090 --> 00:02:46.190
And this is a property of
expected values-- I'm not

00:02:46.190 --> 00:02:48.760
going to prove it rigorously
right here-- but the expected

00:02:48.760 --> 00:02:54.610
value of x plus the expected
value of y, or another way to

00:02:54.610 --> 00:02:58.940
think about this is that the
mean of z is going to be the

00:02:58.940 --> 00:03:04.340
mean of x plus the mean of y.

00:03:04.340 --> 00:03:08.220
Or another way to view it is if
I wanted to take, let's say

00:03:08.220 --> 00:03:10.240
I have some other
random variable.

00:03:10.240 --> 00:03:11.370
I'm running out of
letters here.

00:03:11.370 --> 00:03:14.760
Let's say I have the random
variable a, and I define

00:03:14.760 --> 00:03:18.790
random variable a
to be x minus y.

00:03:18.790 --> 00:03:21.280
So what's its expected
value going to be?

00:03:21.280 --> 00:03:24.830
The expected value of a is
going to be equal to the

00:03:24.830 --> 00:03:29.750
expected value of x minus y,
which is equal to-- you could

00:03:29.750 --> 00:03:32.920
either view it as the expected
value of x plus the expected

00:03:32.920 --> 00:03:38.970
value of negative y, or the
expected value of x minus the

00:03:38.970 --> 00:03:44.310
expected value of y, which is
the same thing as the mean of

00:03:44.310 --> 00:03:47.680
x minus the mean of y.

00:03:47.680 --> 00:03:52.520
So this is what the mean of
our random variable a

00:03:52.520 --> 00:03:54.180
would be equal to.

00:03:54.180 --> 00:03:56.700
And all of this is review and
I'm going to use this when we

00:03:56.700 --> 00:03:59.140
start talking about the
distributions that are sums

00:03:59.140 --> 00:04:01.580
and differences of other
distributions.

00:04:01.580 --> 00:04:05.610
Now let's think about what the
variance of random variable z

00:04:05.610 --> 00:04:09.260
is and what the variance of
random variable a is.

00:04:09.260 --> 00:04:18.149
So the variance of z-- and just
to kind of always focus

00:04:18.149 --> 00:04:20.200
back on the intuition,
it makes sense.

00:04:20.200 --> 00:04:24.880
If x is completely independent
of y and if I have some random

00:04:24.880 --> 00:04:27.780
variable that is the sum of
the two, then the expected

00:04:27.780 --> 00:04:32.440
value of that variable, of that
new variable, is going to

00:04:32.440 --> 00:04:35.530
be the sum of the expected
values of the other two

00:04:35.530 --> 00:04:37.440
because they are unrelated.

00:04:37.440 --> 00:04:41.690
If my expected value here is 5
and my expected value here is

00:04:41.690 --> 00:04:46.370
7, completely reasonable that my
expected value here is 12,

00:04:46.370 --> 00:04:48.500
assuming that they're completely
independent.

00:04:48.500 --> 00:04:54.780
Now if we have a situation, so
what is the variance of my

00:04:54.780 --> 00:04:56.070
random variable z?

00:04:56.070 --> 00:04:58.390
And once again, I'm not going do
a rigorous proof here, this

00:04:58.390 --> 00:05:01.040
is really just a property
of variances.

00:05:01.040 --> 00:05:03.840
But I'm going to use this to
establish what the variance of

00:05:03.840 --> 00:05:06.450
our random variable a is.

00:05:06.450 --> 00:05:11.870
So if this squared distance on
average is some variance, and

00:05:11.870 --> 00:05:14.150
this one is completely
independent, it's squared

00:05:14.150 --> 00:05:17.410
distance on average is some
distance, then the variance of

00:05:17.410 --> 00:05:21.360
their sum is actually going to
be the sum of their variances.

00:05:21.360 --> 00:05:29.520
So this is going to be equal
to the variance of random

00:05:29.520 --> 00:05:33.723
variable x plus the variance
of random variable y.

00:05:36.740 --> 00:05:42.870
Or another way of thinking about
it is that the variance

00:05:42.870 --> 00:05:52.800
of z, which is the same thing
as the variance of x plus y,

00:05:52.800 --> 00:06:02.570
is equal to the variance of x
plus the variance of random

00:06:02.570 --> 00:06:04.190
variable y.

00:06:04.190 --> 00:06:05.170
Hopefully that make
some sense.

00:06:05.170 --> 00:06:06.780
I'm not proving it to
you rigorously.

00:06:06.780 --> 00:06:09.130
And you'll see this in a lot
of statistics books.

00:06:09.130 --> 00:06:12.330
Now what I want to show you is
that the variance of random

00:06:12.330 --> 00:06:15.440
variable a is actually this
exact same thing.

00:06:15.440 --> 00:06:17.400
And that's the interesting
thing, because you might say,

00:06:17.400 --> 00:06:18.640
hey, why wouldn't it
be the difference?

00:06:18.640 --> 00:06:20.100
We had the differences
over here.

00:06:20.100 --> 00:06:22.330
So let's experiment with
this a little bit.

00:06:22.330 --> 00:06:28.670
The variance-- so I'll just
write this-- the variance of

00:06:28.670 --> 00:06:32.750
random variable a is the same
thing as the variance of--

00:06:32.750 --> 00:06:39.110
I'll write it like this-- as x
minus y, which is equal to--

00:06:39.110 --> 00:06:45.270
you could view it this way--
which is equal to the variance

00:06:45.270 --> 00:06:50.630
of x plus negative y.

00:06:50.630 --> 00:06:53.240
These are equivalent
statements.

00:06:53.240 --> 00:06:56.550
So you could view this as being
equal to-- just using

00:06:56.550 --> 00:06:59.610
this over here, the sum of these
two variances, so it's

00:06:59.610 --> 00:07:05.050
going to be equal to the sum of
the variance of x plus the

00:07:05.050 --> 00:07:08.950
variance of negative y.

00:07:08.950 --> 00:07:11.100
Now what I need to show you is
that the variance of negative

00:07:11.100 --> 00:07:13.340
y, of the negative of that
random variables are going to

00:07:13.340 --> 00:07:15.750
be the same thing as
the variance of y.

00:07:15.750 --> 00:07:18.280
So what is the variance
of negative y?

00:07:18.280 --> 00:07:23.010
The variance of negative y is
the same thing as the variance

00:07:23.010 --> 00:07:32.060
of negative y, which is equal
to the expected value of the

00:07:32.060 --> 00:07:42.370
distance between negative y
and the expected value of

00:07:42.370 --> 00:07:45.970
negative y squared.

00:07:45.970 --> 00:07:50.080
That's all the variance
actually is.

00:07:50.080 --> 00:07:56.650
Now what is the expected value
of negative y right over here?

00:07:56.650 --> 00:07:59.240
Actually, even better let me
factor out a negative 1.

00:07:59.240 --> 00:08:01.420
So what's in the parentheses
right here, this is the exact

00:08:01.420 --> 00:08:07.460
same thing as negative 1 squared
times y plus the

00:08:07.460 --> 00:08:11.430
expected value of negative y.

00:08:11.430 --> 00:08:13.110
So that's the same exact
same thing in the

00:08:13.110 --> 00:08:14.670
parentheses, squared.

00:08:14.670 --> 00:08:17.120
So everything in magenta is
everything in magenta here,

00:08:17.120 --> 00:08:19.090
and it is the expected
value of that thing.

00:08:22.610 --> 00:08:26.956
Now what is the expected
value of negative y?

00:08:26.956 --> 00:08:30.390
The expected value of negative
y-- I'll do it over here-- the

00:08:30.390 --> 00:08:33.770
expected value of the negative
of a random variable is just a

00:08:33.770 --> 00:08:37.000
negative of the expected value
of that random variable.

00:08:37.000 --> 00:08:40.350
So if you look at this we can
re-write this-- I'll give

00:08:40.350 --> 00:08:42.860
myself a little bit more space--
we can re-write this

00:08:42.860 --> 00:08:46.240
as the expected value-- the
variance of negative y is the

00:08:46.240 --> 00:08:47.850
expected value--
this is just 1.

00:08:47.850 --> 00:08:49.930
Negative 1 squared is just 1.

00:08:49.930 --> 00:08:54.750
And over here you have y, and
instead just write plus the

00:08:54.750 --> 00:08:57.530
expected value of negative y,
that's the same thing as minus

00:08:57.530 --> 00:09:00.270
the expected value of y.

00:09:00.270 --> 00:09:03.140
So you have that, and then
all of that squared.

00:09:03.140 --> 00:09:10.160
Now notice, this is the exact
same thing by definition as

00:09:10.160 --> 00:09:13.020
the variance of y.

00:09:13.020 --> 00:09:15.000
So what we just showed you
just now, so this is the

00:09:15.000 --> 00:09:15.720
variance of y.

00:09:15.720 --> 00:09:22.340
So we just showed you is that
the variance of the difference

00:09:22.340 --> 00:09:27.770
of two independent random
variables is equal to the sum

00:09:27.770 --> 00:09:30.950
of the variances.

00:09:30.950 --> 00:09:33.810
You could definitely believe
this, it's equal to the sum of

00:09:33.810 --> 00:09:37.090
the variance of the first one
plus the variance of the

00:09:37.090 --> 00:09:38.720
negative of the second one.

00:09:38.720 --> 00:09:41.250
And we just showed that that
variance is the same thing as

00:09:41.250 --> 00:09:43.510
the variance of the positive
version of that variable,

00:09:43.510 --> 00:09:44.230
which makes sense.

00:09:44.230 --> 00:09:47.810
Your distance from the mean is
going to be-- it doesn't

00:09:47.810 --> 00:09:49.610
matter whether you're taking the
positive or the negative

00:09:49.610 --> 00:09:50.020
of the variable.

00:09:50.020 --> 00:09:51.410
You just cared about
absolute distance.

00:09:51.410 --> 00:09:54.510
So it makes complete sense that
that quantity and that

00:09:54.510 --> 00:09:56.860
quantity is going to
be the same thing.

00:09:56.860 --> 00:09:59.040
Now the whole reason why I went
through this exercise,

00:09:59.040 --> 00:10:03.360
kind of the important takeaways
here is that the

00:10:03.360 --> 00:10:08.810
mean of differences right over
here-- so I could re-write it

00:10:08.810 --> 00:10:12.650
as the differences of the random
variable is the same

00:10:12.650 --> 00:10:14.760
thing as the differences
of their means.

00:10:14.760 --> 00:10:16.600
And then the other important
takeaway, and I'm going to

00:10:16.600 --> 00:10:20.220
build on this in the next few
videos, is that the variance

00:10:20.220 --> 00:10:24.350
of the difference-- if I define
a new random variable

00:10:24.350 --> 00:10:27.420
is the difference of two other
random variables, the variance

00:10:27.420 --> 00:10:29.790
of that random variable is
actually the sum of the

00:10:29.790 --> 00:10:31.850
variances of the two
random variables.

00:10:31.850 --> 00:10:35.030
So these are the two important
takeaways that we'll use to

00:10:35.030 --> 00:10:37.010
build on in future videos.

00:10:37.010 --> 00:10:39.930
Anyway, hopefully that
wasn't too confusing.

00:10:39.930 --> 00:10:42.270
If it was, you can kind of
just accept these at face

00:10:42.270 --> 00:10:44.430
value and just assume
that these are tools

00:10:44.430 --> 00:10:46.090
that you can use.


Large sample proportion hypothesis testing

WEBVTT
Kind: captions
Language: en

00:00:00.360 --> 00:00:04.180
We want to test the hypothesis
that more than 30% of U.S.

00:00:04.180 --> 00:00:07.300
households have internet access
with a significance

00:00:07.300 --> 00:00:08.720
level of 5%.

00:00:08.720 --> 00:00:13.270
We collect a sample of 150
households, and find that 57

00:00:13.270 --> 00:00:14.640
have access.

00:00:14.640 --> 00:00:17.940
So to do our hypothesis test,
let's just establish our null

00:00:17.940 --> 00:00:21.550
hypothesis and our alternative
hypothesis.

00:00:21.550 --> 00:00:25.780
So our null hypothesis is that
the hypothesis is not correct.

00:00:25.780 --> 00:00:30.430
Our null hypothesis is that
the proportion of U.S.

00:00:30.430 --> 00:00:33.140
households that have internet
access is less

00:00:33.140 --> 00:00:35.910
than or equal to 30%.

00:00:35.910 --> 00:00:38.890
And our alternative hypothesis,
is what our

00:00:38.890 --> 00:00:42.030
hypothesis actually is, is
that the proportion is

00:00:42.030 --> 00:00:44.110
greater than 30%.

00:00:44.110 --> 00:00:44.910
We see it over here.

00:00:44.910 --> 00:00:48.980
We want to test the hypothesis
that more than 30% of U.S.

00:00:48.980 --> 00:00:50.580
households have internet
access.

00:00:50.580 --> 00:00:51.860
That's that right here.

00:00:51.860 --> 00:00:52.910
This is what we're testing.

00:00:52.910 --> 00:00:55.530
We're testing the alternative
hypothesis.

00:00:55.530 --> 00:00:58.870
And the way we're going to do it
is we're going to assume a

00:00:58.870 --> 00:01:01.950
P-value based on the
null hypothesis.

00:01:01.950 --> 00:01:04.129
We're going to assume a
proportion based on the null

00:01:04.129 --> 00:01:05.850
hypothesis for the population.

00:01:05.850 --> 00:01:09.310
And the given that assumption,
what is the probability that

00:01:09.310 --> 00:01:19.410
57 out of 150 of our samples
actually have internet access.

00:01:19.410 --> 00:01:25.810
And if that probability is less
than 5%, if it's less

00:01:25.810 --> 00:01:29.610
than our significance level,
then we're going to reject the

00:01:29.610 --> 00:01:32.790
null hypothesis in favor
of the alternative one.

00:01:32.790 --> 00:01:34.550
So let's think about
this a little bit.

00:01:34.550 --> 00:01:37.580
So we're going to start off
assuming-- we're going to

00:01:37.580 --> 00:01:42.930
assume the null hypothesis
is true.

00:01:42.930 --> 00:01:45.780
And in that assumption we're
going to have to pick a

00:01:45.780 --> 00:01:49.150
population proportion or a
population mean-- we know that

00:01:49.150 --> 00:01:51.095
for Bernoulli distributions
do the same thing.

00:01:51.095 --> 00:01:53.250
And what I'm going to do is I'm
going to pick a proportion

00:01:53.250 --> 00:01:57.460
so high so that it maximizes
the probability of getting

00:01:57.460 --> 00:01:58.070
this over here.

00:01:58.070 --> 00:01:59.710
And we actually don't even
know what that number is.

00:01:59.710 --> 00:02:01.940
And actually so that we can
think about a little more

00:02:01.940 --> 00:02:04.180
intelligent, let's just find
out what our sample

00:02:04.180 --> 00:02:05.630
proportion even is.

00:02:05.630 --> 00:02:10.060
We had 57 people out of 150
having internet access.

00:02:10.060 --> 00:02:12.150
So 57 households out of 150.

00:02:12.150 --> 00:02:15.430
So our sample proportion
is 0.38, so let me

00:02:15.430 --> 00:02:17.070
write that over here.

00:02:17.070 --> 00:02:23.870
Our sample proportion
is equal to 0.38.

00:02:23.870 --> 00:02:28.290
So when we assume our null
hypothesis to be true, we're

00:02:28.290 --> 00:02:39.210
going to assume a population
proportion that maximizes the

00:02:39.210 --> 00:02:40.970
probability that we get
this over here.

00:02:40.970 --> 00:02:43.530
So the highest population
proportion that's within our

00:02:43.530 --> 00:02:46.440
null hypothesis that will
maximize the probability of

00:02:46.440 --> 00:02:49.560
getting this is actually
if we are right at 30%.

00:02:49.560 --> 00:02:51.910
So if we say our population
proportion, we're going to

00:02:51.910 --> 00:02:52.940
assume this is true.

00:02:52.940 --> 00:02:54.630
This is our null hypothesis.

00:02:54.630 --> 00:02:58.160
We're going to assume that
it is 0.3 or 30%.

00:02:58.160 --> 00:03:01.430
And I want you understand that--
29% would have been a

00:03:01.430 --> 00:03:02.170
null hypothesis.

00:03:02.170 --> 00:03:04.570
28% that would have been
a null hypothesis.

00:03:04.570 --> 00:03:07.550
But for 29% or 28%, the
probability of getting this

00:03:07.550 --> 00:03:08.870
would have been even lower.

00:03:08.870 --> 00:03:11.870
So it wouldn't have been
as strong of a test.

00:03:11.870 --> 00:03:16.060
If we take the maximum
proportion that still

00:03:16.060 --> 00:03:19.070
satisfies our null hypothesis,
we're maximizing the

00:03:19.070 --> 00:03:20.610
probability that we get this.

00:03:20.610 --> 00:03:23.150
So if that number is still low,
if it's still less than

00:03:23.150 --> 00:03:26.380
5%, we can feel pretty good
about the alternative

00:03:26.380 --> 00:03:27.440
hypothesis.

00:03:27.440 --> 00:03:30.210
So just to refresh ourselves
we're going to assume a

00:03:30.210 --> 00:03:33.700
population proportion of 0.3,
and if we just think about the

00:03:33.700 --> 00:03:36.660
distribution-- sometimes it's
helpful to draw these things,

00:03:36.660 --> 00:03:38.890
so I will draw it.

00:03:38.890 --> 00:03:41.900
So this is what the population
distribution looks like based

00:03:41.900 --> 00:03:43.350
on our assumption,
based on this

00:03:43.350 --> 00:03:45.360
assumption right over here.

00:03:45.360 --> 00:03:48.930
Our population distribution
has-- or maybe I should write

00:03:48.930 --> 00:03:52.560
30% have internet access.

00:03:52.560 --> 00:03:54.740
And I'll signify
that with a 1.

00:03:54.740 --> 00:03:56.585
And then the rest don't
have internet access.

00:04:00.790 --> 00:04:03.560
70% do not have internet
access.

00:04:03.560 --> 00:04:06.070
This is just a Bernoulli
distribution.

00:04:06.070 --> 00:04:08.500
We know that the mean over here
is going to be the same

00:04:08.500 --> 00:04:11.390
thing as the proportion that
has internet access.

00:04:11.390 --> 00:04:22.160
So the mean over here is going
to be 0.3, same thing as 30%.

00:04:22.160 --> 00:04:23.370
This is the population mean.

00:04:23.370 --> 00:04:25.510
And maybe I should
write this way.

00:04:25.510 --> 00:04:30.850
The mean assuming our null
hypothesis, the population

00:04:30.850 --> 00:04:34.510
mean assuming our null
hypothesis is 0.3.

00:04:34.510 --> 00:04:37.810
And then the population
standard deviation.

00:04:37.810 --> 00:04:39.510
Let me write this over
here in yellow.

00:04:39.510 --> 00:04:43.190
The population standard
deviation assuming our null

00:04:43.190 --> 00:04:45.880
hypothesis.

00:04:45.880 --> 00:04:49.160
And we've seen this when we
first learned about Bernoulli

00:04:49.160 --> 00:04:50.210
distributions.

00:04:50.210 --> 00:04:58.620
It is going to be the square
root of the percentage of the

00:04:58.620 --> 00:05:03.310
population that has internet
access, so 0.3 times the

00:05:03.310 --> 00:05:05.470
proportion of the population
that does not have internet

00:05:05.470 --> 00:05:09.520
access, times 0.7
right over here.

00:05:09.520 --> 00:05:15.430
So this is the square
root of 0.21.

00:05:15.430 --> 00:05:18.290
And we could deal with this
later using our calculator.

00:05:18.290 --> 00:05:21.630
Now, with that out of the way,
we want to figure out the

00:05:21.630 --> 00:05:25.600
probability of getting a sample

00:05:25.600 --> 00:05:29.100
proportion that has a 0.38.

00:05:29.100 --> 00:05:32.850
So let's look at the
distribution of sample

00:05:32.850 --> 00:05:33.550
proportions.

00:05:33.550 --> 00:05:36.160
So you could literally look at
every combination of getting

00:05:36.160 --> 00:05:40.570
150 households from this, and
you would actually get a

00:05:40.570 --> 00:05:42.350
binomial distribution.

00:05:42.350 --> 00:05:43.780
And we've also seen
this before.

00:05:43.780 --> 00:05:46.300
You would actually get a
binomial distribution where

00:05:46.300 --> 00:05:51.010
you'd get a bunch of
bars like that.

00:05:51.010 --> 00:05:55.530
But if your n is suitably large,
and in particular-- and

00:05:55.530 --> 00:06:02.670
this is kind of the test for
it-- the test if n times p--

00:06:02.670 --> 00:06:06.190
and in this case we're saying
p is 30%-- if n times p is

00:06:06.190 --> 00:06:11.940
greater than 5, and n times 1
minus p is greater than 5, you

00:06:11.940 --> 00:06:16.570
can assume that the distribution
of the sample

00:06:16.570 --> 00:06:19.410
proportion or the sample
proportion distribution is

00:06:19.410 --> 00:06:21.220
going to be normal.

00:06:21.220 --> 00:06:22.770
So if you looked at all of the
different ways you could

00:06:22.770 --> 00:06:25.820
sample 150 households from this
population, you get all

00:06:25.820 --> 00:06:26.790
of these bars.

00:06:26.790 --> 00:06:30.250
But since our n is pretty big,
it's 150, and 150 times 0.3 is

00:06:30.250 --> 00:06:31.550
obviously greater than 5.

00:06:31.550 --> 00:06:34.210
150 times 0.7 is also
greater than 5.

00:06:34.210 --> 00:06:36.375
You can approximate that with
a normal distribution.

00:06:36.375 --> 00:06:38.070
So let me do that.

00:06:38.070 --> 00:06:42.090
So you can approximate it with
a normal distribution.

00:06:42.090 --> 00:06:48.540
So this is a normal distribution
right over there.

00:06:48.540 --> 00:06:52.120
Now the mean of the distribution
of the proportion

00:06:52.120 --> 00:06:55.190
data that we're assuming is a
normal distribution is going

00:06:55.190 --> 00:06:57.270
to be-- and remember, working
under the context that the

00:06:57.270 --> 00:06:58.500
null hypothesis is true.

00:06:58.500 --> 00:07:04.210
So this mean is going to be--
this mean right here-- so the

00:07:04.210 --> 00:07:11.550
mean of our sample proportions
is going to be the same thing

00:07:11.550 --> 00:07:13.150
as our population mean.

00:07:13.150 --> 00:07:18.180
So this is going to be 0.3,
same value as that.

00:07:18.180 --> 00:07:20.860
And the standard deviation---
this comes straight from the

00:07:20.860 --> 00:07:22.320
central limit theorem.

00:07:22.320 --> 00:07:28.870
So the standard deviation of
our sample proportions, the

00:07:28.870 --> 00:07:34.200
standard deviation is going to
be the square root-- let me

00:07:34.200 --> 00:07:38.230
put it this way-- it's going to
be our population standard

00:07:38.230 --> 00:07:41.180
deviation, the standard
deviation we're assuming with

00:07:41.180 --> 00:07:44.610
our null hypothesis divided by
the square root of the number

00:07:44.610 --> 00:07:48.630
of samples we have. And in this
case we have 150 samples.

00:07:48.630 --> 00:07:51.320
It's going to be 150 samples
and we can calculate this.

00:07:51.320 --> 00:07:53.370
This value on top we just
figured out is the

00:07:53.370 --> 00:07:55.610
square root of 0.21.

00:07:55.610 --> 00:07:59.770
So this is the square root
of 0.21 over the

00:07:59.770 --> 00:08:05.270
square root of 150.

00:08:05.270 --> 00:08:09.150
And I can get the calculator
out to calculate this.

00:08:09.150 --> 00:08:12.825
So I'll just do it the
way I wrote it.

00:08:12.825 --> 00:08:19.890
The square root of 0.21-- and
I'm going to divide that, so

00:08:19.890 --> 00:08:22.630
whatever answer is I'm going to
divide that by the square

00:08:22.630 --> 00:08:26.320
root of 150.

00:08:26.320 --> 00:08:29.320
So it's 0.037.

00:08:29.320 --> 00:08:33.630
So we figured out the standard
deviation here of our-- or the

00:08:33.630 --> 00:08:38.100
distribution of our sample
proportions is going to be--

00:08:38.100 --> 00:08:40.120
let me write this down, I'll
scroll over to the right a

00:08:40.120 --> 00:08:44.580
little bit-- it is 0.037.

00:08:44.580 --> 00:08:46.150
I think I'm falling off the
screen a little bit.

00:08:46.150 --> 00:08:49.770
So we'll just say 0.037.

00:08:49.770 --> 00:08:54.360
Now to figure out the
probability of having a sample

00:08:54.360 --> 00:08:58.270
proportion of 0.38, we just have
to figure out how many

00:08:58.270 --> 00:09:02.420
standard deviations that is
away from our mean, or

00:09:02.420 --> 00:09:07.140
essentially calculate a
Z-statistic for our sample,

00:09:07.140 --> 00:09:09.650
because a Z-statistic or a
Z-score is really just how

00:09:09.650 --> 00:09:12.100
many standard deviations you
are away from the mean.

00:09:12.100 --> 00:09:14.600
And then figure out whether
the probability of getting

00:09:14.600 --> 00:09:20.310
that Z-statistic is more
or less than 5%.

00:09:20.310 --> 00:09:23.350
So let's figure out how many
standard deviations we are

00:09:23.350 --> 00:09:24.360
away from the mean.

00:09:24.360 --> 00:09:28.640
So just remind ourselves, this
sample proportion we got we

00:09:28.640 --> 00:09:31.880
can view as just a sample from
this distribution of all of

00:09:31.880 --> 00:09:33.220
the possible sample
proportions.

00:09:33.220 --> 00:09:34.670
So how many standard
deviations away

00:09:34.670 --> 00:09:36.110
from the mean is this?

00:09:36.110 --> 00:09:40.540
So if we take our sample
proportion, subtract from that

00:09:40.540 --> 00:09:44.820
the mean of the distribution
of sample proportions and

00:09:44.820 --> 00:09:49.480
divide it by the standard
deviation of the distribution

00:09:49.480 --> 00:10:00.360
of the sample proportions, we
get 0.38, 0.38 minus 0.3.

00:10:00.360 --> 00:10:02.290
All of that over this
value which we just

00:10:02.290 --> 00:10:06.190
figured out was 0.037.

00:10:06.190 --> 00:10:07.180
So what does that give us?

00:10:07.180 --> 00:10:13.460
The numerator over
here is a 0.08.

00:10:13.460 --> 00:10:17.120
The denominator is 0.037.

00:10:17.120 --> 00:10:19.240
So let's figure this out.

00:10:19.240 --> 00:10:24.910
So our numerator is 0.08 divided
by this last number

00:10:24.910 --> 00:10:27.520
right here, which
is the 0.037.

00:10:27.520 --> 00:10:32.660
So second answer and we get
2.1-- I'll just round it to

00:10:32.660 --> 00:10:34.650
2.14 standard deviations.

00:10:34.650 --> 00:10:43.460
So this is equal to-- this right
here is equal to 2.14

00:10:43.460 --> 00:10:45.250
standard deviations.

00:10:45.250 --> 00:10:48.430
Or we could say that our
Z-statistic, right, we could

00:10:48.430 --> 00:10:51.350
call this our Z-score or our
Z-statistic, the number of

00:10:51.350 --> 00:10:56.540
standard deviations we are away
from our mean is 2.14.

00:10:56.540 --> 00:11:00.020
We're at 2.14, and to be exact,
we're 2.14 standard

00:11:00.020 --> 00:11:01.800
deviations above the mean.

00:11:01.800 --> 00:11:04.620
We're going to care about a
one-tailed distribution.

00:11:04.620 --> 00:11:07.970
Now is the probability
of getting this more

00:11:07.970 --> 00:11:09.530
or less than 5%?

00:11:09.530 --> 00:11:12.490
If it's less than 5% we're
going to reject the null

00:11:12.490 --> 00:11:15.160
hypothesis in favor of
our alternative.

00:11:15.160 --> 00:11:16.740
So how do we think about that?

00:11:16.740 --> 00:11:20.580
Well let's think about just
a normalized normal

00:11:20.580 --> 00:11:22.450
distribution.

00:11:22.450 --> 00:11:25.330
Or maybe you could call the
Z-distribution if you want.

00:11:25.330 --> 00:11:27.950
If you look at a normal
distribution, a completely

00:11:27.950 --> 00:11:29.320
normalized normal distribution,

00:11:29.320 --> 00:11:30.570
it's mean is at 0.

00:11:33.040 --> 00:11:34.730
And essentially each
of these values

00:11:34.730 --> 00:11:36.440
are essentially Z-scores.

00:11:36.440 --> 00:11:40.130
Because a value of 1 literally
means you are 1 standard

00:11:40.130 --> 00:11:43.140
deviation away from this
mean over here.

00:11:43.140 --> 00:11:49.120
So we need to find a critical
Z-value right over here.

00:11:49.120 --> 00:11:55.770
Let me call that a critical Z--
we could even say critical

00:11:55.770 --> 00:12:00.930
Z-score or critical Z-value--
so that the probability of

00:12:00.930 --> 00:12:04.450
getting a Z-value higher
than that is 5%.

00:12:04.450 --> 00:12:08.540
So that this whole area
right here is 5%.

00:12:08.540 --> 00:12:11.480
And that's because that's what
our significance level is.

00:12:11.480 --> 00:12:15.450
Anything that has a lower than
5% a chance of occurring, for

00:12:15.450 --> 00:12:19.150
us will be validation to reject
our null hypothesis.

00:12:19.150 --> 00:12:21.830
Or another way of thinking about
it is that area's 5%,

00:12:21.830 --> 00:12:26.870
this whole area right
over here is 95%.

00:12:26.870 --> 00:12:29.690
And once again, this is a
one-tailed test, because we

00:12:29.690 --> 00:12:31.990
only care about values
greater than this.

00:12:31.990 --> 00:12:34.890
Z-values greater than that will
make us reject the null

00:12:34.890 --> 00:12:35.870
hypothesis.

00:12:35.870 --> 00:12:37.700
And to figure out this critical
Z-value you can

00:12:37.700 --> 00:12:39.590
literally just go
to a Z-table.

00:12:39.590 --> 00:12:44.210
And we say OK, the probability
of being a Z-value less than

00:12:44.210 --> 00:12:46.650
that is 95%.

00:12:46.650 --> 00:12:48.440
And that's exactly the number
that this gives us.

00:12:48.440 --> 00:12:50.090
The cumulative probability
of getting a

00:12:50.090 --> 00:12:51.800
value less than that.

00:12:51.800 --> 00:12:54.800
So if we just scan this,
we're looking for 95%.

00:12:54.800 --> 00:12:58.610
We have 0.9495, we
have 0.9505.

00:12:58.610 --> 00:13:01.330
So I'll go with this just
to make sure we're

00:13:01.330 --> 00:13:02.490
a little bit closer.

00:13:02.490 --> 00:13:07.060
So this Z-value, and the z-value
here is 1.6, and the

00:13:07.060 --> 00:13:08.550
next digit is 5.

00:13:08.550 --> 00:13:11.260
1.6 5.

00:13:11.260 --> 00:13:15.380
So this critical Z-value
is equal to 1.65.

00:13:15.380 --> 00:13:23.910
So the probability of getting
a Z-value less than 1.65, or

00:13:23.910 --> 00:13:25.730
even in a completely
normalized normal

00:13:25.730 --> 00:13:27.720
distribution, the probability
of getting a

00:13:27.720 --> 00:13:29.310
value less than 1.65.

00:13:29.310 --> 00:13:33.570
Or in any normal distribution,
the probability of being less

00:13:33.570 --> 00:13:37.790
than 1.65 standard deviations
away from the mean

00:13:37.790 --> 00:13:40.620
is going to be 95%.

00:13:40.620 --> 00:13:42.800
So that's our critical
Z-value.

00:13:42.800 --> 00:13:46.200
Now does Z-value, or the
Z-statistic, for our actual

00:13:46.200 --> 00:13:49.140
sample is 2.14.

00:13:49.140 --> 00:13:51.940
Our actual Z-value
we got is 2.14.

00:13:51.940 --> 00:13:54.140
It's sitting all the way
out here some place.

00:13:54.140 --> 00:13:56.710
So the probability of
getting that was

00:13:56.710 --> 00:13:59.135
definitely less than 5%.

00:13:59.135 --> 00:14:01.050
And actually we could even say
what's the probability of

00:14:01.050 --> 00:14:03.360
getting that or a more
extreme result.

00:14:03.360 --> 00:14:05.720
And if you figured out this
area, and you could actually

00:14:05.720 --> 00:14:08.760
figure it out by looking at a
Z-table, you could figure out

00:14:08.760 --> 00:14:10.980
the P-value of this result.

00:14:10.980 --> 00:14:14.160
But anyway, the whole exercise
here is just to figure out if

00:14:14.160 --> 00:14:17.810
can reject the null hypothesis
with a significance level 5%.

00:14:17.810 --> 00:14:18.890
We can.

00:14:18.890 --> 00:14:22.250
This is a more extreme result
than our critical Z-value, so

00:14:22.250 --> 00:14:28.240
we can reject the null
hypothesis in favor of our

00:14:28.240 --> 00:14:29.490
alternative.


T-statistic confidence interval

WEBVTT
Kind: captions
Language: en

00:00:00.610 --> 00:00:03.190
This is the same problem that
we had in the last video.

00:00:03.190 --> 00:00:05.620
But instead of trying to figure
out whether the data

00:00:05.620 --> 00:00:08.200
supplies sufficient evidence to
conclude that the engines

00:00:08.200 --> 00:00:10.760
meet the actual emissions
requirement, and all of the

00:00:10.760 --> 00:00:14.220
hypothesis testing, I thought I
would also use the same data

00:00:14.220 --> 00:00:18.170
that we had in the last video to
actually come up with a 95%

00:00:18.170 --> 00:00:19.460
confidence interval.

00:00:19.460 --> 00:00:21.620
So you could ignore the
question right here.

00:00:21.620 --> 00:00:23.080
You can ignore all of this.

00:00:23.080 --> 00:00:26.040
I'm just using that same data
to come up with a 95%

00:00:26.040 --> 00:00:29.960
confidence interval for the
actual mean emission for this

00:00:29.960 --> 00:00:31.310
new engine design.

00:00:31.310 --> 00:00:40.200
So we want to find a 95%
confidence interval.

00:00:40.200 --> 00:00:43.790
And as you could imagine,
because we only have 10

00:00:43.790 --> 00:00:46.770
samples right here, we're
going to want to use a

00:00:46.770 --> 00:00:47.960
T-distribution.

00:00:47.960 --> 00:00:51.450
And right down here
I have a T-table.

00:00:51.450 --> 00:00:53.740
And we want a 95% confidence
interval.

00:00:53.740 --> 00:00:59.750
So we want to think about the
range of T-values that 95-- or

00:00:59.750 --> 00:01:03.050
the range that 95% of T-values
will fall under.

00:01:03.050 --> 00:01:04.190
So let's think about this way.

00:01:04.190 --> 00:01:05.180
So let me draw a

00:01:05.180 --> 00:01:11.660
T-distribution right over here.

00:01:11.660 --> 00:01:14.260
So a T-distribution looks
very similar to a normal

00:01:14.260 --> 00:01:18.210
distribution but it
has fatter tails.

00:01:18.210 --> 00:01:20.400
This end and this end will be
fatter than in a normal

00:01:20.400 --> 00:01:21.630
distribution.

00:01:21.630 --> 00:01:25.510
And then we want to find an
interval, so if this is a

00:01:25.510 --> 00:01:29.150
normalized T-distribution the
mean is going to be 0.

00:01:29.150 --> 00:01:32.720
And we want to find interval
of T-values between some

00:01:32.720 --> 00:01:35.740
negative value here and some
positive value here that

00:01:35.740 --> 00:01:41.850
contains 95% of the
probability.

00:01:41.850 --> 00:01:45.030
So this right here
has to be 95%.

00:01:45.030 --> 00:01:48.330
And to figure what these
critical T-values are at this

00:01:48.330 --> 00:01:50.930
end and this end, we can
just use a T-table.

00:01:50.930 --> 00:01:53.280
And we're going to use the
two-sided version of this

00:01:53.280 --> 00:01:56.470
because we're symmetric
around the center.

00:01:56.470 --> 00:01:59.700
So you look at the two-sided,
we want a 95% confidence

00:01:59.700 --> 00:02:03.260
interval, so we're going to
look right over here, 95%

00:02:03.260 --> 00:02:04.340
confidence interval.

00:02:04.340 --> 00:02:07.190
We have 10 data points,
which means we have

00:02:07.190 --> 00:02:09.570
9 degrees of freedom.

00:02:09.570 --> 00:02:12.330
So 9 degrees of freedom for
our 10 data points.

00:02:12.330 --> 00:02:13.980
We just took 10 minus 1.

00:02:13.980 --> 00:02:19.220
So if we look over here, so for
a T-distribution with 9

00:02:19.220 --> 00:02:22.950
degrees of freedom, you're
going to have 95% of the

00:02:22.950 --> 00:02:26.090
probability is going to be
contained within a T-value

00:02:26.090 --> 00:02:29.320
of-- so the T-value is going
to be between negative, so

00:02:29.320 --> 00:02:34.250
this value right here is 2.262,
and this value right

00:02:34.250 --> 00:02:37.620
here is negative 2.262.

00:02:37.620 --> 00:02:39.620
That's what this right
here tells us.

00:02:39.620 --> 00:02:42.960
That if you contain all the
values that are less than

00:02:42.960 --> 00:02:48.070
2.262 away from the center of
your T-distribution, you will

00:02:48.070 --> 00:02:52.160
contain 95% of the
probability.

00:02:52.160 --> 00:02:54.130
So that is our T-distribution
right there.

00:02:54.130 --> 00:02:55.010
Let me make it very clear.

00:02:55.010 --> 00:02:56.260
This is our T-distribution.

00:03:00.150 --> 00:03:04.280
So if you randomly pick
a T-value from this

00:03:04.280 --> 00:03:10.020
T-distribution, it has a 95%
chance of being within this

00:03:10.020 --> 00:03:10.930
far from the mean.

00:03:10.930 --> 00:03:12.100
Or maybe we should
write this way.

00:03:12.100 --> 00:03:17.290
If I pick a random T-value, if
I take a random T-statistic--

00:03:17.290 --> 00:03:23.970
let me write it this way--
there's a 95% chance that a

00:03:23.970 --> 00:03:33.430
random T-statistic is going
to be less than 2.262, and

00:03:33.430 --> 00:03:40.210
greater than negative 2.262.

00:03:40.210 --> 00:03:43.850
95% percent chance.

00:03:43.850 --> 00:03:49.420
Now when we took this sample, we
could also derive a random

00:03:49.420 --> 00:03:50.960
T-statistic from this.

00:03:50.960 --> 00:03:54.130
We have our sample mean and our
sample standard deviation,

00:03:54.130 --> 00:03:57.690
our sample mean here is

00:03:57.690 --> 00:04:01.060
17.17-- figured that out in the
last video, just add these

00:04:01.060 --> 00:04:03.640
up, divide by 10-- and
our sample standard

00:04:03.640 --> 00:04:07.950
deviation here is 2.98.

00:04:07.950 --> 00:04:11.300
So the T-statistic that we can
derive from this information

00:04:11.300 --> 00:04:13.080
right over here-- so let me
write it over here-- the

00:04:13.080 --> 00:04:15.870
T-statistic that we could derive
from this, and you can

00:04:15.870 --> 00:04:18.790
view this T-statistic as being
a random sample from a

00:04:18.790 --> 00:04:20.769
T-distribution.

00:04:20.769 --> 00:04:23.000
A T-distribution with 9
degrees of freedom.

00:04:23.000 --> 00:04:26.430
So the T-statistic that we
could derive from that is

00:04:26.430 --> 00:04:34.810
going to be our mean, 17.17
minus the true mean of our

00:04:34.810 --> 00:04:35.780
population.

00:04:35.780 --> 00:04:39.190
Or actually you would say the
true mean of our sampling

00:04:39.190 --> 00:04:41.640
distribution, which is also
going to be the same as the

00:04:41.640 --> 00:04:45.190
true mean of our population,
because that's our population

00:04:45.190 --> 00:04:52.080
mean over there, divided by s,
which is 2.98 over the square

00:04:52.080 --> 00:04:54.790
root of our number of samples.

00:04:54.790 --> 00:04:56.140
We've seen this multiple
times.

00:04:56.140 --> 00:04:58.520
This right here is
the T-statistic.

00:04:58.520 --> 00:05:01.820
So by taking this sample you
can say that we've randomly

00:05:01.820 --> 00:05:05.070
sampled a T-statistic from
this 9 degree of freedom

00:05:05.070 --> 00:05:06.200
T-distribution.

00:05:06.200 --> 00:05:11.130
So there's a 95% chance that
this thing right over here is

00:05:11.130 --> 00:05:17.420
going to be between-- is going
to be less than 2.262 and

00:05:17.420 --> 00:05:20.920
greater than negative 2.262.

00:05:20.920 --> 00:05:30.450
So the 95% probability still
applies to this right here.

00:05:30.450 --> 00:05:33.840
Now we just have to do some
math, calculate these things.

00:05:33.840 --> 00:05:36.300
So let me get my
calculator out.

00:05:39.690 --> 00:05:41.470
And so let me just
calculate this

00:05:41.470 --> 00:05:42.680
denominator right over here.

00:05:42.680 --> 00:05:50.130
So we have 2.98 divided by
the square root of 10.

00:05:50.130 --> 00:05:55.160
So that's 0.9423.

00:05:55.160 --> 00:05:58.100
So what I'm going to do is I'm
going to multiply both sides

00:05:58.100 --> 00:06:01.230
of this equation by this
expression right over here.

00:06:01.230 --> 00:06:05.940
So if I do that-- so let me just
do that right over-- so

00:06:05.940 --> 00:06:08.820
if I multiply this entire-- this
is really two equations

00:06:08.820 --> 00:06:11.100
or two inequalities
I should say.

00:06:11.100 --> 00:06:13.130
That this quantity is greater
than this quantity and that

00:06:13.130 --> 00:06:14.750
this quantity's greater
than that quantity.

00:06:14.750 --> 00:06:17.050
But we can operate on all of
them at the same time, this

00:06:17.050 --> 00:06:18.730
entire inequality.

00:06:18.730 --> 00:06:20.400
So what we want to do is
multiply this entire

00:06:20.400 --> 00:06:24.710
inequality by this value
right over here.

00:06:24.710 --> 00:06:27.410
And we just calculated it at
that value-- let me write it

00:06:27.410 --> 00:06:31.010
over here-- that 2.98-- I'll
write it right over here--

00:06:31.010 --> 00:06:39.500
2.98 over the square root
of 10 is equal to 0.942.

00:06:39.500 --> 00:06:45.010
So if I multiplied this entire
inequality by 0.942 I get, on

00:06:45.010 --> 00:06:53.490
this left-hand side over here
I have negative 2.262 times

00:06:53.490 --> 00:06:58.160
0.942-- and it's a positive
number that we're multiplying

00:06:58.160 --> 00:07:00.510
the whole inequality by, so the
inequality signs are still

00:07:00.510 --> 00:07:03.770
going to be in the same
direction-- is less than--

00:07:03.770 --> 00:07:07.990
we're multiplying this whole
expression by the same

00:07:07.990 --> 00:07:10.780
expression in the denominator
so it'll cancel out.

00:07:10.780 --> 00:07:16.090
So we're just going to be less
than 17.17 minus our

00:07:16.090 --> 00:07:22.610
population mean, which is going
to be less than 2.262

00:07:22.610 --> 00:07:27.740
times, once again, 0.942.

00:07:27.740 --> 00:07:30.190
Let me scroll over to the
right a little bit.

00:07:30.190 --> 00:07:33.170
0.942.

00:07:33.170 --> 00:07:37.260
Just be clear, I'm just
multiplying all three sides of

00:07:37.260 --> 00:07:40.160
this inequality by this number
right over here.

00:07:40.160 --> 00:07:41.650
In the middle this
cancels out.

00:07:41.650 --> 00:07:45.940
So if I multiply-- I'll just
write it over here-- 0.942,

00:07:45.940 --> 00:07:51.010
0.942, 0.942.

00:07:51.010 --> 00:07:53.740
This and this is the same number
so that's why those

00:07:53.740 --> 00:07:54.530
cancel out.

00:07:54.530 --> 00:07:56.180
And now let's get the calculator
to figure out what

00:07:56.180 --> 00:07:57.930
these numbers are.

00:07:57.930 --> 00:08:02.560
So if we have the 0.942
times 2.262.

00:08:02.560 --> 00:08:10.080
So we're going to say
times 2.262 is 2.13.

00:08:10.080 --> 00:08:14.800
So this number right
over here on the

00:08:14.800 --> 00:08:21.100
right-hand side is 2.13.

00:08:21.100 --> 00:08:23.130
This number on the left is just
the negative of that.

00:08:23.130 --> 00:08:27.610
So it's negative 2.13.

00:08:27.610 --> 00:08:31.320
And then we still have our
inequalities-- is going to be

00:08:31.320 --> 00:08:39.090
less than 17.17 minus the mean,
which is less than 2.13.

00:08:39.090 --> 00:08:40.549
Now what I want to do is
I actually want to

00:08:40.549 --> 00:08:42.520
solve for this mean.

00:08:42.520 --> 00:08:44.070
And I don't like that negative
sign in the mean.

00:08:44.070 --> 00:08:45.580
I'd rather have this
swapped around.

00:08:45.580 --> 00:08:48.810
I'd rather have the
mean minus 17.17.

00:08:48.810 --> 00:08:50.660
So what I'm going to do is
multiply this entire

00:08:50.660 --> 00:08:52.880
inequality by negative 1.

00:08:52.880 --> 00:08:55.910
If you do that, if you multiply
the entire thing

00:08:55.910 --> 00:08:58.620
times negative 1, this quantity
right here, this

00:08:58.620 --> 00:09:02.550
negative 2.13 will become
a positive 2.13.

00:09:02.550 --> 00:09:05.940
But since we are multiplying
an inequality by a negative

00:09:05.940 --> 00:09:08.080
number you have to swap
the inequality sign.

00:09:08.080 --> 00:09:10.660
So this less than will become
a greater than.

00:09:10.660 --> 00:09:14.970
This negative mu will become
a positive mu.

00:09:14.970 --> 00:09:20.300
This positive 17.17 will become
a negative 17.17.

00:09:20.300 --> 00:09:22.890
We're going to have to swap this
inequality sign as well,

00:09:22.890 --> 00:09:28.010
and this positive 2.13 will
become a negative 2.13.

00:09:28.010 --> 00:09:28.640
And we're almost there.

00:09:28.640 --> 00:09:31.120
We just want to solve for mu.

00:09:31.120 --> 00:09:33.580
Have this inequality expressed
in terms of mu.

00:09:33.580 --> 00:09:37.370
So what we can do is now just
add 17.17 to all three sides

00:09:37.370 --> 00:09:44.990
of this inequality, and we are
left with 2.13 plus 17.17 is

00:09:44.990 --> 00:09:49.810
greater than mu minus 17.17 plus
17.17 is just going to be

00:09:49.810 --> 00:09:54.090
mu, which is greater than-- so
this is greater than mu, which

00:09:54.090 --> 00:10:00.950
is greater than negative
2.13 plus 17.17.

00:10:00.950 --> 00:10:03.910
Or a more natural way to write
it since we actually have a

00:10:03.910 --> 00:10:05.830
bunch of greater than signs,
that this is actually the

00:10:05.830 --> 00:10:08.780
largest number and this-- oh
sorry, this is actually the

00:10:08.780 --> 00:10:12.140
smallest number and this over
here is actually the largest

00:10:12.140 --> 00:10:14.520
number, is actually flipped--
you can just re-write this

00:10:14.520 --> 00:10:15.970
inequality the other way.

00:10:15.970 --> 00:10:19.860
So now we can write-- actually
let's just figure out what

00:10:19.860 --> 00:10:20.740
these values are.

00:10:20.740 --> 00:10:27.900
So we have 2.13 plus 17.17.

00:10:27.900 --> 00:10:32.010
So that is the high
end of our range.

00:10:32.010 --> 00:10:34.280
So that is 19.3.

00:10:34.280 --> 00:10:40.392
So this value right over here,
so this is 19-- let me do it

00:10:40.392 --> 00:10:46.210
in that same color-- this value
right here is 19.3 is

00:10:46.210 --> 00:10:51.010
going to be greater than mu,
which is going to be greater

00:10:51.010 --> 00:10:54.910
than-- and this is negative
2.13 plus 17.17.

00:10:54.910 --> 00:11:08.460
Or we could have 17.17 minus
2.13, which gives us 15.04.

00:11:08.460 --> 00:11:11.810
And remember, the whole thing,
all of this, we started with,

00:11:11.810 --> 00:11:16.530
there was a 95% chance that a
random T-statistic will fall

00:11:16.530 --> 00:11:18.720
in this interval.

00:11:18.720 --> 00:11:21.160
We had a random T-statistic,
and all we did

00:11:21.160 --> 00:11:22.060
is a bunch of math.

00:11:22.060 --> 00:11:26.160
So there's a 95% chance that any
of these steps are true.

00:11:26.160 --> 00:11:29.830
So there's a 95% chance
that this is true.

00:11:29.830 --> 00:11:33.990
There's a 95% chance that the
true population mean, which is

00:11:33.990 --> 00:11:36.850
the same thing as the mean of
the sampling distribution of

00:11:36.850 --> 00:11:40.180
the sample mean, there's a 95%
chance, or that we are

00:11:40.180 --> 00:11:43.780
confident that there's a 95%
chance, that it will fall in

00:11:43.780 --> 00:11:44.750
this interval.

00:11:44.750 --> 00:11:46.280
And we're done.


Small sample hypothesis test

WEBVTT
Kind: captions
Language: en

00:00:00.670 --> 00:00:03.230
The mean emission of all engines
of a new design needs

00:00:03.230 --> 00:00:05.570
to be below 20 parts per million
if the design is to

00:00:05.570 --> 00:00:07.280
meet new emission
requirements.

00:00:07.280 --> 00:00:10.020
10 engines are manufactured for
testing purposes, and the

00:00:10.020 --> 00:00:11.910
emission level of each
is determined.

00:00:11.910 --> 00:00:14.410
The emission data is, and they
give us 10 data points for the

00:00:14.410 --> 00:00:17.450
10 test engines, and I went
ahead and calculated the mean

00:00:17.450 --> 00:00:18.410
of these data points.

00:00:18.410 --> 00:00:20.940
The sample mean of 17.17.

00:00:20.940 --> 00:00:23.740
And the standard deviation of
these 10 data points right

00:00:23.740 --> 00:00:27.480
here is 2.98, the sample
standard deviation.

00:00:27.480 --> 00:00:29.420
Does the data supply sufficient
evidence to

00:00:29.420 --> 00:00:32.520
conclude that this type of
engine meets the new standard?

00:00:32.520 --> 00:00:37.700
Assume we are willing to risk
a type-1 error with a

00:00:37.700 --> 00:00:39.760
probability of 0.01.

00:00:39.760 --> 00:00:41.570
And we'll touch on
this in a second.

00:00:41.570 --> 00:00:43.920
Before we do that, let's just
define what our null

00:00:43.920 --> 00:00:47.440
hypothesis and our alternative
hypothesis are going to be.

00:00:47.440 --> 00:00:51.780
Our null hypothesis
can be that we

00:00:51.780 --> 00:00:52.690
don't meet the standards.

00:00:52.690 --> 00:00:54.500
That we just barely don't
meet the standards.

00:00:54.500 --> 00:00:59.420
That the mean of our new engines
is exactly 20 parts

00:00:59.420 --> 00:01:00.140
per million.

00:01:00.140 --> 00:01:02.740
And you essentially want the
best possible value where we

00:01:02.740 --> 00:01:05.239
still don't meet, or the lowest
possible value, where

00:01:05.239 --> 00:01:08.380
we still don't meet
the standard.

00:01:08.380 --> 00:01:13.160
And then our alternative
hypothesis says no, we do meet

00:01:13.160 --> 00:01:13.710
the standard.

00:01:13.710 --> 00:01:17.230
That the true mean for our
new engines is below

00:01:17.230 --> 00:01:19.270
20 parts per million.

00:01:19.270 --> 00:01:22.910
And to see if the data that we
have is sufficient, what we're

00:01:22.910 --> 00:01:26.400
going to do is assume,
we're going to assume

00:01:26.400 --> 00:01:27.650
that this is true.

00:01:32.730 --> 00:01:36.440
And given that this is true, if
we assume this is true, and

00:01:36.440 --> 00:01:39.660
the probability of this
occurring, and the probability

00:01:39.660 --> 00:01:44.750
of getting a sample mean of that
is less than 1%, then we

00:01:44.750 --> 00:01:47.810
will reject the null
hypothesis.

00:01:47.810 --> 00:01:56.170
So we are going to reject our
null hypothesis if the

00:01:56.170 --> 00:02:00.870
probability of getting a sample
mean of 17.17 given the

00:02:00.870 --> 00:02:06.340
null hypothesis is true,
is less than 1%.

00:02:06.340 --> 00:02:09.130
And notice, if we do it this way
there will be less than a

00:02:09.130 --> 00:02:12.680
1% chance that we are making
a type-1 error.

00:02:12.680 --> 00:02:14.400
A type-1 error is that
we're rejecting it

00:02:14.400 --> 00:02:15.390
even though it's true.

00:02:15.390 --> 00:02:19.550
Here there's only a 1% chance,
or less than a 1% chance that

00:02:19.550 --> 00:02:22.040
we will reject it
if it is true.

00:02:22.040 --> 00:02:24.870
Now the next thing we have to
think about is what type of

00:02:24.870 --> 00:02:26.760
distribution we should
think about.

00:02:26.760 --> 00:02:31.420
And I guess the first thing that
rings in my brain is we

00:02:31.420 --> 00:02:33.040
only have 10 samples here.

00:02:33.040 --> 00:02:34.630
We only have 10 samples.

00:02:34.630 --> 00:02:37.320
We have a small sample
size right over here.

00:02:37.320 --> 00:02:39.760
So we're going to be dealing
with a T-distribution and

00:02:39.760 --> 00:02:41.680
T-statistic.

00:02:41.680 --> 00:02:44.860
So with that said, so let's
think of it this way.

00:02:44.860 --> 00:02:48.240
We can come up with a
T-statistic that is based on

00:02:48.240 --> 00:02:49.680
these statistics right
over here.

00:02:49.680 --> 00:02:55.660
So the T-statistic is going to
be 17.17, our sample mean,

00:02:55.660 --> 00:02:59.920
minus the assumed population
mean-- minus 20 parts per

00:02:59.920 --> 00:03:10.880
million over our sample standard
deviation, 2.98--

00:03:10.880 --> 00:03:12.890
this is really the definition
of the T-statistic.

00:03:12.890 --> 00:03:15.310
And hopefully we see now that
this really comes from a

00:03:15.310 --> 00:03:18.360
Z-score and the T-distribution
is kind of an engineered

00:03:18.360 --> 00:03:20.340
version of the normal
distribution using

00:03:20.340 --> 00:03:21.610
T-statistics.

00:03:21.610 --> 00:03:25.700
2.98 divided by the square
root of our sample size.

00:03:25.700 --> 00:03:27.940
We have 10 samples, so
it's divided by the

00:03:27.940 --> 00:03:30.630
square root of 10.

00:03:30.630 --> 00:03:33.550
So this value right here-- let
me get the calculator out just

00:03:33.550 --> 00:03:35.110
to get a value in place there.

00:03:38.530 --> 00:03:46.800
So this is going to be 17.17
minus 20, close parentheses,

00:03:46.800 --> 00:03:55.120
divided by 2.98 divided
by the square root--

00:03:55.120 --> 00:03:57.320
that's not what I wanted.

00:03:57.320 --> 00:03:58.120
Let me delete that.

00:03:58.120 --> 00:03:58.820
Let me go back.

00:03:58.820 --> 00:04:03.560
Divided by the square root
of 10, and then close

00:04:03.560 --> 00:04:04.810
parentheses.

00:04:06.820 --> 00:04:09.970
It is almost exactly
negative 3.

00:04:09.970 --> 00:04:13.620
Our T-statistic is
almost exactly

00:04:13.620 --> 00:04:17.360
negative 3, negative 3.00.

00:04:17.360 --> 00:04:20.769
And what we need to figure out,
because T-statistics have

00:04:20.769 --> 00:04:23.640
a T-distribution, so what we
need to figure out is the

00:04:23.640 --> 00:04:29.260
probability of getting this
T-statistic or a value of T

00:04:29.260 --> 00:04:33.570
equal to this or less than this,
is that less than 1%?

00:04:33.570 --> 00:04:35.440
So the way we can think
about it is we have a

00:04:35.440 --> 00:04:36.690
T-distribution.

00:04:38.980 --> 00:04:42.320
And let's say we have a
normalized T-distribution.

00:04:42.320 --> 00:04:45.550
The distribution of all the
T-statistics would be a

00:04:45.550 --> 00:04:47.570
normalized T-distribution.

00:04:47.570 --> 00:04:49.800
This is the mean of the
T-distribution.

00:04:49.800 --> 00:04:57.510
There's going to be some
threshold T-value right here.

00:04:57.510 --> 00:04:58.970
So this is our threshold
T-value.

00:05:03.820 --> 00:05:07.290
My writing isn't that
easy to view.

00:05:07.290 --> 00:05:10.680
This is some threshold T-value
right over here.

00:05:10.680 --> 00:05:14.520
And we want a threshold T-value
such that any T-value

00:05:14.520 --> 00:05:17.070
less than that, or the
probability of getting a

00:05:17.070 --> 00:05:18.850
T-value less than that is 1%.

00:05:24.150 --> 00:05:27.110
So that entire area
in yellow is 1%.

00:05:27.110 --> 00:05:29.250
And we need to figure out a
threshold T-value there.

00:05:29.250 --> 00:05:35.620
And this is for a T-distribution
that has n

00:05:35.620 --> 00:05:41.300
equal to 10 or 10 minus 1 equals
9 degrees of freedom.

00:05:43.960 --> 00:05:46.380
So what is that threshold
value over there?

00:05:46.380 --> 00:05:49.360
And notice that this is a
one-sided distribution.

00:05:49.360 --> 00:05:53.020
We care about this is 1% and
then all of this stuff over

00:05:53.020 --> 00:05:57.450
here is going to be 99%.

00:05:57.450 --> 00:06:00.550
And just the way most T-tables
are set up, they don't set up

00:06:00.550 --> 00:06:03.620
a negative T-value that is
oriented like this, they'll

00:06:03.620 --> 00:06:05.220
just give you a positive
T-value that's

00:06:05.220 --> 00:06:06.800
oriented the other way.

00:06:06.800 --> 00:06:08.710
So the way T-tables-- and I have
one that we're going to

00:06:08.710 --> 00:06:11.840
use in a second right over
here-- the way T-tables are

00:06:11.840 --> 00:06:15.370
set up is you have your
distribution like this, and

00:06:15.370 --> 00:06:22.110
they will just give a positive
T-value over here, some

00:06:22.110 --> 00:06:23.610
threshold value.

00:06:23.610 --> 00:06:27.000
Where the probability of getting
a T-value above that

00:06:27.000 --> 00:06:29.770
is going to be 1%, and the
probability of getting a

00:06:29.770 --> 00:06:37.280
t-value below that is
going to be 99%.

00:06:37.280 --> 00:06:41.700
And you can see that-- well,
we know T-distributions are

00:06:41.700 --> 00:06:45.530
symmetric around their mean, so
whatever value this is, if

00:06:45.530 --> 00:06:48.550
this number is 2 then this
value's just going to be

00:06:48.550 --> 00:06:49.400
negative 2.

00:06:49.400 --> 00:06:50.730
So we just have to keep
that in mind.

00:06:50.730 --> 00:06:53.940
But the T-tables actually help
us figure out this value.

00:06:53.940 --> 00:06:56.730
So let's figure out a T-value
where the probability of

00:06:56.730 --> 00:07:00.420
getting a T-value below
that is 99%.

00:07:00.420 --> 00:07:09.540
And once again, this is going
to be a one-sided situation.

00:07:09.540 --> 00:07:10.680
So let's look at
that over here.

00:07:10.680 --> 00:07:13.760
So one-sided-- this is just
straight from Wikipedia--

00:07:13.760 --> 00:07:16.200
one-sided, we want the
cumulative distribution below

00:07:16.200 --> 00:07:18.770
that T-value to be 99%.

00:07:18.770 --> 00:07:20.940
We have it right
over here, 99%.

00:07:20.940 --> 00:07:22.550
We have 9 degrees of freedom.

00:07:22.550 --> 00:07:25.440
We have 10 data points,
10 minus 1 is 9.

00:07:25.440 --> 00:07:27.630
9 degrees of freedom.

00:07:27.630 --> 00:07:33.620
So our threshold T-value here
is 2.821, so our threshold

00:07:33.620 --> 00:07:36.250
T-value in the case that we care
about is just flip this

00:07:36.250 --> 00:07:41.010
over, it's completely symmetric
is negative 2.821.

00:07:41.010 --> 00:07:44.950
So what this tells us is the
probability of getting a

00:07:44.950 --> 00:07:53.970
T-value less than the negative
2.821 is going to be 1%.

00:07:53.970 --> 00:07:57.310
Now we got a value that's
a good bit less that we.

00:07:57.310 --> 00:08:01.540
Got a T-value of negative 3.

00:08:01.540 --> 00:08:06.410
We got a T-value right here, our
T-statistic of negative 3

00:08:06.410 --> 00:08:07.480
right over here.

00:08:07.480 --> 00:08:11.820
So that definitely goes into
our-- I guess you could call

00:08:11.820 --> 00:08:16.290
it our area of rejection.

00:08:16.290 --> 00:08:19.340
This is even less probable
than the 1%.

00:08:19.340 --> 00:08:23.720
We could even figure it out that
the area over here, the

00:08:23.720 --> 00:08:26.680
probability of getting a
T-statistic less than negative

00:08:26.680 --> 00:08:30.260
3 is even less than, it's a
subset of this yellow area

00:08:30.260 --> 00:08:31.370
right over here.

00:08:31.370 --> 00:08:36.070
So because the probability of
getting the T-statistic that

00:08:36.070 --> 00:08:43.890
we actually got is less than 1%,
we can safely reject the

00:08:43.890 --> 00:08:51.250
null hypothesis and feel
pretty good about our

00:08:51.250 --> 00:08:54.570
alternate hypothesis right over
here, that we do meet the

00:08:54.570 --> 00:08:55.550
emission standards.

00:08:55.550 --> 00:08:59.550
And we know that we have a
lower than 1% chance of

00:08:59.550 --> 00:09:03.210
actually making a type-1 error
in this circumstance.


Type 1 errors

WEBVTT
Kind: captions
Language: en

00:00:00.610 --> 00:00:02.880
I want to do a quick video on
something that you're likely

00:00:02.880 --> 00:00:04.960
to see in a statistics class,
and that's the notion of a

00:00:04.960 --> 00:00:06.210
Type 1 Error.

00:00:11.270 --> 00:00:15.280
And all this error means is that
you've rejected-- this is

00:00:15.280 --> 00:00:17.310
the error of rejecting-- let
me do this in a different

00:00:17.310 --> 00:00:25.300
color-- rejecting the
null hypothesis even

00:00:25.300 --> 00:00:26.550
though it is true.

00:00:32.700 --> 00:00:36.890
So for example, in actually all
of the hypothesis testing

00:00:36.890 --> 00:00:39.390
examples we've seen, we start
assuming that the null

00:00:39.390 --> 00:00:40.980
hypothesis is true.

00:00:40.980 --> 00:00:46.960
We always assume that the
null hypothesis is true.

00:00:46.960 --> 00:00:50.150
And given that the null
hypothesis is true, we say OK,

00:00:50.150 --> 00:00:52.670
if the null hypothesis is true
then the mean is usually going

00:00:52.670 --> 00:00:54.710
to be equal to some value.

00:00:54.710 --> 00:00:56.620
So we create some
distribution.

00:00:56.620 --> 00:00:59.310
Assuming that the null
hypothesis is true, it

00:00:59.310 --> 00:01:03.060
normally has some mean value
right over there.

00:01:03.060 --> 00:01:10.160
Then we have some statistic and
we're seeing if the null

00:01:10.160 --> 00:01:13.260
hypothesis is true, what is
the probability of getting

00:01:13.260 --> 00:01:17.070
that statistic, or getting a
result that extreme or more

00:01:17.070 --> 00:01:19.230
extreme then that statistic.

00:01:19.230 --> 00:01:22.220
So let's say that the statistic
gives us some value

00:01:22.220 --> 00:01:26.530
over here, and we say gee, you
know what, there's only, I

00:01:26.530 --> 00:01:30.620
don't know, there might be a 1%
chance, there's only a 1%

00:01:30.620 --> 00:01:35.410
probability of getting a result

00:01:35.410 --> 00:01:38.570
that extreme or greater.

00:01:38.570 --> 00:01:43.220
And then if that's low enough of
a threshold for us, we will

00:01:43.220 --> 00:01:47.440
reject the null hypothesis.

00:01:47.440 --> 00:01:52.150
So in this case we will--
so actually let's

00:01:52.150 --> 00:01:52.720
think of it this way.

00:01:52.720 --> 00:01:54.680
Let's say that 1% is
our threshold.

00:01:54.680 --> 00:01:56.820
We say look, we're going
to assume that the null

00:01:56.820 --> 00:01:58.660
hypothesis is true.

00:01:58.660 --> 00:02:02.700
There's some threshold that
if we get a value any more

00:02:02.700 --> 00:02:06.860
extreme than that value, there's
less than a 1% chance

00:02:06.860 --> 00:02:07.670
of that happening.

00:02:07.670 --> 00:02:09.680
So let's say we're looking
at sample means.

00:02:09.680 --> 00:02:11.920
We get a sample mean that
is way out here.

00:02:11.920 --> 00:02:14.260
We say, well, there's less
than a 1% chance of that

00:02:14.260 --> 00:02:19.900
happening given that the null
hypothesis is true.

00:02:19.900 --> 00:02:23.020
So we are going to reject
the null hypothesis.

00:02:23.020 --> 00:02:26.620
So we will reject the
null hypothesis.

00:02:26.620 --> 00:02:28.510
Now what does that
mean though?

00:02:28.510 --> 00:02:30.540
Let's say that this area, the
probability of getting a

00:02:30.540 --> 00:02:34.580
result like that or that much
more extreme is just this area

00:02:34.580 --> 00:02:35.100
right here.

00:02:35.100 --> 00:02:39.250
So let's say that's 0.5%, or
maybe I can write it this way.

00:02:39.250 --> 00:02:40.920
Let's say it's 0.5%.

00:02:40.920 --> 00:02:45.950
And because it's so unlikely to
get a statistic like that

00:02:45.950 --> 00:02:48.280
assuming that the null
hypothesis is true, we decide

00:02:48.280 --> 00:02:50.260
to reject the null hypothesis.

00:02:50.260 --> 00:02:54.890
Or another way to view it is
there's a 0.5% chance that we

00:02:54.890 --> 00:02:59.470
have made a Type 1 Error in
rejecting the null hypothesis.

00:02:59.470 --> 00:03:04.150
Because if the null hypothesis
is true there's a 0.5% chance

00:03:04.150 --> 00:03:07.240
that this could still happen.

00:03:07.240 --> 00:03:09.500
So in rejecting it we would
make a mistake.

00:03:09.500 --> 00:03:12.460
There's a 0.5% chance we've
made a Type 1 Error.

00:03:12.460 --> 00:03:13.700
I just want to clear that up.

00:03:13.700 --> 00:03:15.130
Hopefully that clarified
it for you.

00:03:15.130 --> 00:03:16.920
It's sometimes a little
bit confusing.

00:03:16.920 --> 00:03:19.010
But we're going to use what we
learned in this video and the

00:03:19.010 --> 00:03:22.980
previous video to now tackle
an actual example.


One-tailed and two-tailed tests

WEBVTT
Kind: captions
Language: en

00:00:00.630 --> 00:00:03.810
In the last video, our
null hypothesis was

00:00:03.810 --> 00:00:04.920
the drug had no effect.

00:00:04.920 --> 00:00:07.100
And our alternative hypothesis
was that the

00:00:07.100 --> 00:00:09.300
drug just has an effect.

00:00:09.300 --> 00:00:12.990
We didn't say whether the drug
would lower the response time

00:00:12.990 --> 00:00:15.090
or raise the response time.

00:00:15.090 --> 00:00:19.320
We just said the drug had an
effect, that the mean when you

00:00:19.320 --> 00:00:22.290
have the drug will not
be the same thing as

00:00:22.290 --> 00:00:23.440
the population mean.

00:00:23.440 --> 00:00:25.580
And then the null hypothesis
says no, your mean with the

00:00:25.580 --> 00:00:27.517
drug's going to be the same
thing as the population mean,

00:00:27.517 --> 00:00:28.910
it has no effect.

00:00:28.910 --> 00:00:31.420
In this situation where we're
really just testing to see if

00:00:31.420 --> 00:00:35.750
it had an effect, whether an
extreme positive effect, or an

00:00:35.750 --> 00:00:39.380
extreme negative effect,
would have both been

00:00:39.380 --> 00:00:40.620
considered an effect.

00:00:40.620 --> 00:00:44.170
We did something called a
two-tailed test. This is

00:00:44.170 --> 00:00:52.950
called eight two-tailed test.
Because frankly, a super high

00:00:52.950 --> 00:00:55.700
response time, if you had a
response time that was more

00:00:55.700 --> 00:00:58.510
than 3 standard deviations,
that would've also made us

00:00:58.510 --> 00:01:01.410
likely to reject the
null hypothesis.

00:01:01.410 --> 00:01:04.010
So we were dealing with
kind of both tails.

00:01:04.010 --> 00:01:07.330
You could have done a similar
type of hypothesis test with

00:01:07.330 --> 00:01:10.590
the same experiment where you
only had a one-tailed test.

00:01:10.590 --> 00:01:13.110
And the way we could have done
that is we still could have

00:01:13.110 --> 00:01:20.075
had the null hypothesis be that
the drug has no effect.

00:01:25.560 --> 00:01:28.670
Or that the mean with the drug--
the mean, and maybe I

00:01:28.670 --> 00:01:32.320
could say the mean with the
drug-- is still going to be

00:01:32.320 --> 00:01:35.520
1.2 seconds, our mean
response time.

00:01:35.520 --> 00:01:38.030
Now if we wanted to do a
one-tailed test, but for some

00:01:38.030 --> 00:01:42.060
reason we already had maybe a
view that this drug would

00:01:42.060 --> 00:01:46.050
lower response times, then our
alternative hypothesis-- and

00:01:46.050 --> 00:01:48.220
just so you get familiar with
different types of notation,

00:01:48.220 --> 00:01:50.390
some books or teachers will
write the alternative

00:01:50.390 --> 00:01:54.170
hypothesis as H1, sometimes
they write it as H

00:01:54.170 --> 00:01:57.320
alternative, either
one is fine.

00:01:57.320 --> 00:02:00.090
If you want to do one-tailed
test, you could say that the

00:02:00.090 --> 00:02:08.509
drug lowers response time.

00:02:11.070 --> 00:02:18.340
Or that the mean with the drug
is less than 1.2 seconds.

00:02:18.340 --> 00:02:22.790
Now if you do a one-tailed test
like this, what we're

00:02:22.790 --> 00:02:27.040
thinking about is, what we want
to look at is, all right,

00:02:27.040 --> 00:02:29.290
we have our sampling
distribution.

00:02:29.290 --> 00:02:31.960
Actually, I can just use the
drawing that I had up here.

00:02:31.960 --> 00:02:34.250
You had your sampling
distribution

00:02:34.250 --> 00:02:35.610
of the sample mean.

00:02:35.610 --> 00:02:39.360
We know what the mean of that
was, it's 1.2 seconds, same as

00:02:39.360 --> 00:02:40.500
the population mean.

00:02:40.500 --> 00:02:44.060
We were able to estimate its
standard deviation using our

00:02:44.060 --> 00:02:47.260
sample standard deviation, and
that was reasonable because it

00:02:47.260 --> 00:02:50.250
had a sample size of greater
than 30, so we can still kind

00:02:50.250 --> 00:02:52.530
of deal with a normal
distribution for the sampling

00:02:52.530 --> 00:02:53.540
distribution.

00:02:53.540 --> 00:02:58.250
And using that we saw that the
result, the sample mean that

00:02:58.250 --> 00:03:02.960
we got, the 1.05 seconds,
is 3 standard

00:03:02.960 --> 00:03:05.025
deviations below the mean.

00:03:08.340 --> 00:03:10.780
So if we look at it-- let me
just re-draw it with our new

00:03:10.780 --> 00:03:14.490
hypothesis test. So this is
the sampling distribution.

00:03:18.110 --> 00:03:22.920
It has a mean right over
here at 1.2 seconds.

00:03:22.920 --> 00:03:25.890
And the result we got
was 3 standard

00:03:25.890 --> 00:03:27.810
deviations below the mean.

00:03:30.770 --> 00:03:34.480
1, 2, 3 standard deviations
below the mean.

00:03:34.480 --> 00:03:37.910
That was what our 1.05
seconds were.

00:03:37.910 --> 00:03:39.870
So when you set it up like this
where you're not just

00:03:39.870 --> 00:03:42.890
saying that the drug has an
effect-- in that case, and

00:03:42.890 --> 00:03:44.460
that was the last view, you'd
look at both tails.

00:03:44.460 --> 00:03:49.400
But here we're saying we only
care is does the drug lower

00:03:49.400 --> 00:03:50.740
our response time?

00:03:50.740 --> 00:03:53.590
And just like we did before, you
say OK, let's say the drug

00:03:53.590 --> 00:03:55.040
doesn't lower our
response time.

00:03:55.040 --> 00:03:58.170
If the drug doesn't lower our
response time, what was the

00:03:58.170 --> 00:04:01.730
probability or what is the
probability of getting a

00:04:01.730 --> 00:04:04.980
lowering this extreme
or more extreme?

00:04:04.980 --> 00:04:08.120
So here it will only be one
of the tails that we could

00:04:08.120 --> 00:04:11.810
consider when we set our
alternative hypothesis like

00:04:11.810 --> 00:04:14.320
that, that we think it lowers.

00:04:14.320 --> 00:04:22.410
So if our null hypothesis is
true, the probability of

00:04:22.410 --> 00:04:35.900
getting a result more extreme
than 1.05 seconds, now we are

00:04:35.900 --> 00:04:39.140
only considering this tail
right over here.

00:04:39.140 --> 00:04:40.050
Let me just put it this way.

00:04:40.050 --> 00:04:44.850
More extreme than 1.05 seconds,
or let me say, lower.

00:04:44.850 --> 00:04:47.030
Because in the last video we
cared about more extreme

00:04:47.030 --> 00:04:49.140
because even a really high
result would have said, OK,

00:04:49.140 --> 00:04:51.450
the mean's definitely
not 1.2 seconds.

00:04:51.450 --> 00:04:54.110
But in this case we care about
means that are lower.

00:04:54.110 --> 00:05:00.480
So now we care about the
probability of a result lower

00:05:00.480 --> 00:05:03.550
than 1.05 seconds.

00:05:03.550 --> 00:05:06.960
That's the same thing as
sampling-- of getting a sample

00:05:06.960 --> 00:05:10.270
from the sampling distribution
that's more than 3 standard

00:05:10.270 --> 00:05:12.270
deviations below the mean.

00:05:12.270 --> 00:05:15.610
And in this case, we're only
going to consider the area in

00:05:15.610 --> 00:05:16.790
this one tail.

00:05:16.790 --> 00:05:20.310
So this right here would be a
one-tailed test where we only

00:05:20.310 --> 00:05:23.290
care about one direction
below the mean.

00:05:23.290 --> 00:05:25.980
If you look at the one-tailed
test-- this area over here--

00:05:25.980 --> 00:05:30.680
we saw last time that both of
these areas combined are 0.3%.

00:05:30.680 --> 00:05:32.760
But if you're only considering
one of these areas, if you're

00:05:32.760 --> 00:05:34.680
only considering this one over
here it's going to be half of

00:05:34.680 --> 00:05:36.910
that, because the normal
distribution is symmetric.

00:05:36.910 --> 00:05:39.790
So it's going to the 0.13%.

00:05:39.790 --> 00:05:46.920
So this one right here is going
to be 0.15%, or if you

00:05:46.920 --> 00:05:55.440
express it as a decimal, this
is going to be 0.0015.

00:05:55.440 --> 00:05:59.733
So once again, if you set up
your hypotheses like this, you

00:05:59.733 --> 00:06:04.020
would have said, if your null
hypothesis is correct, there

00:06:04.020 --> 00:06:09.990
would have only been a 0.15%
chance of getting a result

00:06:09.990 --> 00:06:12.440
lower than the result we got.

00:06:12.440 --> 00:06:20.200
So that would be very unlikely,
so we will reject

00:06:20.200 --> 00:06:24.470
the null hypothesis and go
with the alternative.

00:06:24.470 --> 00:06:28.910
And in this situation
your P-value is

00:06:28.910 --> 00:06:31.850
going to be the 0.0015.


Hypothesis testing and p-values

WEBVTT
Kind: captions
Language: en

00:00:00.600 --> 00:00:03.880
A neurologist is testing the
effect of a drug on response

00:00:03.880 --> 00:00:08.690
time by injecting 100 rats with
a unit dose of the drug,

00:00:08.690 --> 00:00:11.570
subjecting each to neurological
stimulus and

00:00:11.570 --> 00:00:13.450
recording its response time.

00:00:13.450 --> 00:00:17.350
The neurologist knows that the
mean response time for rats

00:00:17.350 --> 00:00:21.810
not injected with the
drug is 1.2 seconds.

00:00:21.810 --> 00:00:27.030
The mean of the 100 injected
rats response times is 1.05

00:00:27.030 --> 00:00:28.800
seconds with the
sample standard

00:00:28.800 --> 00:00:31.470
deviation of 0.5 seconds.

00:00:31.470 --> 00:00:36.650
Do you think that the drug has
an affect on response time?

00:00:36.650 --> 00:00:40.130
So to do this we're going to
set up two hypotheses.

00:00:40.130 --> 00:00:44.660
We're going to say, one, the
first hypothesis is we're

00:00:44.660 --> 00:00:47.260
going to call it the null
hypothesis, and that is that

00:00:47.260 --> 00:00:50.400
the drug has no effect
on response time.

00:00:50.400 --> 00:00:52.740
And your null hypothesis is
always going to be-- you can

00:00:52.740 --> 00:00:53.820
view it as a status quo.

00:00:53.820 --> 00:00:57.570
You assume that whatever your
researching has no effect.

00:00:57.570 --> 00:00:58.975
So drug has no effect.

00:01:06.160 --> 00:01:11.390
Or another way to think about
it is that the mean of the

00:01:11.390 --> 00:01:19.130
rats taking the drug should be
the mean with the drug-- let

00:01:19.130 --> 00:01:24.930
me write it this way-- with the
mean is still going to be

00:01:24.930 --> 00:01:28.385
1.2 seconds even
with the drug.

00:01:32.010 --> 00:01:34.090
So that's essentially saying it
has no effect, because we

00:01:34.090 --> 00:01:36.410
know that if you don't give
the drug the mean response

00:01:36.410 --> 00:01:38.290
time is 1.2 seconds.

00:01:38.290 --> 00:01:40.940
Now, what you want is an
alternative hypothesis.

00:01:40.940 --> 00:01:43.010
The hypothesis is no,
I think the drug

00:01:43.010 --> 00:01:44.520
actually does do something.

00:01:44.520 --> 00:01:52.970
So the alternative hypothesis,
right over here, that the drug

00:01:52.970 --> 00:01:56.880
has an effect.

00:01:56.880 --> 00:02:01.340
Or another way to think about
it is that the mean does not

00:02:01.340 --> 00:02:10.280
equal 1.2 seconds when
the drug is given.

00:02:10.280 --> 00:02:11.500
So how do we think about this?

00:02:11.500 --> 00:02:16.660
How do we know whether we should
accept the alternative

00:02:16.660 --> 00:02:19.380
hypothesis or whether we should
just default to the

00:02:19.380 --> 00:02:22.680
null hypothesis because the
data isn't convincing?

00:02:22.680 --> 00:02:24.700
And the way we're going to do it
in this video, and this is

00:02:24.700 --> 00:02:27.875
really the way it's done in
pretty much all of science, is

00:02:27.875 --> 00:02:32.230
you say OK, let's assume that
the null hypothesis is true.

00:02:32.230 --> 00:02:37.110
If the null hypothesis was true,
what is the probability

00:02:37.110 --> 00:02:39.840
that we would have gotten these
results with the sample?

00:02:39.840 --> 00:02:43.190
And if that probability is
really, really small, then the

00:02:43.190 --> 00:02:45.920
null hypothesis probably
isn't true.

00:02:45.920 --> 00:02:48.710
We could probably reject the
null hypothesis and we'll say

00:02:48.710 --> 00:02:51.870
well, we kind of believe in the
alternative hypothesis.

00:02:51.870 --> 00:02:52.720
So let's think about that.

00:02:52.720 --> 00:03:00.720
Let's assume that the null
hypothesis is true.

00:03:00.720 --> 00:03:03.340
So if we assume the null
hypothesis is true, let's try

00:03:03.340 --> 00:03:05.240
to figure out the probability
that we would have actually

00:03:05.240 --> 00:03:07.950
gotten this result, that we
would have actually gotten a

00:03:07.950 --> 00:03:12.070
sample mean of 1.05 seconds with
a standard deviation of

00:03:12.070 --> 00:03:13.180
0.5 seconds.

00:03:13.180 --> 00:03:17.320
So I want to see if we assumed
the null hypothesis is true, I

00:03:17.320 --> 00:03:21.810
want to figure out the
probability-- and actually

00:03:21.810 --> 00:03:22.860
what we're going to do is
not just figure out the

00:03:22.860 --> 00:03:24.740
probability of this, the
probability of getting

00:03:24.740 --> 00:03:28.370
something like this or even
more extreme than this.

00:03:28.370 --> 00:03:30.780
So how likely of an
event is that?

00:03:30.780 --> 00:03:32.600
To think about that let's just
think about the sampling

00:03:32.600 --> 00:03:37.290
distribution if we assume
the null hypothesis.

00:03:37.290 --> 00:03:40.530
So the sampling distribution
is like this.

00:03:40.530 --> 00:03:44.050
It'll be a normal
distribution.

00:03:44.050 --> 00:03:45.960
We have a good number
of samples, we

00:03:45.960 --> 00:03:47.250
have 100 samples here.

00:03:47.250 --> 00:03:49.320
So this is the sampling
distribution.

00:03:49.320 --> 00:03:52.050
It will have a mean.

00:03:52.050 --> 00:03:55.400
Now if we assume the null
hypothesis, that the drug has

00:03:55.400 --> 00:04:01.830
no effect, the mean of our
sampling distribution will be

00:04:01.830 --> 00:04:04.660
the same thing as the meaning
of the population

00:04:04.660 --> 00:04:09.240
distribution, which would
be equal to 1.2 seconds.

00:04:09.240 --> 00:04:12.250
Now, what is the standard
deviation of our sampling

00:04:12.250 --> 00:04:13.490
distribution?

00:04:13.490 --> 00:04:16.990
The standard deviation of our
sampling distribution should

00:04:16.990 --> 00:04:20.240
be equal to the standard
deviation of the population

00:04:20.240 --> 00:04:24.060
distribution divided by the
square root of our sample

00:04:24.060 --> 00:04:26.820
size, so divided by the
square root of 100.

00:04:26.820 --> 00:04:29.450
We do not know what the standard
deviation of the

00:04:29.450 --> 00:04:31.020
entire population is.

00:04:31.020 --> 00:04:33.920
So what we're going to do is
estimate it with our sample

00:04:33.920 --> 00:04:35.070
standard deviation.

00:04:35.070 --> 00:04:37.670
And it's a reasonable thing to
do, especially because we have

00:04:37.670 --> 00:04:38.700
a nice sample size.

00:04:38.700 --> 00:04:40.820
The sample size is
greater than 100.

00:04:40.820 --> 00:04:44.200
So this is going to be a pretty
good approximator.

00:04:44.200 --> 00:04:46.370
This is going to be a pretty
good approximator

00:04:46.370 --> 00:04:48.120
for this over here.

00:04:48.120 --> 00:04:50.290
So we could say that this is
going to be approximately

00:04:50.290 --> 00:04:53.100
equal to our sample standard
deviation divided by the

00:04:53.100 --> 00:04:58.630
square root of 100, which is
going to be equal to our

00:04:58.630 --> 00:05:04.610
sample standard deviation is
0.5, 0.5 seconds, and we want

00:05:04.610 --> 00:05:07.800
to divide that by square
root of 100 is 10.

00:05:07.800 --> 00:05:12.960
So 0.5 divided by 10 is 0.05.

00:05:12.960 --> 00:05:17.870
So the standard deviation of our
sampling distribution is

00:05:17.870 --> 00:05:20.320
going to be-- and we'll put a
little hat over it to show

00:05:20.320 --> 00:05:23.640
that we approximated it with--
we approximated the population

00:05:23.640 --> 00:05:26.140
standard deviation with the
sample standard deviation.

00:05:26.140 --> 00:05:29.380
So it is going to be equal
to 0.5 divided by 10.

00:05:29.380 --> 00:05:32.560
So 0.05.

00:05:32.560 --> 00:05:34.780
So what is the probability--
so let's think

00:05:34.780 --> 00:05:36.060
about it this way.

00:05:36.060 --> 00:05:40.150
What is the probability of
getting 1.05 seconds?

00:05:40.150 --> 00:05:42.610
Or another way to think about
it is how many standard

00:05:42.610 --> 00:05:48.240
deviations away from this mean
is 1.05 seconds, and what is

00:05:48.240 --> 00:05:51.480
the probability of getting a
result at least that many

00:05:51.480 --> 00:05:54.480
standard deviations away
from the mean.

00:05:54.480 --> 00:05:56.940
So let's figure out how many
standard deviations away from

00:05:56.940 --> 00:05:57.980
the mean that is.

00:05:57.980 --> 00:06:00.120
Now essentially we're just
figuring out a Z-score, a

00:06:00.120 --> 00:06:04.070
Z-score for this result
right over there.

00:06:04.070 --> 00:06:07.980
So let me pick a nice color--
I haven't used orange yet.

00:06:07.980 --> 00:06:11.090
So our Z-score-- you could
even do the Z-statistic.

00:06:11.090 --> 00:06:15.260
It's being derived from these
other sample statistics.

00:06:15.260 --> 00:06:19.060
So our Z-statistic, how far
are we away from the mean?

00:06:19.060 --> 00:06:20.310
Well the mean is 1.2.

00:06:23.880 --> 00:06:27.730
And we are at 1.05, so I'll
put that less just so that

00:06:27.730 --> 00:06:29.350
it'll be a positive distance.

00:06:29.350 --> 00:06:30.930
So that's how far away we are.

00:06:30.930 --> 00:06:34.350
And if we wanted it in terms
of standard deviations, we

00:06:34.350 --> 00:06:37.950
want to divide it by our best
estimate of the sampling

00:06:37.950 --> 00:06:52.180
distribution's standard
deviation, which is this 0.05.

00:06:52.180 --> 00:06:58.730
So this is 0.05, and what is
this going to be equal to?

00:06:58.730 --> 00:07:00.840
This result right here,
1.05 seconds.

00:07:00.840 --> 00:07:06.310
1.2 minus 1.05 is 0.15.

00:07:06.310 --> 00:07:12.535
So this is 0.15 in the numerator
divided by 0.05 in

00:07:12.535 --> 00:07:15.970
the denominator, and so
this is going to be 3.

00:07:15.970 --> 00:07:20.020
So this result right here
is 3 standard deviations

00:07:20.020 --> 00:07:21.140
away from the mean.

00:07:21.140 --> 00:07:22.820
So let me draw this.

00:07:22.820 --> 00:07:23.950
This is the mean.

00:07:23.950 --> 00:07:28.280
If I did 1 standard deviation,
2 standard deviations, 3

00:07:28.280 --> 00:07:30.680
standard deviations-- that's
in the positive direction.

00:07:30.680 --> 00:07:33.360
Actually let me draw
it a little bit

00:07:33.360 --> 00:07:33.870
different than that.

00:07:33.870 --> 00:07:36.330
This wasn't a nicely drawn
bell curve, but I'll do 1

00:07:36.330 --> 00:07:40.780
standard deviation, 2 standard
deviation, and then 3 standard

00:07:40.780 --> 00:07:43.070
deviations in the positive
direction.

00:07:43.070 --> 00:07:46.620
And then we have 1 standard
deviation, 2 standard

00:07:46.620 --> 00:07:49.300
deviations, and 3 standard
deviations in

00:07:49.300 --> 00:07:50.770
the negative direction.

00:07:50.770 --> 00:07:54.270
So this result right here, 1.05
seconds that we got for

00:07:54.270 --> 00:07:56.850
our 100 rat sample is
right over here.

00:07:56.850 --> 00:08:00.760
3 standard deviations
below the mean.

00:08:00.760 --> 00:08:03.460
Now what is the probability
of getting a result

00:08:03.460 --> 00:08:05.470
this extreme by chance?

00:08:05.470 --> 00:08:08.220
And when I talk about this
extreme, it could be either a

00:08:08.220 --> 00:08:12.380
result less than this or a
result of that extreme in the

00:08:12.380 --> 00:08:13.410
positive direction.

00:08:13.410 --> 00:08:15.490
More than 3 standard
deviations.

00:08:15.490 --> 00:08:17.570
So this is essentially, if we
think about the probability of

00:08:17.570 --> 00:08:20.940
getting a result more extreme
than this result right over

00:08:20.940 --> 00:08:24.030
here, we're thinking about
this area under the bell

00:08:24.030 --> 00:08:27.530
curve, both in the negative
direction or in

00:08:27.530 --> 00:08:29.180
the positive direction.

00:08:29.180 --> 00:08:30.880
What is the probability
of that?

00:08:30.880 --> 00:08:35.100
Well we go from the empirical
rule that 99.7% of the

00:08:35.100 --> 00:08:38.760
probability is within 3
standard deviations.

00:08:38.760 --> 00:08:41.140
So this thing right here-- you
can look it up on a Z-table as

00:08:41.140 --> 00:08:45.340
well, but 3 standard deviation
is a nice clean number that

00:08:45.340 --> 00:08:46.840
doesn't hurt to remember.

00:08:46.840 --> 00:08:49.270
So we know that this area right
here I'm doing and just

00:08:49.270 --> 00:08:56.800
reddish-orange, that area
right over is 99.7%.

00:08:56.800 --> 00:09:01.610
So what is left for these two
magenta or pink areas?

00:09:01.610 --> 00:09:05.250
Well if these are 99.7% and
both of these combined are

00:09:05.250 --> 00:09:07.380
going to be 0.3%.

00:09:07.380 --> 00:09:13.480
So both of these combined are
0.3-- I should write it this

00:09:13.480 --> 00:09:14.970
way or exactly-- are 0.3%.

00:09:19.010 --> 00:09:20.480
0.3%.

00:09:20.480 --> 00:09:26.290
Or is we wrote it as a decimal
it would be 0.003 of the total

00:09:26.290 --> 00:09:28.530
area under the curve.

00:09:28.530 --> 00:09:33.000
So to answer our question, if we
assume that the drug has no

00:09:33.000 --> 00:09:36.500
effect, the probability of
getting a sample this extreme

00:09:36.500 --> 00:09:42.450
or actually more extreme
than this is only 0.3%

00:09:42.450 --> 00:09:44.740
Less than 1 in 300.

00:09:44.740 --> 00:09:49.080
So if the null hypothesis was
true, there's only a 1 in 300

00:09:49.080 --> 00:09:50.880
chance that we would have
gotten a result

00:09:50.880 --> 00:09:52.730
this extreme or more.

00:09:52.730 --> 00:09:56.700
So at least from my point of
view this results seems to

00:09:56.700 --> 00:10:00.040
favor the alternative
hypothesis.

00:10:00.040 --> 00:10:08.180
I'm going to reject the
null hypothesis.

00:10:08.180 --> 00:10:10.050
I don't know 100% sure.

00:10:10.050 --> 00:10:13.670
But if the null hypothesis was
true there's only 1 in 300

00:10:13.670 --> 00:10:15.350
chance of getting this.

00:10:15.350 --> 00:10:18.610
So I'm going to go with the
alternative hypothesis.

00:10:18.610 --> 00:10:23.570
And just to give you a little
bit of some of the name or the

00:10:23.570 --> 00:10:26.890
labels you might see in some
statistics or in some research

00:10:26.890 --> 00:10:32.110
papers, this value, the
probability of getting a

00:10:32.110 --> 00:10:38.620
result more extreme than this
given the null hypothesis is

00:10:38.620 --> 00:10:40.470
called a P-value.

00:10:40.470 --> 00:10:45.840
So the P-value here, and that
really just stands for

00:10:45.840 --> 00:10:52.400
probability value, the P-value
right over here is 0.003.

00:10:52.400 --> 00:10:56.010
So there's a very, very small
probability that we could have

00:10:56.010 --> 00:10:59.610
gotten this result if the null
hypothesis was true, so we

00:10:59.610 --> 00:11:00.500
will reject it.

00:11:00.500 --> 00:11:02.750
And in general, most people
have some type

00:11:02.750 --> 00:11:03.640
of a threshold here.

00:11:03.640 --> 00:11:07.220
If you have a P-value less than
5%, which means less than

00:11:07.220 --> 00:11:09.820
1 in 20 shot, let's say, you
know what, I'm going to reject

00:11:09.820 --> 00:11:11.830
the null hypothesis.

00:11:11.830 --> 00:11:14.480
There's less than a 1 in 20
chance of getting that result.

00:11:14.480 --> 00:11:16.320
Here we got much less
than 1 in 20.

00:11:16.320 --> 00:11:19.170
So this is a very strong
indicator that the null

00:11:19.170 --> 00:11:21.350
hypothesis is incorrect,
and the drug

00:11:21.350 --> 00:11:23.860
definitely has some effect.