Overload List
| # | Signature | Description |
|---|---|---|
| 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. |
| 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. |
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.
| # | Name | Description |
|---|---|---|
| 1 | Data1 | First set of data from which to compute the mean. |
| 2 | Data2 | Second set of data from which to compute the mean. |
| 3 | hRes | Returns the result of the null hypothesis (default assumption is that the means are equal). |
| 4 | hType | Defines the type of the null hypothesis (left, right and two - tailed). |
| 5 | Paired | If true, tTest routine will perform Two-Sample Paired t-Test. If false, tTest will perform Two-Sample Pooled (unpaired) t-Test. |
| 6 | Signif | (Significance level) returns the probability of observing the given result by chance given that the null hypothesis is true. |
| 7 | ConfInt | Returns the 100*(1-Alpha) percent confidence interval for the mean. |
| 8 | Alpha | Defines 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.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Data | TVec | source TVec |
| 2 | Mean | Double | scalar |
| 3 | hRes | THypothesisResult (ref) | |
| 4 | Signif | Double (ref) | output |
| 5 | ConfInt | Double[] (ref) | |
| 6 | hType | THypothesisType | |
| 7 | Alpha | Double | scalar |
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.