TwoSampleTTest Constructor

Definition

Namespace: Numerics.NET.Statistics.Tests
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.3

Overload List

TwoSampleTTest

Constructs a new unpaired TwoSampleTTest for the specified samples.
C#
public TwoSampleTTest()

Remarks

This constructor constructs a 'blank' two sample t test. The test is an unpaired test for equality of the means with a significance level of 0.95. The samples have to be set using the Sample1 and Sample1 properties before any of the test results are accessed.

TwoSampleTTest(Vector<Double>, Vector<Double>)

Constructs a new unpaired TwoSampleTTest for the specified vector.
C#
public TwoSampleTTest(
	Vector<double> sample1,
	Vector<double> sample2
)

Parameters

sample1  Vector<Double>
The first vector
sample2  Vector<Double>
The second vector

Remarks

This constructor constructs a t test for the assumption that the population means of two samples are equal. The test is unpaired, meaning that the samples are from two independent populations. No assumptions are made about the variances of the two populations.

Exceptions

ArgumentNullException

sample1 is null.

-or-

sample2 is null.

TwoSampleTTest(Vector<Double>, Vector<Double>, Double)

Constructs a new unpaired TwoSampleTTest for the specified samples.
C#
public TwoSampleTTest(
	Vector<double> sample1,
	Vector<double> sample2,
	double difference
)

Parameters

sample1  Vector<Double>
The first vector
sample2  Vector<Double>
The second vector
difference  Double
The difference between the means to test for.

Remarks

This constructor constructs a t test for the assumption that the difference between the population means of two samples is equal to difference. The test is unpaired, meaning that the samples are from two independent populations. No assumptions are made about the variances of the two populations.

Exceptions

ArgumentNullException

sample1 is null.

-or-

sample2 is null.

TwoSampleTTest(Vector<Double>, Vector<Double>, SamplePairing, Boolean)

Constructs a new TwoSampleTTest for the specified vector.
C#
public TwoSampleTTest(
	Vector<double> sample1,
	Vector<double> sample2,
	SamplePairing pairing,
	bool assumeEqualVariances
)

Parameters

sample1  Vector<Double>
The first vector
sample2  Vector<Double>
The second vector
pairing  SamplePairing
A SamplePairing value that specifies whether the test is paired or unpaired.
assumeEqualVariances  Boolean
Indicates whehter the variances of the two populations are assumed to be equal.

Remarks

This constructor constructs a t test for the assumption that the population means of two samples are equal. The pairing parameter specifies whether the test is paired or unpaired. The assumeEqualVariances indicates whether or not the variances of the two populations are assumed to be equal.

Exceptions

ArgumentNullException

sample1 is null.

-or-

sample2 is null.

TwoSampleTTest(Vector<Double>, Vector<Double>, Double, SamplePairing, Boolean, HypothesisType)

Constructs a new TwoSampleTTest for the specified vector.
C#
public TwoSampleTTest(
	Vector<double> sample1,
	Vector<double> sample2,
	double difference,
	SamplePairing pairing,
	bool assumeEqualVariances = true,
	HypothesisType type = HypothesisType.TwoTailed
)

Parameters

sample1  Vector<Double>
The first vector
sample2  Vector<Double>
The second vector
difference  Double
The difference between the means to test for.
pairing  SamplePairing
A SamplePairing value that specifies whether the test is paired or unpaired.
assumeEqualVariances  Boolean  (Optional)
Indicates whehter the variances of the two populations are assumed to be equal.
type  HypothesisType  (Optional)
A HypothesisType value that indicates whether the test is upper or lower one-tailed or two-tailed.

Remarks

This constructor constructs a t test for the assumption that the difference between the population means of two samples is equal to difference. The pairing parameter specifies whether the test is paired or unpaired. The assumeEqualVariances indicates whether or not the variances of the two populations are assumed to be equal.

Exceptions

DimensionMismatchException

pairing equals Paired and the length of sample1 is not equal to the length of sample2.

ArgumentNullException

sample1 is null.

-or-

sample2 is null.

TwoSampleTTest(Int32, Double, Double, Int32, Double, Double, Double, SamplePairing, Boolean, HypothesisType)

Constructs a new unpaired TwoSampleTTest for the specified samples.
C#
public TwoSampleTTest(
	int count1,
	double mean1,
	double variance1,
	int count2,
	double mean2,
	double variance2,
	double difference = 0,
	SamplePairing pairing = SamplePairing.Unpaired,
	bool assumeEqualVariances = true,
	HypothesisType type = HypothesisType.TwoTailed
)

Parameters

count1  Int32
The number of observations in the first sample.
mean1  Double
The mean of the first sample.
variance1  Double
The variance of the first sample.
count2  Int32
The number of observations in the second sample.
mean2  Double
The mean of the second sample.
variance2  Double
The variance of the second sample.
difference  Double  (Optional)
The proposed difference between the means.
pairing  SamplePairing  (Optional)
A SamplePairing value that specifies whether the test is paired or unpaired.
assumeEqualVariances  Boolean  (Optional)
Indicates whehter the variances of the two populations are assumed to be equal.
type  HypothesisType  (Optional)
A HypothesisType value that indicates whether the test is upper or lower one-tailed or two-tailed.

Exceptions

ArgumentOutOfRangeException

count1 is less than or equal to one.

-or

count2 is less than or equal to one.

-or

variance1 is less than or equal to zero.

-or

variance2 is less than or equal to zero.

See Also