-
Hi. This video is a continuation
of our hypothesis testing video.
-
We just finished an example of
doing hypothesis testing for means.
-
One sample.
-
Now we're going to talk about a one
sample hypothesis test for proportions.
-
Up here, in our previous example,
-
I talked about the major
steps that you take.
-
You state your hypotheses, collect
data, construct a test statistic.
-
Apply a decision rule,
either a critical region
-
or a p value, and draw
conclusions in context.
-
So we're going to follow those
exact same steps again here.
-
So I'm going to say this
is for proportions now.
-
Our null hypothesis is well
-
I guess the research question is- is
we're going to be interested in seeing
-
if, the proportion of red haired
-
people is equal to point one five. So,
-
proportion of red
-
haired people is point one five.
-
And the alternative we're just
going to do, it's simply a two sided.
-
So proportion of red haired people is not
-
point one five, okay.
-
The data we are going to be using
is from the hair eye color dataset.
-
Same dataset we used in our
confidence interval section.
-
So as you can see here,
it has a table of different hair
-
colors, eye colors and
different sexes for some students.
-
So to get the total number of red
haired people, you just sum up
-
all of the values of red haired people.
-
So ten plus ten plus seven plus
seven, and then sixteen plus seven
-
plus seven, plus seven.
-
will give you seventy-one.
-
Okay.
-
I'm just gonna put a note here.
-
seventy-one red haired people.
-
Okay.
-
So a test statistic for
a proportion is given.
-
You're going to need to have a,
-
a p hat value.
-
You're going to need to
have a hypothesized value.
-
And you're going to need to know
the number of observations.
-
So I'm going to do the total
number of observations first.
-
So we're going to
-
just we're not actually going to use
the length function in this case.
-
Since this is in a table,
I'm going to just sum up
-
all of the numbers in this whole table.
-
And that'll give us the total number
of observations in this data set,
-
which is five-hundred-and-ninety-two.
-
And then our, p hat is
our sample proportion.
-
So our sample we had seventy-one
-
red- red haired people.
-
And in order to get a proportion,
-
we need to divide that by
the total number of people.
-
So that'll be seventy-one
divided by five ninety-two,
-
which is also equal to
point one one nine nine.
-
And then the last thing
we will need is wherever
-
our hypothesized proportion is,
usually denoted like with p naught.
-
So I'm going to call it p zero.
-
And this is chosen by us the
researcher or the statistician.
-
And it is point one five.
-
Okay.
-
So now since we usually use
-
a standard normal table or a
normal distribution for proportions,
-
I'm going to call this
the r z test statistic.
-
And for a proportion, it's
-
we will calculate it as being p hat
-
minus p naught,
the hypothesized value
-
divided by the square root of
-
Now there's a numerator and denominator
-
inside this.
-
Inside this square root.
-
So it's going to have
a lot of parentheses.
-
But if you just are very aware of all
your parentheses, it'll be just fine.
-
So this is
-
p naught times
one minus p naught.
-
Then outside of
-
But let's see.
-
All right.
-
So we have closed the
parentheses for this one.
-
And then.
-
Close
-
the parentheses for that p naught
times one minus p naught.
-
So it's still inside the square root.
-
We will also divide that by n
and then this parentheses
-
will close off the end of the square root.
-
And that'll close off the
end of the denominator.
-
And that will give us.
-
A value of negative two
point zero four eight eight
-
So that is our test statistic.
-
For this hypothesis test.
-
Now to apply a decision rule
-
we're going to start off
with our rejection region.
-
Before we do that, we always have
-
the researcher set our preferred
or a set significance level,
-
usually it's point zero five,
but obviously that is up to you.
-
So we are going to
find a rejection region.
-
And we are going to be
using the Q norm functions
-
because we use the normal
distribution when doing
-
any kind of inference
with proportions.
-
And we want to find a tail
probability that is our significance
-
level divided by two because we are
doing a two sided hypothesis test.
-
So we want the two tails
to each have alpha over two.
-
And since our test statistic is
negative means--meaning that
-
it's on the left hand side of the
curve, we want to get a lower or a,
-
left hand probability.
-
Tail probability.
-
We're going to say lower
dot tail equals true.
-
There we go, and then our value
-
where we would reject is
negative one point nine six.
-
So this tells us that if we got a test,
-
if we ever get a test statistic that is
less than negative one point nine six
-
or greater than positive
one point nine six,
-
we will reject our null hypothesis.
-
Our test statistic is smaller
-
than negative one point nine six.
-
So we would reject our null
hypothesis and say that
-
the true proportion of red haired
people is not point one five.
-
Our sample we got was point one two.
-
So you know, point two, point one two,
point one five, you know, pretty close.
-
But it's not exactly point one five.
-
It's probably something different
-
then if you want to do, a finding
-
you're doing your decision rule.
-
You can also do it with p values.
-
So we are doing a two sided test again.
-
So we will also multiply this and p
-
the p like tail value
probability value by two.
-
And the critical value
that we will plug in here
-
to find the probability
is z dot test dot stat.
-
The one we got from our data.
-
And again we will say
lower dot tail equals true
-
because we are finding a
extreme or tail probability.
-
So our two sided p value is
point zero four zero five.
-
And so this is where we compare it to
our alpha value which is point zero five.
-
So if our p value is less
than alpha point zero five
-
that means we reject
our null hypothesis.
-
This value is just barely, but it
is still less than point zero five.
-
So in this case we would
reject our null hypothesis again.
-
And say that the true proportion of
red haired people is not point one five.
-
Where, whatever decision rule
you applied, whether it's rejection
-
region or a p value, you should be
coming to the same conclusion.
-
On whether to reject or fail
to reject your null hypothesis.
-
You shouldn't be getting
different conclusions with these.
-
And there are other
functions, kind of like
-
how I talked about the confidence
intervals for proportion video.
-
There are, functions
out there that can do
-
a one sample proportion test,
-
because, you know, for means
you can easily just use t dot test.
-
But there are ones for
proportions out there,
-
but they do require you to
download other packages
-
and kind of do the research and
find out those other functions.
-
And so just to kind of make it as
simple as possible for you guys
-
so you don't have to go find
that all that information.
-
We thought we would just show you
how to do it by hand here, and,
-
you'll get the same conclusions.
-
So--
-
Anyway, hopefully that this
these videos were helpful for you
-
in helping out with hypothesis
testing for means and for proportions.
-
All right.
-
We will see you later in the next r video.
-
Have a good one.