How to apply the Chi-Squared Test—Class Examples Name______
The Chi-square test is used to test whether an expected ratio fits the observed frequenciies—goodness to fit—or to see whether two variables are associated or independent. IS THERE AN ASSOCIATION BETWEEN TWO VARIABLES? Not considered valid with small sample sizes.
Step 1: State the null hypothesis:
H0= null hypothesis. This is the belief that there is NO COORELATION between our data. The data observed is just by chance. Knowing the level of variable A does not help you predict the level of variable B. They are independent of one another.Accepting the null hypothesis is a way of saying “Yes, there is a high probability that any deviation from the expected values can be attributed to CHANCE”
H1= the alternative hypothesis, there is a belief that there IS A COORELATION between data and the data observed is NOT just by chance. Knowing the level of variable A CAN help you predict the level of B.
Step 2: If needed, make a contingency table of observations (O).
Ex: 1 Mangrove pneumatophore density in different soilsEx: 2 Seeds per berry based on tree location
Soil Type / Mangrove pneumatophore Density (O)Mostly Sand
Some Sand
Mostly Mud
Some Mud
TOTAL
2 / 3 / 4 / TOTAL
Trees in Shade
Trees in sun
TOTAL / (Grand Total)
Step 3: Calculate the expected value (E)
*If only one variable: Total sum of observed values/ # of categories
Expected value for Ex #1 E= ______
*If more than one variable: Make an expected value table using your observation table.
Expected value for Ex #2 RECORDED IN TABLE BELOW
2 / 3 / 4 / TOTALSTrees in Shade / E=______/ E=______/
E=______
Trees in sun / E=______/
E=______/
E=______
Totals
*Totals should be the same as above
Step 4: Calculate the value of x².
x²= Greek letter chi o=observed results(the results of the experiment)
e= expected results (calculated theoretically) Ʃ= sum of all calculations for each type of outcome
O / E / O-E / O-E² / O-E²/EMostly Sand
Some Sand
Mostly Mud
Some Mud
X2Σ=______
O / E / O-E / O-E² / O-E²/ETree in Shade (2)
Tree in Shade (3)
Tree in Shade (4)
Tree in sun (2)
Tree in sun (3)
Tree in sun (4)
X2Σ=______
Step 5: Calculate the degrees of freedom (d.f.):
*If only one variable: # of categories -1= d.f.
*If more than one variable: V= (m-1) (n-1)= d.f. ( m=# of rows n= # of columns)
Example #1 d.f.= ______Example #2 d.f.= ______
Step 5: Use the critical value table to determine whether to accept or reject the null hypothesis
Accept null hypothesis Reject null hypothesis
Do we accept OR reject the null hypothesis for Ex #1 ______Ex #2 ______