# Chi squared notes

```CHI SQUARED ANALYSIS OF ECOLOGICAL SAMPLING
WORKED EXAMPLE:
An area on the summit of Sgùrr Choinnich Mor in Scotland is grazed by sheep in the summer and
frequented by hillwalkers. There are areas of the summit containing heather (Canna vulgaris) and
some containing moss (Rhytidiadelphus squarrosus). A visual survey of this area suggested that
the moss is associated with the heather.
We want to know if the two species (heather and moss) are present together due to random
chance or if they have a relationship with one another (either a positive or negative influence on
each other).
Step 1:
Write a null (H0) hypothesis and and alternative (H1) hypothesis. Null always predicts a scenario
with no association whereas the alternative will always predict a scenario where the two
populations are associated.
Null hypothesis (H0):
Alternative hypothesis (H1):
A series of 200 quadrats were set up on the summit and the presence or absence of heather or
moss in each quadrat was recorded.
Results:
Species
Heather only
Moss only
Both species
Neither
species
Frequency (Number
appeared in)
31
45
89
35
Step 2:
Construct a contingency table of observed values using the data above.
Heather present
Moss present
Heather absent
Row totals
89
Moss absent
31
Column totals
120
200
Step 3:
Calculate the expected frequencies, assuming that the species are NOT affecting each other
(independent distribution).
Assuming that the two species are randomly distributed with respect to each other, the
probability of moss and heather being present in a quadrat is:
(row total x column total)  total number of quadrats
= (134 x 120)  200 = 80 (round up)
Expected values follow the assumption that totals for each row and column do not change,
because the relationship shown by the data is assumed to represent the true relative frequency of
each species
Heather present Heather absent Row total
Observed
89
Expected
80
Observed
31
Expected
40
Moss present
Moss absent
Column total
120
Step 4: Calculate chi squared using the following equation:
200
The chi squared in this example can be calculated as follows:
=
=____________________________
Step 5:
Calculate the degrees of freedom using this equation and the # of rows and columns in the
contingency table.
Degrees of freedom = (number of rows – 1) x (number of columns – 1)
=_______________________
Step 6:
Find the critical value at a 95% confidence limit and circle it
Step 7:
Is your chi squared value LARGER than the critical value? __________
There IS a statistically significant association between moss and heather in this area on the summit
of Sgùrr Choinnich Mor.
The distribution of the two species are not independent of each other, the distribution of the two
species is associated.
CHI SQUARED M&M INVESTIATION
One researcher has suggested that _____________ colour M&Ms have a negative effect on
_____________ M&Ms. The researcher suggested that _____________ M&Ms outcompete
_____________ M&Ms for resources.
Step 1:
Write a null (H0) hypothesis and and alternative (H1) hypothesis. Null always predicts a scenario
with no association whereas the alternative will always predict a scenario where the two
populations are associated.
Null hypothesis (H0):
Alternative hypothesis (H1):
A series of 20 quadrats were set up on the desk and the presence or absence of _____________
colour M&Ms or _____________ colour M&Ms in each quadrat was recorded.
Results:
Species
_____________ only
_____________ only
Both species
Neither species
Frequency (Number
appeared in)
Step 2:
Construct a contingency table of observed values using the data above.
_____________
present
_____________
absent
Row totals
_____________
present
_____________
absent
Column totals
Step 3:
Calculate the expected frequencies, assuming that the species are NOT affecting each other
(independent distribution).
_____________
present
_____________
present
_____________
absent
Observed
Expected
Observed
Expected
Column total
Step 4: Calculate chi squared using the following equation:
The chi squared in this example can be calculated as follows:
=
=
=____________________________
_____________
absent
Row
total
Step 5:
Calculate the degrees of freedom using this equation and the # of rows and columns in the
contingency table.
Degrees of freedom = (number of rows – 1) x (number of columns – 1)
=_______________________
Step 6:
Find the critical value at a 95% confidence limit and circle it
Step 7:
Is your chi squared value LARGER or SMALLER than the critical value?
What does this mean?
__________
```