Statistics[TwoSampleZTest] - apply the two sample z-test for population means
|
Calling Sequence
|
|
TwoSampleZTest(X1, X2, beta, sigma1, sigma2, options)
|
|
Parameters
|
|
X1
|
-
|
rtable; first data sample
|
X2
|
-
|
rtable; second data sample
|
beta
|
-
|
realcons; the test value for the difference between the two means
|
sigma1
|
-
|
realcons; the known standard deviation of the population of X1
|
sigma2
|
-
|
realcons; the known standard deviation of the population of X2
|
options
|
-
|
(optional) equation(s) of the form option=value where option is one of alternative, confidence, ignore, output, weights1 or weights2; specify options for the TwoSampleZTest function
|
|
|
|
|
Description
|
|
•
|
The TwoSampleZTest function computes the two sample z-test upon datasets X1 and X2. This calculation is used to determine the significance of the difference between sample means and an assumed difference in population means when the standard deviation of the populations is known.
|
•
|
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.
|
•
|
The fourth parameter sigma1 is the known standard deviation of the sample X1.
|
•
|
The fifth parameter sigma2 is the known standard deviation of the sample X2.
|
|
|
Options
|
|
|
The options argument can contain one or more of the options shown below.
|
•
|
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.
|
|
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.
|
|
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.
|
•
|
output='report', 'statistic', 'pvalue', 'confidenceinterv al', '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.
|
|
Vector of weights (one-dimensional rtable). If these weights are given, the TwoSampleZTest function will scale each data point in X1 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.
|
|
Vector of weights (one-dimensional rtable). This parameter is equivalent to the option weights1, except applying to data in X2.
|
|
|
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 weaker version of the z-test, the t-test is available if the standard deviation of the sample is unknown.
|
|
|
Examples
|
|
>
|
|
>
|
|
Specify the data sample.
>
|
|
>
|
|
>
|
|
| (1) |
Calculate the two sample z-test on an array of values, assuming a difference in means of 4.
>
|
|
Standard Z-Test on Two Samples
------------------------------
Null Hypothesis:
Sample drawn from populations with difference of means equal to 4
Alt. Hypothesis:
Sample drawn from population with difference of means not equal to 4
Sample sizes: 10, 10
Sample means: 7.6, 7.2
Difference in means: 0.4
Distribution: Normal(0,1)
Computed statistic: -2.27684
Computed pvalue: 0.0227958
Confidence interval: -2.69897516135683 .. 3.49897516135683
(difference of population means)
Result: [Rejected]
There exists statistical evidence against the null hypothesis
| |
| (2) |
Calculate the lower tail z-test.
>
|
|
Standard Z-Test on Two Samples
------------------------------
Null Hypothesis:
Sample drawn from populations with difference of means greater than 4
Alt. Hypothesis:
Sample drawn from population with difference of means less than 4
Sample sizes: 10, 10
Sample means: 7.6, 7.2
Difference in means: 0.4
Distribution: Normal(0,1)
Computed statistic: -2.27684
Computed pvalue: 0.0113979
Confidence interval: -infinity .. 3.00074193924035
(difference of population means)
Result: [Rejected]
There exists statistical evidence against the null hypothesis
| |
| (3) |
Calculate the upper tail z-test.
>
|
|
Standard Z-Test on Two Samples
------------------------------
Null Hypothesis:
Sample drawn from populations with difference of means less than 4
Alt. Hypothesis:
Sample drawn from population with difference of means greater than 4
Sample sizes: 10, 10
Sample means: 7.6, 7.2
Difference in means: 0.4
Distribution: Normal(0,1)
Computed statistic: -2.27684
Computed pvalue: 0.988602
Confidence interval: -2.20074193924035 .. infinity
(difference of population means)
Result: [Accepted]
There is no statistical evidence against the null hypothesis
| |
| (4) |
|
|
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.
|
|
|