OneFactorAnalysis: Double;
The OneFactorAnalysis property returns the value for the univariate analysis.
Sub Main;
Var
VA: ISmVarianceAnalysis;
res: Integer;
m: Array Of Double;
FS, FC, P: IVarianceAnalysisStatistics;
Begin
VA := New SmVarianceAnalysis.Create;
m := New Double[5, 3];
m[0, 0] := 1; m[0, 1] := 4; m[0, 2] := 1;
m[1, 0] := 2; m[1, 1] := 3; m[1, 2] := 2;
m[2, 0] := 3; m[2, 1] := 3; m[2, 2] := 1;
m[3, 0] := 4; m[3, 1] := 1; m[3, 2] := 2;
m[4, 0] := 5; m[4, 1] := 1; m[4, 2] := 1;
VA.Data := m;
VA.AnalysisType := VarianceAnalysisType.SingleFactor; //univariate analysis
VA.ConfidenceLevel := 0.05;
res := VA.Execute;
If res <> 0 Then
Debug.WriteLine(VA.Errors);
Else
Debug.WriteLine("Fisher statistics value");
FS := VA.FisherStatistics;
Debug.WriteLine(FS.OneFactorAnalysis.ToString);
Debug.WriteLine("=================================");
Debug.WriteLine("Fisher statistics critical value");
FC := VA.FisherCritical;
Debug.WriteLine(FC.OneFactorAnalysis.ToString);
Debug.WriteLine("=================================");
Debug.WriteLine("Probability");
P := VA.Probability;
Debug.WriteLine(P.OneFactorAnalysis.ToString);
Debug.WriteLine("=================================");
If VA.VarianceEqualByRows Then
Debug.WriteLine("Fstat < Fcrit. Hypothesis on the equality of group means is accepted");
Else
Debug.WriteLine("Fstat > Fcrit. Hypothesis on the equality of group means is rejected");
End If;
End If;
End Sub Main;
Executing the example displays the results of the variance analysis in the console window:
Module execution started
Fisher statistics value
2.1304347826086967
=================================
Fisher statistics critical value
3.885293421631387
=================================
Probability
0.16151946937427927
=================================
Fstat < Fcrit. Hypothesis on the equality of group means is accepted
Module execution finished
See also: