Degrees of freedom for Chi-squared test I am facing the following dilemma. I am aware of how to handle the one-sided Chi-squared distribution, but I am falling victim to how to handle degrees of freedom. Let me clarify with an example what I mean.
I have the following obseverd and expected values:
[Observed Data]

#Periods      CountryI   CountryII     CountryIII
#(1900-1950)     100      150            20
#(1951-2000)     59       160            50

[Expected DATA]

#Periods   country I     Country II       CountryIII        
#(1900-1950)  118.4         52                40
#(1951-2000)   80.5         90                25

My question is: Since this is a one sided-Chi square test,
are the degrees of freedom counted by the formula: (columns-1)(rows-1), in which case I would have $(6-1)(2-1) = 5$?
Or is that really just country1 country2 country3 that matters, so that d.f. would be 3-1=2?
Because d.f. is usually defined as the terms for the chi squared = 6, where we usually subtract 1 from it.
Please help me out with this one.
 A: How many variables are present in your cross-classification will determine the degrees of freedom of your $\chi^2$-test. In your case, your are actually cross-classifying two variables (period and country) in a 2-by-3 table.
So the dof are $(2-1)\times (3-1)=2$ (see e.g., Pearson's chi-square test for justification of its computation). I don't see where you got the $6$ in your first formula, and your expected frequencies are not correct, unless I misunderstood your dataset.
A quick check in R gives me:
> my.tab <- matrix(c(100, 59, 150, 160, 20, 50), nc=3)
> my.tab
     [,1] [,2] [,3]
[1,]  100  150   20
[2,]   59  160   50
> chisq.test(my.tab)

    Pearson's Chi-squared test

data:  my.tab 
X-squared = 23.7503, df = 2, p-value = 6.961e-06

> chisq.test(my.tab)$expected
        [,1]     [,2]     [,3]
[1,] 79.6475 155.2876 35.06494
[2,] 79.3525 154.7124 34.93506

A: Wait a minute, I think Sandra means 5 rather than 6. 
Maybe chl can correct me on this ... but I think it should be rite. If we take the definition that $\chi^2$ is evaluated as follows,
$$\chi^2= \sum_{i=1}^{\#Rows}(observed_i - expected_i)^2/expected_i  $$
and arrange the data as follows:
Observed[O]| Expected[E] | (O-E)^2/E
100          118.4         
150           52
 20           40
 59           80.5
160           90
 50           25

Thus, the total number of terms for calculating $\chi^2$ is  6 (as we are adding the final column of terms together which has 6 rows. As by definition, we have d.f.= no of rows or expected frequencies - 1.
Thus we obtain 5.
A: The degrees of freedom for chi square test in contingency table is determined by the number of 'expected observations' estimated independently. In your 2x3 table since row and column totals are already known, therefore you need estimate just two expected observations using formula (row total)*(column total)/N. Remaining expected observations can be found by subtraction from row or column total. for example if you estimate the first two observations of the first row then third observation of the first row can be found be subtracting these two estimated observations from the first row total and once the first row is known you can easily find the second row expected observations as the column totals are also already known. 
