apply the chi-square test for independence in a matrix - Maple Help

Home : Support : Online Help : Statistics : Statistics Package : Tests : Statistics/ChiSquareIndependenceTest

Statistics[ChiSquareIndependenceTest] - apply the chi-square test for independence in a matrix

 Calling Sequence ChiSquareIndependenceTest(X, options)

Parameters

 X - Matrix of categorized data options - (optional) equation(s) of the form option=value where option is one of level or output; specify options for the ChiSquareIndependenceTest function

Description

 • The ChiSquareIndependenceTest function computes the chi-square test for independence in a matrix.  This test attempts to determine if two factors can be considered to be independent of one another for purposes of analysis.
 • The first parameter X is a matrix of categorized data samples.

Options

 The options argument can contain one or more of the options shown below.
 • level=float
 This option is used to specify the level of the analysis (minimum criteria for a data set to be considered independent).  By default this value is 0.05.
 • output='report', 'statistic', 'pvalue', 'criticalvalue', 'distribution', 'hypothesis', or list('statistic', 'pvalue', 'criticalvalue', 'distribution', 'hypothesis')
 This option is used to specify the desired format of the output from the function.  If 'report' is specified then a module containing all output from this test is returned.  If a single parameter name is specified other than 'report' then that quantity alone is returned.  If a list of parameter names is specified then a list containing those quantities in the specified order will be returned.

Notes

 • This test generates a complete report of all calculations in the form of a userinfo message.  In order to access this report, specify infolevel[Statistics] := 1.

Examples

 > $\mathrm{with}\left(\mathrm{Statistics}\right):$
 > $\mathrm{infolevel}[\mathrm{Statistics}]:=1:$

Specify the matrices of categorized data values.

 > $X:=\mathrm{Matrix}\left(\left[\left[32,12\right],\left[14,22\right],\left[6,9\right]\right]\right):$
 > $Y:=\mathrm{Matrix}\left(\left[\left[2,4\right],\left[4,9\right],\left[7,12\right]\right]\right):$

Perform the independence test on the first sample.

 > $\mathrm{ChiSquareIndependenceTest}\left(X,\mathrm{level}=0.05\right)$
 Chi-Square Test for Independence -------------------------------- Null Hypothesis: Two attributes within a population are independent of one another Alt. Hypothesis: Two attributes within a population are not independent of one another Dimensions:              3 Total Elements:          95 Distribution:            ChiSquare(2) Computed statistic:      10.7122 Computed pvalue:         0.00471928 Critical value:          5.99146454710798 Result: [Rejected] This statistical test provides evidence that the null hypothesis is false
 ${\mathrm{hypothesis}}{=}{\mathrm{false}}{,}{\mathrm{criticalvalue}}{=}{5.99146454710798}{,}{\mathrm{distribution}}{=}{\mathrm{ChiSquare}}{}\left({2}\right){,}{\mathrm{pvalue}}{=}{0.00471928013704082}{,}{\mathrm{statistic}}{=}{10.71219801}$ (1)

Perform the independence test on the second sample.

 > $\mathrm{ChiSquareIndependenceTest}\left(Y,\mathrm{level}=0.05\right)$
 Chi-Square Test for Independence -------------------------------- Null Hypothesis: Two attributes within a population are independent of one another Alt. Hypothesis: Two attributes within a population are not independent of one another Dimensions:              3 Total Elements:          38 Distribution:            ChiSquare(2) Computed statistic:      0.128915 Computed pvalue:         0.937576 Critical value:          5.99146454710798 Result: [Accepted] This statistical test does not provide enough evidence to conclude that the null hypothesis is false
 ${\mathrm{hypothesis}}{=}{\mathrm{true}}{,}{\mathrm{criticalvalue}}{=}{5.99146454710798}{,}{\mathrm{distribution}}{=}{\mathrm{ChiSquare}}{}\left({2}\right){,}{\mathrm{pvalue}}{=}{0.937575872647938}{,}{\mathrm{statistic}}{=}{0.1289151874}$ (2)