Tests Commands
The Statistics package provides various parametric and non-parametric tools for performing hypothesis testing and statistical inference.
ChiSquareGoodnessOfFitTest
apply the chi-square test for goodness-of-fit
ChiSquareIndependenceTest
apply the chi-square test for independence in a matrix
ChiSquareSuitableModelTest
apply the chi-square suitable model test
OneSampleChiSquareTest
apply the one sample chi-square test for the population standard deviation
OneSampleTTest
apply the one sample t-test for the population mean
OneSampleZTest
apply the one sample z-test for the population mean
ShapiroWilkWTest
apply Shapiro and Wilk's W-test for normality
TwoSampleFTest
apply the two sample F-test for population variances
TwoSamplePairedTTest
apply the paired t-test for population means
TwoSampleTTest
apply the two sample t-test for population means
TwoSampleZTest
apply the two sample z-test for population means
Notes
Examples
All tests generate a complete report of all calculations in the form of a userinfo message. In order to access these reports when applying tests, specify infolevel[Statistics] := 1 or use the summarize option.
with⁡Statistics:
Build a sample from a Rayleigh distribution and compare with the population mean and population standard deviation.
S≔Sample⁡Rayleigh⁡7,100:
evalf⁡Mean⁡Rayleigh⁡7
8.773198959
evalf⁡StandardDeviation⁡Rayleigh⁡7
4.585954642
Test that the sample S is drawn from a population with mean equal to 8 and standard deviation equal to 5.
OneSampleZTest⁡S,8,5
hypothesis=false,confidenceinterval=8.19465579918747..10.1546197837269,distribution=Normal⁡0,1,pvalue=0.0188099792028316,statistic=2.34927558291438
Test that the sample S is drawn from a population with mean equal to 8 with unknown standard deviation.
OneSampleTTest⁡S,8
hypothesis=false,confidenceinterval=8.26546145701860..10.0838141258958,distribution=StudentT⁡99,pvalue=0.0118640683436966,statistic=2.56356894641468
Test that S is drawn from a normal distribution and return an embedded report.
ShapiroWilkWTest⁡S,summarize=embed
hypothesis=false,pvalue=0.00138375156142846,statistic=0.947243047976463
Null Hypothesis:
Sample drawn from a population that follows a normal distribution
Alternative Hypothesis:
Sample drawn from population that does not follow a normal distribution
Sample Size
Computed Statistic
Computed p-value
100.
0.947243
0.00138375
Result:
Rejected: This statistical test provides evidence that the null hypothesis is false.
Test that Normal(8.77,4.59) is a suitable model for the population of S.
ChiSquareSuitableModelTest⁡S,Normal⁡8.77,4.59,level=0.01
hypothesis=true,criticalvalue=21.6659943178256,distribution=ChiSquare⁡9,pvalue=0.474985626461966,statistic=8.600000000
Test for independence in a 3x2 table.
X≔Matrix⁡32.,12.,14.,22.,6.,9.:
ChiSquareIndependenceTest⁡X,level=0.05
hypothesis=false,criticalvalue=5.99146454710798,distribution=ChiSquare⁡2,pvalue=0.00471928013399603,statistic=10.71219801
Return a report for the test above:
ChiSquareIndependenceTest⁡X,level=0.05,summarize=true
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.71219801
Computed p-value: .00471928013399603
Critical Values: 5.99146454710798
Result: [Rejected] This statistical test provides evidence that the null hypothesis is false.
See Also
Statistics
Statistics[Computation]
Download Help Document