I have a set of $N$ x,y
points for which I perform a simple linear regression of the form $y=a x+b$.
I need to calculate the reduced chi square ($\chi^2_{\nu}$) to asses the goodness of fit of this regression. According to Wikipedia, the number of degrees of freedom is:
The degree of freedom, $\nu =n-m$, equals the number of observations $n$ minus the number of fitted parameters $m$.
Given that I have 2 fitted parameters, $a$ and $b$, I'd have
$\nu = N – 2$
But I've seen in a blog post with Python code to obtain the reduced chi square, that $\nu$ is calculated as:
$\nu=N-2-1$
The number of points I'm fitting is rather small ($N<10$), so an extra $-1$ will affect the value of my $\chi^2_{\nu}$ quite a bit.
Which is the correct formula for obtaining the degrees of freedom and why?
Best Answer
$v=n-m$ is correct. Explaining Degrees of Freedom is a complicated and I doubt that I understand it well enough to explain. Here is an article that is very useful: http://courses.ncssm.edu/math/Stat_Inst/PDFS/DFWalker.pdf
Edit See Glen_b's comment below.