1. **T-Test or Chi-Square Test:**
- For a t-test or chi-square test, the degrees of freedom are typically calculated as the total number of observations minus the number of parameters estimated from the data.
- For example, in a t-test comparing the means of two groups, the degrees of freedom would be the total number of observations from both groups minus 2 (one for each mean estimated).
2. **Regression Analysis:**
- In regression analysis, the degrees of freedom are typically calculated as the total number of observations minus the number of parameters estimated from the data (including the intercept term).
- For example, in simple linear regression with one predictor variable, the degrees of freedom would be the total number of observations minus 2 (one for the slope and one for the intercept).
3. **ANOVA (Analysis of Variance):**
- In ANOVA, the degrees of freedom are calculated differently depending on the specific model being used.
- For a one-way ANOVA with k groups, the degrees of freedom for the between-group variation is k - 1, and the degrees of freedom for the within-group (error) variation is N - k, where N is the total number of observations.
4. **Contingency Table:**
- In a contingency table analysis (e.g., chi-square test for independence), the degrees of freedom are calculated as (r - 1) * (c - 1), where r is the number of rows and c is the number of columns in the table.
These are just a few examples of how degrees of freedom are determined in different statistical analyses. It's essential to understand the specific context of your analysis to correctly calculate degrees of freedom.