Student[Statistics] - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Education : Student Package : Statistics : Hypothesis Tests : Student/Statistics/ChiSquareGoodnessOfFitTest

Student[Statistics]

  

ChiSquareGoodnessOfFitTest

  

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

 

Calling Sequence

Parameters

Description

Examples

References

Compatibility

Calling Sequence

ChiSquareGoodnessOfFitTest(Ob, Ex, level_option, fitparameters_option, output_option)

Parameters

Ob

-

data sample of categorized observed data

Ex

-

data sample of categorized expected data

level_option

-

(optional) equation of the form level=float.

fitparameters_option

-

(optional) equation of the form fitparameters=posint.

output_option

-

(optional) equation of the form output=x where x is report, plot, or both

Description

• 

The ChiSquareGoodnessOfFitTest function computes the chi-square test for goodness-of-fit. This tests whether an observed sample follows the distribution specified by the expected sample.

• 

The first parameter Ob is a data sample of categorized observed data; that is, each entry of the sample is a count of observations of a particular category, as in a histogram. This parameter must have the same length as Ex.

• 

The second parameter Ex is a data sample of categorized expected data. Each entry of Ex is an expected count of observations, as in a histogram, just like with Ob. The categories, or bins of the histograms, are expected to be the same for both samples. In particular, the samples must have the same length.

• 

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.

• 

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.

• 

To compare observed samples against a distribution rather than a categorized data set, the chi-square suitable model test should be applied instead.

• 

If the option output is not included or is specified to be output=report, then the function will return a report. If output=plot is specified, then the function will return a plot of the sample test. If output=both is specified, then both the report and the plot will be returned.

Examples

withStudent[Statistics]:

Specify the matrices of categorized data values.

Ob125,17,15,23,24,16:

Ex120,20,20,20,20,20:

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

ChiSquareGoodnessOfFitTestOb1,Ex1,level=0.05

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.

hypothesis=true,criticalvalue=11.0704974062099,distribution=ChiSquare5,pvalue=0.415879723998286,statistic=5.000000000

(1)

Another example.

Ob21,2,3,2,2,2,4,1,6:

Ex25,2,2,1,1,1,8,5,2:

ChiSquareGoodnessOfFitTestOb2,Ex2

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:              9
Distribution:            ChiSquare(8)
Computed Statistic:      19.90000000
Computed p-value:        .0107210773034122
Critical Values:         15.5073130558655
 
Result: [Rejected]
This statistical test provides evidence that the null hypothesis is false.

hypothesis=false,criticalvalue=15.5073130558655,distribution=ChiSquare8,pvalue=0.0107210773034122,statistic=19.90000000

(2)

If the output=plot option is included, then a plot will be returned.

ChiSquareGoodnessOfFitTestOb2,Ex2,output=plot

If the output=both option is included, then both a report and a plot will be returned.

report,graphChiSquareGoodnessOfFitTestOb2,Ex2,output=both:

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:              9
Distribution:            ChiSquare(8)
Computed Statistic:      19.90000000
Computed p-value:        .0107210773034122
Critical Values:         15.5073130558655
 
Result: [Rejected]
This statistical test provides evidence that the null hypothesis is false.
Histogram Type:  default
Data Range:      1. .. 6.
Bin Width:       .166666666666667
Number of Bins:  30
Frequency Scale: relative
Histogram Type:  default
Data Range:      1. .. 8.
Bin Width:       .233333333333333
Number of Bins:  30
Frequency Scale: relative

report

hypothesis=false,criticalvalue=15.5073130558655,distribution=ChiSquare8,pvalue=0.0107210773034122,statistic=19.90000000

(3)

graph

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 Student[Statistics][ChiSquareGoodnessOfFitTest] command was introduced in Maple 18.

• 

For more information on Maple 18 changes, see Updates in Maple 18.

See Also

Statistics[ChiSquareGoodnessOfFitTest]

Student

Student/Statistics/ChiSquareGoodnessOfFitTest/overview

Student[Statistics]

Student[Statistics][HypothesisTest]

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam