Tests Commands - Maple Programming Help

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

Tests Commands

 The Statistics package provides various parametric and non-parametric tools for performing hypothesis testing and statistical inference.

 apply the chi-square test for goodness-of-fit apply the chi-square test for independence in a matrix apply the chi-square suitable model test apply the one sample chi-square test for the population standard deviation apply the one sample t-test for the population mean apply the one sample z-test for the population mean apply Shapiro and Wilk's W-test for normality apply the two sample F-test for population variances apply the paired t-test for population means apply the two sample t-test for population means apply the two sample z-test for population means

Notes

 • 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.

Examples

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

Build a sample from a Rayleigh distribution and compare with the population mean and population standard deviation.

 > $S≔\mathrm{Sample}\left(\mathrm{Rayleigh}\left(7\right),100\right):$
 > $\mathrm{evalf}\left(\mathrm{Mean}\left(\mathrm{Rayleigh}\left(7\right)\right)\right)$
 ${8.773198959}$ (1)
 > $\mathrm{evalf}\left(\mathrm{StandardDeviation}\left(\mathrm{Rayleigh}\left(7\right)\right)\right)$
 ${4.585954642}$ (2)

Test that the sample S is drawn from a population with mean equal to 8 and standard deviation equal to 5.

 > $\mathrm{OneSampleZTest}\left(S,8,5\right)$
 ${\mathrm{hypothesis}}{=}{\mathrm{false}}{,}{\mathrm{confidenceinterval}}{=}{8.19465579918747}{..}{10.1546197837269}{,}{\mathrm{distribution}}{=}{\mathrm{Normal}}{}\left({0}{,}{1}\right){,}{\mathrm{pvalue}}{=}{0.0188099792028316}{,}{\mathrm{statistic}}{=}{2.34927558291438}$ (3)

Test that the sample S is drawn from a population with mean equal to 8 with unknown standard deviation.

 > $\mathrm{OneSampleTTest}\left(S,8\right)$
 ${\mathrm{hypothesis}}{=}{\mathrm{false}}{,}{\mathrm{confidenceinterval}}{=}{8.26546145701860}{..}{10.0838141258958}{,}{\mathrm{distribution}}{=}{\mathrm{StudentT}}{}\left({99}\right){,}{\mathrm{pvalue}}{=}{0.0118640683436966}{,}{\mathrm{statistic}}{=}{2.56356894641468}$ (4)

Test that S is drawn from a normal distribution and return an embedded report.

 > $\mathrm{ShapiroWilkWTest}\left(S,\mathrm{summarize}=\mathrm{embed}\right)$
 ${\mathrm{hypothesis}}{=}{\mathrm{false}}{,}{\mathrm{pvalue}}{=}{0.00138375156142846}{,}{\mathrm{statistic}}{=}{0.947243047976463}$ (5)

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.

 > $\mathrm{ChiSquareSuitableModelTest}\left(S,\mathrm{Normal}\left(8.77,4.59\right),\mathrm{level}=0.01\right)$
 ${\mathrm{hypothesis}}{=}{\mathrm{true}}{,}{\mathrm{criticalvalue}}{=}{21.6659943178256}{,}{\mathrm{distribution}}{=}{\mathrm{ChiSquare}}{}\left({9}\right){,}{\mathrm{pvalue}}{=}{0.474985626461966}{,}{\mathrm{statistic}}{=}{8.600000000}$ (6)

Test for independence in a 3x2 table.

 > $X≔\mathrm{Matrix}\left(\left[\left[32.,12.\right],\left[14.,22.\right],\left[6.,9.\right]\right]\right):$
 > $\mathrm{ChiSquareIndependenceTest}\left(X,\mathrm{level}=0.05\right)$
 ${\mathrm{hypothesis}}{=}{\mathrm{false}}{,}{\mathrm{criticalvalue}}{=}{5.99146454710798}{,}{\mathrm{distribution}}{=}{\mathrm{ChiSquare}}{}\left({2}\right){,}{\mathrm{pvalue}}{=}{0.00471928013399603}{,}{\mathrm{statistic}}{=}{10.71219801}$ (7)

Return a report for the test above:

 > $\mathrm{ChiSquareIndependenceTest}\left(X,\mathrm{level}=0.05,\mathrm{summarize}=\mathrm{true}\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.71219801 Computed p-value:        .00471928013399603 Critical Values:         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.00471928013399603}{,}{\mathrm{statistic}}{=}{10.71219801}$ (8)
 >