Coming back to degrees of freedom for chi squared, I have found a wonderful answer here:
How to understand degrees of freedom?
However it is hard for me to apply it to my particular case. Let's say we observed counts of objects of 3 types:
A B C
35 121 344
The model, which has only one parameter, p, says that we should observe these objects with frequencies 0.01, 0.3, 0.69, which are some non-linear functions of p, let's say f(p), h(p), t(p). Given these frequencies, calculated using our model parameter p, we calculate expected counts and chi square statistic.
Question: how many degrees of freedom for chi square distribution should we use in this case?
Best Answer
We start with 3 d.f.
If the total observed count is used to calculate the $E_i$ from the expected proportions (the usual case), then the d.f. reduces by 1.
If the parameter, $p$, from which the expected proportions are calculated is estimated from discrete data (and, estimated efficiently), then this will reduce the d.f. by 1.
So in the usual case, this leaves 1 degree of freedom.
If the expected proportions are specified without reference to the data (e.g. specified in some null hypothesis), then you don't lose a d.f. for the parameter, leaving you with 2 d.f.
(These could always be verified by simulation, as long as the expected counts in the simulation aren't small.)