Chi square test for goodness of fit is used to analyse whether a given sample distribution obtained from collected data is the same as an identified theoretical distribution. Usually, the null hypothesis postulates that the sample was drawn from a population with the theoretical distribution. On the other hand, the alternate hypothesis states that the sample was not drawn from a population with the theoretical distribution. A good example would be analysing whether the female and male births in a given town are equally probable. In such a case, the null hypothesis would be: the observed number of girls in the town follows a binomial distribution with p = 0.5.
Both t-test and chi-square test of goodness of fit are used to assess whether a given data set fits a hypothesised value or values. There are two chief elements to consider when electing whether to use chi square test for goodness of fit or t-test; nature of the variables and number of levels for the variables. T-tests can only be used when evaluating two variables. One of the variables should be categorical with exactly two levels while other variable should be quantitative and can be estimated by a mean. For example, two groups could Manchester and Arsenal fans while the quantitative variable will be age. However, chi square test for goodness of fit is used when all the variables are categorical. In addition, the variables could have more than two levels. For example the variables could be ethnic group and favourite team. Under ethnic group we may have White, Hispanic, black, Indian American and Asian. Under favourite football team we may have Manchester United, Arsenal, Manchester City and Chelsea.
Healey, J. F. (2011). Statistics: A Tool for Social Research (9 ed.). London: Cengage Learning.