CHISQUARE procedure
Calculates chi-square statistics for one- and two-way tables (A.D. Todd & P.K. Leech).
Options
Parameters
Description
The CHISQUARE procedure calculates chi-square statistics. The DATA parameter supplies the data values. If these are in a two-way table, CHISQUARE produces the usual test of association between the row and column factor of the table; if a one-way table is supplied, the statistic assesses whether the different cells of the table contain different proportions of the data. Alternatively, you can set option GOODNESSOFFIT=yes to request a goodness-of-fit test between the data values and the set of expected values supplied by the FITTEDVALUES parameter; if you provide the degrees of freedom, using the DF parameter, the procedure can also calculate the probability value.
The PRINT option controls the printed output, with the settings: test to print the chi-square value and degrees of freedom; probability for the probability value; fittedvalues data, fitted (expected) values and standardized residuals; and tchisquare to show the contribution of each cell of the table to the chi-square value. By default, the statistic is calculated by the usual Pearson approximation (see the Method section), but you can set option METHOD=likelihood to calculate the chi-square by maximum likelihood (using the GenStat facilities for generalized linear models).
Parameters CHISQUARE, DF, PROBABILITY, FITTEDVALUES, RESIDUALS and TCHISQUARE allow the results to be saved in appropriate GenStat data structures.
Options: PRINT, METHOD, GOODNESSOFFIT.
Parameters: DATA, CHISQUARE, DF, PROBABILITY, FITTEDVALUES, RESIDUALS, TCHISQUARE.
Method
With option METHOD=pearson, the statistic is calculated by the usual Pearson formula:
chi-square = sum( (o-e) × (o-e) / e ),
where o = observed, and e = expected.
If GOODNESSOFFIT=yes, the table e is supplied by the FITTEDVALUES parameter. Otherwise, for a one-way table e is the mean of the DATA values, while for a two-way table
e = (row total) × (column total) / (total in table).
For METHOD=maximumlikelihood, CHISQUARE takes the deviance from fitting a generalized linear model with a log link and a Poisson distribution.