How to calculate degrees of freedom


I have a book on statistics that shows two methods to calculate degrees of freedom, depending on the test.

1) For a correlation test it's df = (# rows - 1) - (# columns - 1);
2) for a chi-square test it's df = (# columns - 1) * (# rows - 1).

I always thought there was only one way to calculate df, that way, I think, being no. 2 above. Who is right, me or the book, or is there a third, a fourth way depending on the test?

I'll take your answer off-line and thank you later.



Not a robit
I believe most methods have their own unique calculation. Though, many approaches are just special cases of other approaches so they have similar calculations. It depends on the method, so yes there are multiple approaches for different statistical test.
Alright thanks for the answer. I'm only glad Excel calculates df automatically in these tests, although I'm troubled that df is not a uniform calculation across all statistics. So my book is fine, and I am more aware now. Learn something new every day.