# Degrees of freedom for chi square test for particular model

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?

• It depends on whether $p$ was estimated from these data or was determined in some other way. Perhaps you could clarify that point? (Fortunately, in this case you will get the same results no matter what: the count for $A$ is so obviously out of line with a frequency of $0.01$ (predicting a count of only $5$ instead of $35$) that it is extremely implausible that these data are consistent with $p$. You can use a Poisson or Binomial or even Normal approximation to get a sense of how extreme $35$ is; the calculations are easily carried out in your head.)
– whuber
Dec 12 '13 at 20:10
• Thank you whuber, yes we estimate p from data, but it isn't clear what does it mean. For example, if we have one parameter, one can decide that we have only 1 degree of freedom, and don't use the formula n - 1 - k, where n is a number of bins, and is k a number of independent parameters. For me it is hard to see how this simple formula for number of dfs can capture non-linearity of f(), h() and t(), how this test statistic completely hides underlied complexity of the model, and uses only number of free parameters. Maybe you can suggest how can I simulate it to see on my own eyes? Dec 13 '13 at 18:08
• Or just drop a link or recommend a book where such maybe basic question answered. What I googled so far was just recipes, which, moreover, contradicted each other (this problem indeed corresponds to a real-life one, but I tried to hide unnecessary details) Dec 13 '13 at 18:14

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.