IMSL C# Numerical Library

NormTwoSample Class

Computes statistics for mean and variance inferences using samples from two normal populations.

For a list of all members of this type, see NormTwoSample Members.

System.Object
   Imsl.Stat.NormTwoSample

public class NormTwoSample

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

Class NormTwoSample computes statistics for making inferences about the means and variances of two normal populations, using independent samples in x1 and x2. For inferences concerning parameters of a single normal population, see class NormOneSample.

Let \mu_1 and \sigma _1^2 be the mean and variance of the first population, and let \mu_2 and \sigma _2^2 be the corresponding quantities of the second population. The function contains test confidence intervals for difference in means, equality of variances, and the pooled variance.

The means and variances for the two samples are as follows:

\bar x_1  = \left( {\sum {x_{1i} /n_1 } } 
            \right), \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\, \bar x_2  = \left( 
            {\sum {x_{2i} } } \right)/n_2

and

s_1^2  = \sum {\left( {x_{1i}  - \bar x_1 } 
            \right)} ^2 /\left( {n_1  - 1} \right), \,\,\,\,\,\,\,\,\,\,\,s_2^2  = 
            \sum {\left( {x_{2i}  - {\bar x}_2} \right)} ^2 /\left( {n_2  - 1} 
            \right)

Inferences about the Means

The test that the difference in means equals a certain value, for example, \mu_0, depends on whether or not the variances of the two populations can be considered equal. If the variances are equal and meanHypothesis equals 0, the test is the two-sample t-test, which is equivalent to an analysis-of-variance test. The pooled variance for the difference-in-means test is as follows:

s^2  = \frac{{\left( {n_1  - 1} \right)s_1  + 
            \left( {n_2  - 1} \right)s_2 }} {{n_1  + n_2  - 2}}

The t statistic is as follows:

t = \frac{{\bar x_1  - \bar x_2  - \mu _0 }} 
            {s\sqrt {{\left( {1/n_1 } \right)} + \left( {1/n_2 } \right)}}

Also, the confidence interval for the difference in means can be obtained by first assigning the unequal variances flag to false. This can be done by setting the UnequalVariances property. The confidence interval can then be obtained by the LowerCIDiff and UpperCIDiff properties.

If the population variances are not equal, the ordinary t statistic does not have a t distribution and several approximate tests for the equality of means have been proposed. (See, for example, Anderson and Bancroft 1952, and Kendall and Stuart 1979.) One of the earliest tests devised for this situation is the Fisher-Behrens test, based on Fisher's concept of fiducial probability. A procedure used in the TTest, LowerCIDiff and UpperCIDiff properties assuming unequal variances are specified is the Satterthwaite's procedure, as suggested by H.F. Smith and modified by F.E. Satterthwaite (Anderson and Bancroft 1952, p. 83). Set UnequalVariances true to obtain results assuming unequal variances.

The test statistic is

t' = \left( {\bar x_1  - \bar x_2  - \mu _0 } 
            \right)/s_d

where

s_d  = \sqrt {\left( {s_1^2 /n_1 } \right) + 
            \left( {s_2^2 /n_2 } \right)}

Under the null hypothesis of \mu_1- \mu_2= c, this quantity has an approximate t distribution with degrees of freedom df, given by the following equation:

{\rm{df}} = \frac{{s_d^4 }}{{\frac{{\left( 
            {s_1^2 /n_1 } \right)^2 }}{{n_1  - 1}} + \frac{{\left( {s_2^2 /n_2 } 
            \right)^2 }}{{n_2  - 1}}}}

Inferences about Variances

The F statistic for testing the equality of variances is given by F = s_{\max }^2 /s_{\min }^2, where s_{\max}^2 is the larger of s_1^2 and s_2^2. If the variances are equal, this quantity has an F distribution with n_1 - 1 and n_2 - 1 degrees of freedom.

It is generally not recommended that the results of the F test be used to decide whether to use the regular t-test or the modified t' on a single set of data. The modified t' (Satterthwaite's procedure) is the more conservative approach to use if there is doubt about the equality of the variances.

Requirements

Namespace: Imsl.Stat

Assembly: ImslCS (in ImslCS.dll)

See Also

NormTwoSample Members | Imsl.Stat Namespace | Example