Student[Statistics] - Maple Programming Help

# Online Help

###### All Products    Maple    MapleSim

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

Student[Statistics]

 TwoSampleTTest
 apply the two sample t-test for population means

 Calling Sequence TwoSampleTTest(X1, X2, beta, confidence_option, output_option)

Parameters

 X1 - first data sample X2 - second data sample beta - realcons; the test value for the difference between the two means confidence_option - (optional) equation of the form confidence=float. output_option - (optional) equation of the form output=x where x is report, plot, or both

Description

 • The TwoSampleTTest function computes the two sample t-test upon datasets X1 and X2. This tests whether the population mean of X1 minus the population mean of X2 is equal to beta, under the assumption that both populations are normally distributed. No assumptions are made on the standard deviation.
 • The first parameter X1 is the first data sample to use in the analysis.
 • The second parameter X2 is the second data sample to use in the analysis.
 • The third parameter beta is the assumed difference in population means (assumed population mean of X1 minus the assumed population mean of X2), specified as a real constant.
 • confidence=float
 This option is used to specify the confidence level of the interval and must be a floating-point value between 0 and 1.  By default this is set to 0.95.
 • 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.

Notes

 • A stronger version of the t-test, the z-test is available if the standard deviation of the sample is known.
 • If data samples are paired data (collected as a pair of observations rather than as independent observations), the paired t-test may be used.

Examples

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

Specify the data sample.

 > $X≔\left[9,10,8,4,8,3,0,10,15,9\right]:$
 > $Y≔\left[6,3,10,11,9,8,13,4,4,4\right]:$
 > $\mathrm{Mean}\left(X\right)-\mathrm{Mean}\left(Y\right)$
 $\frac{{2}}{{5}}$ (1)

Calculate the two sample t-test on a list of values.

 > $\mathrm{TwoSampleTTest}\left(X,Y,0,\mathrm{confidence}=0.95\right)$
 Standard T-Test on Two Samples (Unequal Variances) ------------------------------------------------ Null Hypothesis: Sample drawn from populations with difference of means equal to 0 Alt. Hypothesis: Sample drawn from population with difference of means not equal to 0   Sample Sizes:            10, 10 Sample Means:            7.6, 7.2 Sample Standard Dev:     4.24788, 3.48967 Difference in Means:     0.4 Distribution:            StudentT(17.3463603321218) Computed Statistic:      .230089496654211 Computed p-value:        .820713744505649 Confidence Interval:     -3.26224630470081 .. 4.06224630470081                          (difference of population means)   Result: [Accepted] This statistical test does not provide enough evidence to conclude that the null hypothesis is false.
 $\left[{\mathrm{hypothesis}}{=}{\mathrm{true}}{,}{\mathrm{confidenceinterval}}{=}{-}{3.26224630470081}{..}{4.06224630470081}{,}{\mathrm{distribution}}{=}{\mathrm{StudentT}}{}\left({17.3463603321218}\right){,}{\mathrm{pvalue}}{=}{0.820713744505649}{,}{\mathrm{statistic}}{=}{0.230089496654211}\right]$ (2)

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

 > $\mathrm{TwoSampleTTest}\left(X,Y,0,\mathrm{confidence}=0.95,\mathrm{output}=\mathrm{plot}\right)$

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

 > $\mathrm{report},\mathrm{graph}≔\mathrm{TwoSampleTTest}\left(X,Y,0,\mathrm{confidence}=0.95,\mathrm{output}=\mathrm{both}\right):$
 Standard T-Test on Two Samples (Unequal Variances) ------------------------------------------------ Null Hypothesis: Sample drawn from populations with difference of means equal to 0 Alt. Hypothesis: Sample drawn from population with difference of means not equal to 0   Sample Sizes:            10, 10 Sample Means:            7.6, 7.2 Sample Standard Dev:     4.24788, 3.48967 Difference in Means:     0.4 Distribution:            StudentT(17.3463603321218) Computed Statistic:      .230089496654211 Computed p-value:        .820713744505649 Confidence Interval:     -3.26224630470081 .. 4.06224630470081                          (difference of population means)   Result: [Accepted] This statistical test does not provide enough evidence to conclude that the null hypothesis is false. Histogram Type:  default Data Range:      -4.94065645841247e-324 .. 15. Bin Width:       .5 Number of Bins:  30 Frequency Scale: relative Histogram Type:  default Data Range:      3. .. 13. Bin Width:       .333333333333333 Number of Bins:  30 Frequency Scale: relative
 > $\mathrm{report}$
 $\left[{\mathrm{hypothesis}}{=}{\mathrm{true}}{,}{\mathrm{confidenceinterval}}{=}{-}{3.26224630470081}{..}{4.06224630470081}{,}{\mathrm{distribution}}{=}{\mathrm{StudentT}}{}\left({17.3463603321218}\right){,}{\mathrm{pvalue}}{=}{0.820713744505649}{,}{\mathrm{statistic}}{=}{0.230089496654211}\right]$ (3)
 > $\mathrm{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][TwoSampleTTest] command was introduced in Maple 18.
 • For more information on Maple 18 changes, see Updates in Maple 18.

## Was this information helpful?

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