Hypothesis Testing and Inference - Maple Programming Help

Home : Support : Online Help : Applications and Example Worksheets : Statistics : examples/StatisticsHypothesisTesting

Hypothesis Testing and Inference

Hypothesis testing and inference is a mechanism in statistics used to determine if a particular claim is statistically significant, that is, statistical evidence exists in favor of or against a given hypothesis. The Statistics package provides 11 commonly used statistical tests, including 7 standard parametric tests and 4 non-parametric tests.

All tests generate a report of all major calculations to userinfo at level 1 (hence, if output is suppressed, the reports are still generated).  To access the reports, you need to specify the statistics information level to 1 using the following command.

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

1 Tests for Population Mean

Two standard parametric tests are available to test for a population mean given a sample from that population. The OneSampleZTest should be used whenever the standard deviation of the population is known.  If the standard deviation is unknown, the OneSampleTTest should be applied instead.

 > $\mathrm{restart}:$$\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\mathrm{with}\left(\mathrm{Statistics}\right):$

Generate a sample from a random variable that represents the sum of two Rayleigh distributions.

 > $R:=\mathrm{RandomVariable}\left(\mathrm{Rayleigh}\left(7\right)\right)+\mathrm{RandomVariable}\left(\mathrm{Rayleigh}\left(4\right)\right):$$\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}S:=\mathrm{Sample}\left(R,100\right):$

The following then are the known values of the mean and standard deviation of the population.

 > $\mathrm{μ}:=\mathrm{evalf}\left(\mathrm{Mean}\left(R\right)\right)$
 ${\mathrm{μ}}{:=}{13.78645551}$ (1.1)
 > $\mathrm{σ}:=\mathrm{evalf}\left(\mathrm{StandardDeviation}\left(R\right)\right)$
 ${\mathrm{σ}}{:=}{5.281878335}$ (1.2)

Assuming that we do not know the population mean but we know the standard deviation of the population, test the hypothesis that this sample was drawn from a distribution with mean equal to 12.

 > $\mathrm{OneSampleZTest}\left(S,12,\mathrm{σ}\right):$
 Standard Z-Test on One Sample ----------------------------- Null Hypothesis: Sample drawn from population with mean 12 and known standard deviation 5.28188 Alt. Hypothesis: Sample drawn from population with mean not equal to 12 and known standard deviation 5.28188 Sample size:             100 Sample mean:             13.7517 Distribution:            Normal(0,1) Computed statistic:      3.31636 Computed pvalue:         0.000911977 Confidence interval:     12.71643272 .. 14.78689098                          (population mean) Result: [Rejected] There exists statistical evidence against the null hypothesis

Similarly, if we assume that the standard deviation is unknown, we can apply the one sample t-test on the same hypothesis - this time with a 90% confidence interval.

 > $\mathrm{OneSampleTTest}\left(S,12,\mathrm{confidence}=0.9\right):$
 Standard T-Test on One Sample ----------------------------- Null Hypothesis: Sample drawn from population with mean 12 Alt. Hypothesis: Sample drawn from population with mean not equal to 12 Sample size:             100 Sample mean:             13.7517 Sample standard dev.:    5.14945 Distribution:            StudentT(99) Computed statistic:      3.40165 Computed pvalue:         0.000967459 Confidence interval:     12.89665167 .. 14.60667203                          (population mean) Result: [Rejected] There exists statistical evidence against the null hypothesis