Statistics.tTest Method

Overload List

#SignatureDescription
1Double tTest(TVec Data1, TVec Data2, ref THypothesisResult hRes, ref Double Signif, ref Double[] ConfInt, Boolean Paired, THypothesisType hType, Double Alpha)Performs the two sample pooled or paired t-test.
2Double tTest(TVec Data, Double Mean, ref THypothesisResult hRes, ref Double Signif, ref Double[] ConfInt, THypothesisType hType, Double Alpha)One or two sample paired or pooled T-test.

Overload 1: Double tTest(TVec Data1, TVec Data2, ref THypothesisResult hRes, ref Double Signif, ref Double[] ConfInt, Boolean Paired, THypothesisType hType, Double Alpha)

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.

Examples
using Dew.Math;
using Dew.Stats;
using Dew.Stats.Units;
namespace Dew.Examples
{
    private void Example()
    {
        Vector d1 = new Vector(0);
        Vector d2 = new Vector(0);
        d1.SetIt(false, new double[] {2, 3, 5, 2.5}); // mean = 3.125
        d2.SetIt(false, new double[] {5, 7, 8}); // mean = 6.6666666667
        double signif, TStat;
        double[] ci = new double[2];
        THypothesisResult hres;
        // don't use normal approximation
        TStat = Statistics.tTest(d1,d2,out hres,out signif,out ci,false,THypothesisType.htLeftTailed,0.05);
        // signif = 0.01070092300; hres = hrReject;
        // ci=[ -5.702239060933, +INF  ]
        // Comment : Since the signif 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
    }
}
See Also: Statistics.ZTest

Overload 2: Double tTest(TVec Data, Double Mean, ref THypothesisResult hRes, ref Double Signif, ref Double[] ConfInt, THypothesisType hType, Double Alpha)

One or two sample paired or pooled T-test.

#NameTypeDescription
1DataTVecsource TVec
2MeanDoublescalar
3hResTHypothesisResult (ref)
4SignifDouble (ref)output
5ConfIntDouble[] (ref)
6hTypeTHypothesisType
7AlphaDoublescalar

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.