Degrees of freedom chi squared test

Find the degrees of freedom for a particular chi squared test below:


TestDegrees of freedom
Goodness of fit test$I - 1$.
Here $I$ is the number of groups.
Chi squared test for the relationship between two categorical variables$(I - 1) \times (J - 1)$.
Here $I$ is the number of groups for the first variable and $J$ is the number of groups for the second variable.
Kruskal-Wallis test$I - 1$.
Here $I$ is the number of groups for the independent variable.
McNemar's test1.
Cochran's Q test$k - 1$. Here $k$ is the number of related groups.
Friedman test$k - 1$. Here $k$ is the number of related groups.
Stuart-Maxwell test$J - 1$. Here $J$ is the number of groups for the dependent variable.
Model chi squared test for the complete logistic regression model$K$.
Here $K$ is the number of independent variables in the model.
Chi squared test for a single logistic regression coefficient1.