apply the one sample t-test for the population mean of a sample - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Statistics : Statistics Package : Tests : Statistics/OneSampleTTest

Statistics[OneSampleTTest] - apply the one sample t-test for the population mean of a sample

Calling Sequence

OneSampleTTest(X, mu0, test_options)

OneSampleTTest[SampleSize](width, sigma, samplesize_options)

Parameters

X

-

data sample

mu0

-

realcons; the test value for the mean

test_options

-

(optional) equation(s) of the form option=value where option is one of confidence, output, alternative, ignore or weights; specify options for the OneSampleTTest function

width

-

realcons; the desired width of the confidence interval

sigma

-

realcons; a worst-case estimate on the value of the standard deviation

samplesize_options

-

(optional) equation(s) of the form option=value where option is one of confidence or iterations; specify options for the OneSampleTTest[SampleSize] utility function

Description

• 

The OneSampleTTest function computes the one sample t-test on a dataset X.  This calculation is used to determine the significance of the difference between the sample mean and an assumed population mean when the standard deviation of the population is unknown.

• 

The first parameter X is the data sample to use in the analysis.

• 

The second parameter mu0 is the assumed population mean, specified as a real constant.

• 

The OneSampleTTest[SampleSize] utility computes the number of samples required in a data set in order to get a confidence interval with the specified width using this test.

• 

The first parameter of the utility, width, specifies the desired width of the confidence interval (difference between the upper bound and the lower bound).  This value must be strictly greater than 0.

• 

The second parameter of the utility, sigma, specifies a worst-case estimate on the standard deviation of the sample size.

Test Options

  

The test_options argument can contain one or more of the options shown below.

• 

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.

• 

output='report', 'statistic', 'pvalue', 'confidenceinterval', 'distribution', 'hypothesis', or list('statistic', 'pvalue', 'confidenceinterval', 'distribution', 'hypothesis')

  

This option is used to specify the desired format of the output from the function.  If 'report' is specified then a module containing all output from this test is returned.  If a single parameter name is specified other than 'report' then that quantity alone is returned.  If a list of parameter names is specified then a list containing those quantities in the specified order will be returned.

• 

alternative='twotailed', 'lowertail', or 'uppertail'

  

This option is used to specify the type or interval used in the analysis, or similarly, the alternative hypothesis to consider when performing the analysis.

• 

weights=rtable

  

Vector of weights (one-dimensional rtable). If weights are given, the OneSampleTTest function will scale each data point to have given weight. Note that the weights provided must have type realcons and the results are floating-point, even if the problem is specified with exact values. Both the data array and the weights array must have the same number of elements.

• 

ignore=truefalse

  

This option is used to specify how to handle non-numeric data. If ignore is set to true all non-numeric items in data will be ignored.

Sample Size Options

  

The samplesize_options argument can contain one or more of the options shown below.

• 

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.

• 

iterations=posint -- This option specifies the maximum number of iterations to process when attempting to calculate the number of samples required.  By default this is set to 100.

Notes

• 

This test generates a complete report of all calculations in the form of a userinfo message. In order to access this report, specify infolevel[Statistics] := 1.

• 

A stronger version of the t-test, the z-test is available if the standard deviation of the sample is known.

Examples

withStatistics:

infolevel[Statistics]:=1:

Specify the data sample.

X:=Array9,10,8,4,8,3,0,10,15,9:

MeanX

7.60000000000000

(1)

Calculate the one sample t-test on an array of values.

OneSampleTTestX,5,confidence=0.95

Standard T-Test on One Sample
-----------------------------
Null Hypothesis:
Sample drawn from population with mean 5
Alt. Hypothesis:
Sample drawn from population with mean not equal to 5

Sample size:             10
Sample mean:             7.6
Sample standard dev.:    4.24788
Distribution:            StudentT(9)
Computed statistic:      1.93554
Computed pvalue:         0.0849151
Confidence interval:     4.56125385050882 .. 10.6387461494912
                         (population mean)

Result: [Accepted]
This statistical test does not provide enough evidence to conclude that the null hypothesis is false

hypothesis=true,confidenceinterval=4.56125385050882..10.6387461494912,distribution=StudentT9,pvalue=0.0849150812591391,statistic=1.93553750124331

(2)

Calculate the lower tail t-test.

OneSampleTTestX,5,confidence=0.95,alternative='lowertail'

Standard T-Test on One Sample
-----------------------------
Null Hypothesis:
Sample drawn from population with mean greater than 5
Alt. Hypothesis:
Sample drawn from population with mean less than 5

Sample size:             10
Sample mean:             7.6
Sample standard dev.:    4.24788
Distribution:            StudentT(9)
Computed statistic:      1.93554
Computed pvalue:         0.957542
Confidence interval:     -infinity .. 10.0624132658958
                         (population mean)

Result: [Accepted]
This statistical test does not provide enough evidence to conclude that the null hypothesis is false

hypothesis=true,confidenceinterval=∞..10.0624132658958,distribution=StudentT9,pvalue=0.957542459363412,statistic=1.93553750114025

(3)

Calculate the upper tail t-test.

OneSampleTTestX,5,confidence=0.95,alternative='uppertail'

Standard T-Test on One Sample
-----------------------------
Null Hypothesis:
Sample drawn from population with mean less than 5
Alt. Hypothesis:
Sample drawn from population with mean greater than 5

Sample size:             10
Sample mean:             7.6
Sample standard dev.:    4.24788
Distribution:            StudentT(9)
Computed statistic:      1.93554
Computed pvalue:         0.0424575
Confidence interval:     5.1375867341042 .. infinity
                         (population mean)

Result: [Rejected]
This statistical test provides evidence that the null hypothesis is false

hypothesis=false,confidenceinterval=5.13758673410420..∞,distribution=StudentT9,pvalue=0.0424575406365881,statistic=1.93553750114025

(4)

Calculate the number of samples required to produce a confidence interval of width 3, given a worst case standard deviation of 5.

OneSampleTTestSampleSize3,5

46

(5)

See Also

Statistics, Statistics[Computation], Statistics[Tests][TwoSamplePairedTTest], Statistics[Tests][TwoSampleTTest]

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.


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