An ecological researcher is investigating whether there is an association between the vertical canopy level in a rainforest and the primary species of beetle found there. The observed frequencies of four distinct beetle species across three different canopy levels are recorded in the table below:
| Canopy Level | Species A | Species B | Species C | Species D |
|---|---|---|---|---|
| Understory | 45 | 12 | 8 | 25 |
| Mid-canopy | 18 | 34 | 22 | 11 |
| Emergent layer | 5 | 15 | 40 | 38 |
Calculate the degrees of freedom for a Chi-square (χ2\chi^2χ2) test of independence for this study. Show your workings.