Statistics.tTest Method

Overload List

#SignatureDescription
1function tTest(const Data1: TVec; const Data2: TVec; out hRes: THypothesisResult; out Signif: Double; var ConfInt: TDoubleArray; Paired: Boolean; hType: THypothesisType; Alpha: Double): Double;Performs the two sample pooled or paired t-test.
2function tTest(const Data: TVec; Mean: Double; out hRes: THypothesisResult; out Signif: Double; var ConfInt: TDoubleArray; const hType: THypothesisType; const Alpha: Double): Double;One or two sample paired or pooled T-test.

Overload 1: function tTest(const Data1: TVec; const Data2: TVec; out hRes: THypothesisResult; out Signif: Double; var ConfInt: TDoubleArray; Paired: Boolean; hType: THypothesisType; Alpha: Double): Double;

Performs the two sample pooled or paired t-test.

#NameDescription
1Data1First set of data from which to compute the mean.
2Data2Second set of data from which to compute the mean.
3hResReturns the result of the null hypothesis (default assumption is that the means are equal).
4hTypeDefines the type of the null hypothesis (left, right and two - tailed).
5PairedIf true, tTest routine will perform Two-Sample Paired t-Test. If false, tTest will perform Two-Sample Pooled (unpaired) t-Test.
6Signif(Significance level) returns the probability of observing the given result by chance given that the null hypothesis is true.
7ConfIntReturns the 100*(1-Alpha) percent confidence interval for the mean.
8AlphaDefines the desired significance level. If the significance probability (Signif) is bellow the desired significance (Alpha), the null hypothesis is rejected.

Returns: Double - The T-test statistics.

Remarks:

It compares Data1 mean value with Data2 mean value. The assumption is Data1 and Data2 variances are equal, but unknown. The null hypothesis is that Data1 mean is equal to Data2 mean.

See Also: Statistics.ZTest

Overload 2: function tTest(const Data: TVec; Mean: Double; out hRes: THypothesisResult; out Signif: Double; var ConfInt: TDoubleArray; const hType: THypothesisType; const Alpha: Double): Double;

One or two sample paired or pooled T-test.

#NameTypeDescription
1DataTVec
2MeanDoublescalar
3hResTHypothesisResult
4SignifDouble
5ConfIntTDoubleArray
6hTypeTHypothesisType
7AlphaDouble

Returns: Double

Remarks:

Performs the one sample T-test. It compares Data mean value with the Mean. The null hypothesis is that Data mean value is equal to the Mean.

Examples
Uses Math387, MtxExpr, Statistics;
procedure Example;
var d1,d2: Vector;
Signif  : double;
HypRes  : THypothesisResult;
MeanCI : TTwoElmReal;
begin
    d1.SetIt(false,[2, 3, 5, 2.5]); // mean = 3.125
    d2.SetIt([5, 7, 8]); // mean = 6.6666666667
    tTest(d1,d2, HypRes, Signif, MeanCI, false, htLeftTailed);
    // Signif = 0.01070092300; HypRes = hrReject;
    // MeanCI=[ -5.702239060933, +INF  ]
    // Comment : Since the signf is smaller than Alpha (0.05), the
    // null hypothesis (H0) that data means are equal is rejected and
    // the alternative (Ha) that d1 mean is smaller than d2 mean
    // CANNOT be rejected
end;