In one case I found that

**df = Nbins - 3**and in other cases I have found

**df = Nbins-1**

The idea of this test is to divide the dataset into a number Nbins of bins and comapre the values: 1. pieces of data counted in each bin, with 2. expected number of pieces of data in each bin based on the samples standard deviation, mean and, assumed, normal distribution.

The rationale for using df = Nbins-1-2 = Nbins-3, is that there are two parameters (samsple standard deviation and mean) that are used to obtain the value of the observed chi2. Hence the -2.

Could anyone clarify the matter? Should I use Nbins-1 or Nbins-3?

Thanks a lot,

R