 Statistics - Maple Programming Help

Home : Support : Online Help : Statistics and Data Analysis : Statistics Package : Tests : Statistics/ChiSquareGoodnessOfFitTest

Statistics

 ChiSquareGoodnessOfFitTest
 apply the chi-square test for goodness-of-fit

 Calling Sequence ChiSquareGoodnessOfFitTest(Ob, Ex, options)

Parameters

 Ob - data sample of categorized observed data Ex - data sample of categorized expected data options - (optional) equation(s) of the form option=value where option is one of fitparameters, level, output, or summarize; specify options for the ChiSquareGoodnessOfFitTest function

Description

 • The ChiSquareGoodnessOfFitTest function computes the chi-square test for goodness-of-fit.  This test attempts to determine if an observed sample can be considered to match an expected sample.
 • The first parameter Ob is a data sample of categorized observed data.  This parameter must have the same length as Ex.
 • The second parameter Ex is a data sample of categorized expected data.  This parameter must have the same length as Ob.

Options

 The options argument can contain one or more of the options shown below.
 • fitparameters=posint
 This option is used to specify if this goodness-of-fit test is used to indicate the number of categories used when fitting this data to a distribution. A positive value for this parameter negatively affects the number of degrees of freedom used in the calculation, and so should be no greater than rtable_num_elems(Ex)-1.
 • level=float
 This option is used to specify the level of the analysis (minimum criteria for the observed data to be considered well-fit to the expected data).  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.
 • summarize= 'true', 'false', 'embed'
 This option controls the display of a printed or embedded summary for the hypothesis test. Unlike the output option, the displayed summary is not assignable output.

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 or use the summarize option.
 • To compare observed samples against a distribution rather than a categorized data set, the chi-square suitable model test should be applied instead.

Examples

 > $\mathrm{with}\left(\mathrm{Statistics}\right):$

Specify the matrices of categorized data values.

 > $\mathrm{Ob}≔\mathrm{Array}\left(\left[25,17,15,23,24,16\right]\right):$
 > $\mathrm{Ex}≔\mathrm{Array}\left(\left[20,20,20,20,20,20\right]\right):$

Perform the goodness-of-fit test on this sample.

 > $\mathrm{ChiSquareGoodnessOfFitTest}\left(\mathrm{Ob},\mathrm{Ex},\mathrm{level}=0.05,\mathrm{summarize}=\mathrm{true}\right)$
 Chi-Square Test for Goodness-of-Fit ----------------------------------- Null Hypothesis: Observed sample does not differ from expected sample Alt. Hypothesis: Observed sample differs from expected sample   Categories:              6 Distribution:            ChiSquare(5) Computed Statistic:      5.000000000 Computed p-value:        .415879723998286 Critical Values:         11.0704974062099   Result: [Accepted] This statistical test does not provide enough evidence to conclude that the null hypothesis is false.
 ${\mathrm{hypothesis}}{=}{\mathrm{true}}{,}{\mathrm{criticalvalue}}{=}{11.0704974062099}{,}{\mathrm{distribution}}{=}{\mathrm{ChiSquare}}{}\left({5}\right){,}{\mathrm{pvalue}}{=}{0.415879723998286}{,}{\mathrm{statistic}}{=}{5.000000000}$ (1)

References

 Kanji, Gopal K. 100 Statistical Tests. London: SAGE Publications Ltd., 1994.
 Sheskin, David J. Handbook of Parametric and Nonparametric Statistical Procedures. London: CRC Press, 1997.

Compatibility

 • The Statistics[ChiSquareGoodnessOfFitTest] command was updated in Maple 2016.
 • The summarize option was introduced in Maple 2016.