# Chi Square Test In Genetics

1. Feb 19, 2010

### zmike

In the Chi-square test, my textbook says that degrees of freedom are the number of independent variables minus one ,df = n - 1

does this mean that that n is equal to the number of observed values from the equation aka the number of times I've added or the number of terms?

sum [(O-E)^2]/E

Is there an instance where it isn't equal to the number of observed values I have?

(there's an example in my book (but no answer) with an experiment with observed values of 2 trials of genetic crosses where observed in
trial 1 was 0.5
trial 2 was 0.3
but both of these values were measuring the same variable which was heterozygosity. The expected value is 0.8. Does this mean the df = 1? or is it 0 since there is only 1 independent variable?)

thank you so much

2. Feb 21, 2010

### eachus

The Chi-square test only deals with discrete variables. For example, if you were to sort fruit by color, you might have categories, red, orange, yellow, green, purple, pink, etc. To use the Chi-square test you want to arrange your categories so that each has an expected number of instances of at least five. If you have sixty fruit in your sample, you want each bucket to have an expectation greater than 1/12. If necessary combine categories to achieve this.

The number of degrees of freedom is the number of categories minus one. If you end up with seven colors in the fruit example, the number of degrees of freedom is six. The way to think of this is that the probabilities of the various categories (colors) has to add up to one, so there is one less d.f. than the number of categories.

If you have a more complex experimental design, the degrees of freedom can be smaller. For example, roll two differently colored dice. You have 36 different possible outcomes, counting the red die and white die results as a tuple, such as [3. 2]. If you are willing to roll the dice 180+ times, there will be 25 degrees of freedom. (A six by six grid with 36 possible outcomes, but there are 5 d.f. for the red die, and 5 d.f. for the white die. If you rolled one 36 sided die, there would be 35 d.f.)