How to determine degree of freedom?

How to determine degree of freedom?

Why the Total variation (TSS) has n-1 degree of freedom, the sum of squared errors or residuals has n-(k+1) degree of freedom and the regression sum of squares has k degree of freedom? And why Durbin–Watson statistic use k and n to determine dl and du?

where n=number of observation, k=number of independent of variables.

By the way, I think error and residual are total different terms. But why the sum of squared errors and the sum of squared residuals are exactly the same term?

Sum of Squared Errors is estimated by Sum of Squared Residuals (a residual is an estimated error).

Degrees of freedom depend on the number of estimated parameters used in the calculation. Sum of Squares Total only uses the sample mean in its calculation. The estimated error variance uses n-k-1 when we estimate the line with an intercept because we have k non-intercept estimates and 1 intercept estimate.

Thank you for the help!

No problem!