TTest(A1: Array; A2: Array; Tails: Integer; Type: Integer): Double;
TTest(A1: System.Array; A2: System.Array; Tails: integer; Type: integer): double;
A1. First data series.
A2. Second data series.
Tails. Number of distribution tails.
Type. Type of executable t-test.
The TTest method returns the probability for the Student's criterion.
This function is used to determine the probability for two samples to be taken from universal sets with the same mean value.
Available Values of the Tails parameter:
1. The TTest function uses single-sided distribution.
2.The TTest function uses double-sided distribution.
Available Values of the Type parameter:
1. Paired.
2. Two-sample with equal variances (homoscedastic).
3. Two-sample with unequal variances (heteroscedastic).
For correct calculation the A1 and A2 series:
Must have equal number of points if the paired t-test is used, that is, Type = 1.
Should be non-constant.
To execute the example, add a link to the Stat system assembly.
Sub UserProc;
Var
st: Statistics;
d0: Double;
x, y: Array Of Double;
Begin
y := New Double[10];
y[00] := 1.6; y[05] := 2.1;
y[01] := 1.7; y[06] := 2.2;
y[02] := 1.8; y[07] := 2.3;
y[03] := 1.9; y[08] := 2.4;
y[04] := 2; y[09] := 2.8;
x := New Double[10];
x[00] := 2; x[05] := 6;
x[01] := 4; x[06] := 15;
x[02] := 2; x[07] := 17;
x[03] := 5; x[08] := 14;
x[04] := 12; x[09] := 3;
st := New Statistics.Create;
d0 := st.TTest(y, x, 2, 1);
If st.Status <> 0 Then
Debug.WriteLine(st.Errors);
Else
Debug.WriteLine("Probability: " + d0.ToString);
End If;
End Sub UserProc;
After executing the example the console window displays the probability corresponding to the paired Student's criterion with double-sided distribution.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Stat;
…
Public Shared Sub Main(Params: StartParams);
Var
st: Statistics;
d0: Double;
x, y: Array Of Double;
Begin
y := New Double[10];
y[00] := 1.6; y[05] := 2.1;
y[01] := 1.7; y[06] := 2.2;
y[02] := 1.8; y[07] := 2.3;
y[03] := 1.9; y[08] := 2.4;
y[04] := 2; y[09] := 2.8;
x := New Double[10];
x[00] := 2; x[05] := 6;
x[01] := 4; x[06] := 15;
x[02] := 2; x[07] := 17;
x[03] := 5; x[08] := 14;
x[04] := 12; x[09] := 3;
st := New Statistics.Create();
d0 := st.TTest(y, x, 2, 1);
If st.Status <> 0 Then
System.Diagnostics.Debug.WriteLine(st.Errors);
Else
System.Diagnostics.Debug.WriteLine("Probability: " + d0.ToString());
End If;
End Sub;
See also: