To prove a distribution is a good fit, take the null hypothesis to be that there is no difference between the theoretical frequency distribution and the observed frequency distribution, and the alternative hypothesis to be that there is a difference.
X^2, the goodness of fit statistic, is the sum of (O - E)^2/E, where E is the expected frequency and O is the observed frequency.
Degrees of freedom are a measure of how much information from the sample has not been used. Every time a statistic is calculated from a sample, a degree is used.
Number of degrees of freedom equal number of columnsminus the number of constraints.
There is always at least one constraint on the degrees of freedom as the fact that the total expected and observed frequencies match is a constraint. Any other calculated (not given) parameters are also constraints.
If any expected values are less than five, the columns must be combined as X^2 is only approximated well when the expected frequencies are all above five.
If X^2 exceeds the critical value, reject the null hypothesis, the better the fit, the smaller X^2 as the closer the expected and observed frequencies are to each other.
The null hypothesis for a contingency table is that the two variables are independent (no association) and the alternative hypothesis is that the two variables are not independent (association).
The expected frequency for a contingency table is the row total multiplied by the column total, all divided by the grand total.
The degrees of freedom of a contingency table is (number of rows- 1)(number of columns- 1).
A type 1 error is when you incorrectly reject the null hypothesis (ie you were right first time), and the probability of it is equal to the actual significance level of the test).
A type 2 error is when you incorrectly accept the null hypothesis and can be found by finding the probability that the variable doesn't fall in the critical region using the true value of the population parameter.
The size of a test is equal to the probability of a type 1 error.
The power of the test is equal to 1 - the probability of a type 2 error.
The power function can be found by working out each individual probability for the probability that the variable is in the critical region using the probability mass function for that variable and then adding them together.