On chi-squared.

See the example from class.

The formula is
  chi2 = Sum over the number of classes of ((Oi-Ei)^2)/Ei in which
  Oi is the Observed frequency for the ith class and Ei is the expected
  frequency.
  
For example
  Suppose we threw a die 60 times, we would expect approximately 10
  each of one's, two's, ... six's. Our Ei's are all 10. If we got say
  11-1's, 12-2's, 7-3's, 10-4's, 12-5's and 8-6's, our chi2 value would be
    (11-10)^2/10 + (12-10)^2/10 + (7-10)^2/10 + (10-10)^2/10 + (12-10)^2/10 +
    (8-10)^2/10
    = .1 + .4 + .9 + .0 + .4 + .4
    = 2.2
  Is that two point two too large? Too small?
  This is where statistical tables come in. If the
  data were (note: this were is for the use of the subjunctive,
  not for regarding the collective noun as plural) uniformly
  distributed then 95% of the time the Chi2 value would be < 11.1
  and 95% of the time it would be > 1.15 . These are the 95%
  cutoffs. If our value is between these values we accept the 
  die as being fair, and if not then we reject it. Where do we
  find the cutoffs? From a Chi2 table, e.g. on the handout, it the
  back of a stats book, off the web, etc. You'll find 1.15 and 11.1
  under the .05 and .95 cutoffs resp. for 5 degrees of freedom. Why 5?
  Here we have 6 classes (possibilities) viz. 1,2,..,6. If the frequencies
  of five of them were known, then, because their total must be 60, the
  frequency of the sixth would be determined. Hence 5, not 6, degrees of
  freedom.   
  
Important note: for the chi2 test to be valid all the expected freqs should
  be at least five.