I am doing multivariable regression modelling on a sample of n elements with m independent + 1 dependent variable.
I used the OLS (Ordinary Least Squares) method to determine the beta vector of regression coefficients, I estimated the dependent variable based on the model, and calculated the residuals (difference between actual and estimated values).
Now I would like to check that the residuals follow normal distribution with the chi-squared test.
I have the formula for the statistic: $\chi ^{2} = n \sum_{i=1}^{k} \frac{ ( p_{i} - p_{i}^{*} )^{2} }{ p_{i}^{*} }$
where $p_{i}$ is the actual number of elements in the class interval and $p_{i}^{*}$ is that predicted by the normal distribution.
I am not sure of the degree of freedom, however.
- Should I use $n - 2 - 1$ (n is the number of elements, $2$ for estimating two parameters (mean, sigma) of the $p_{i}^{*}$ normal distribution?
- Or should I also take into account that the residuals are the result of the estimation with regression, and there I estimated all the beta coefficients $(m+1)$ parameters, and so the degree of freedom is $n - (m+1) - 1$?