Instructor: Hello students.
Welcome to Biostat ER example 7, chapter 7.
In this example, we will learn how to perform
hypothesis testing for categorical outcome
when we have two or more samples.
For this example, we are going to use problem 22
from our textbook, which states
use the data shown in problem 21
and test if there is an association between mother's BMI
and child's obesity status.
That is, normal versus overweight/obese.
Run the test at 5% level of significance.
Here I have copied and pasted the information
and I have highlighted the values
that we are going to be using
in this example.
So the first step would be to set up our hypotheses
and determine the level of significance.
So the null states
mother's BMI, and child's obesity status are independent
and the alternative states that the null is false.
The alpha here is 0.05, which is provided to us.
In step 2, we are going to select
the appropriate test statistics, which is chi square,
and the formula is copied and pasted here.
The condition for appropriate use of this test statistic
is that each expected frequency is at least five.
And in step 4 we will compute the expected frequencies
and we will ensure that the condition is met.
In step 3, we are going to set up the decision.
So the degrees of freedom here is r minus 1
multiplied by c minus 1.
So r here is our row, and c here is our columns.
So we have three rows here.
As you can see, this is the mother's BMI
categorized into three levels.
So we have three rows and we have two columns.
So it is going to be 3 minus 1
multiplied by 2 minus 1.
So our degrees of freedom will be two.
And when we go to the back of our book
with two degrees of freedom with an alpha of 0.05,
our decision will be to reject
if our calculated chi square value
is greater than or equal to 5.99.
Now in step 4, we are going to compute the test statistics.
Using the formula, and the formula here is
expected frequency equal to row total
multiplied by column total divided by the big N,
which is the sample size total.
So the top number in each cell of the table
is the observed frequency,
and the bottom number is the expected frequency,
which is shown in parentheses.
So I'm going to do a couple of calculations here.
So the first cell here, I'm going to do that calculation.
We are going to take the row total, which is 56,
and we are going to multiply it by the column total,
which is 62,
and we are going to divide it by 100,
which is the big N here,
and we will get the value 34.7.
And that is inserted here.
I'm going to do another one,
which is basically the next one,
which is again going to be multiplying the row total 56
by the column total, which is 38,
and then dividing it by 100
and we get 21.3.
So I will strongly encourage you
to go through these calculations yourself
and make sure that you are getting the values
that are provided here.
So once we have computed all the expected frequencies
and we can see that our condition is met,
we can proceed with calculating the chi square value.
And for that we are going to use the formula
that was provided here in step 2,
which is observed minus expected
whole squared divided by expected.
So for that, the first one will be observed value is 40,
expected value is 34.7.
So we are going to do the whole square of that
after we do the subtraction.
And then we are going to divide it by 34.7.
Similarly for the next one is going to be
16 minus 21.3 whole squared
divided by 21.3.
And as you can see, we are following the same formula
for each of these.
And now what I'm going to do
is help you understand
how this is performed algebraically
by doing one of the calculations.
So when we take the first one and we take 40
and we subtract 34.7,
we get 5.3.
So when we multiply 5.3 by itself, we get 28.09.
And when we divide that by 34.7,
we get 0.81.
And that is exactly what is inserted here.
So for the subsequent ones,
if you follow the same process algebraically,
you will get the values that are provided here.
Again, I strongly encourage you to make sure
that you are getting the same values
by doing the calculation yourself.
And once that is complete,
we are going to add up all these values
and that will provide us
with our final calculated chi square value, which is 4.95.
So now we are at step 5
and we are going to draw a conclusion.
And our conclusion here is we fail to reject null,
because 4.95 is less than 5.99.
So we do not have statistically significant evidence
at a alpha of 0.05 to show that the null is false
or that the mother's BMI and child's obesity status
are not independent.
Thank you for your time and attention
and please feel free to reach out if you have any questions
and I'll see you in the next video.