Reporter > Applying statistical tests > Chi-square test > Example of the chi-square test
 
Example of the chi-square test
Sample script file: ChiSquareAndFisherTests.mrs
This example script is based on the Museum sample data set.
The chi-square test in this example tests whether there is an association between respondents' expectations of their visit to the museum and their age.
The script adds the test to the table as follows:
TableDoc.Table1.Statistics.Add("ChiSquare")
Table showing chi-square test
UNICOM Intelligence Reporter has added two rows to the table below the rows formed from the categories of the age variable. Similarly, it has added a column to the right of the columns formed from the categories of the expect variable. The cell at the intersection of the first additional row and column displays the chi-square statistic. In this table, the chi-square statistic is 70.459. The table also shows the p value for this chi-square value, based on the degrees of freedom for the table (you can see the degrees of freedom in the diagnostics file.
See also
Chi-square test