ISmVarianceAnalysis.AnalysisType

Fore Syntax

AnalysisType: VarianceAnalysisType;

Fore.NET Syntax

AnalysisType: Prognoz.Platform.Interop.Stat.VarianceAnalysisType;

Description

The AnalysisType property determines the type of variance analysis.

Fore Example

To execute the example, add a link to the Stat system assembly.

Sub UserProc;
Var
    VA: ISmVarianceAnalysis;
    res: Integer;
    m: Array[53Of Double;
    SS: IVarianceAnalysisSumSquared;
    DF: IVarianceAnalysisDegreeOfFreedom;
    UE: IVarianceAnalysisUnbiasedEstimation;
    FS, FC, P: IVarianceAnalysisStatistics;
Begin
    VA := New SmVarianceAnalysis.Create;
    m[00] := 1; m[01] := 4; m[02] := 1;
    m[10] := 2; m[11] := 3; m[12] := 2;
    m[20] := 3; m[21] := 3; m[22] := 1;
    m[30] := 4; m[31] := 1; m[32] := 2;
    m[40] := 5; m[41] := 1; m[42] := 1;
    VA.Data := m;
    VA.AnalysisType := VarianceAnalysisType.SingleFactor; //single-factor analysis
    VA.ConfidenceLevel := 0.05;
    res := VA.Execute;
    If res <> 0 Then
        Debug.WriteLine(VA.Errors);
    Else
        Debug.WriteLine("Results: ");
        Debug.WriteLine("Sum of deviation squares");
        SS := VA.SumSquared;
        Debug.Indent;
        Debug.WriteLine("between groups: " + SS.BetweenGroup.ToString);
        Debug.WriteLine("within a group: " + SS.WithinGroup.ToString);
        Debug.WriteLine("total: " + SS.Total.ToString);
        Debug.Unindent;
        Debug.WriteLine("Number of degrees of freedom");
        DF := VA.DegreeOfFreedom;
        Debug.Indent;
        Debug.WriteLine("between groups: " + DF.BetweenGroup.ToString);
        Debug.WriteLine("within a group: " + DF.WithinGroup.ToString);
        Debug.WriteLine("total: " + DF.Total.ToString);
        Debug.Unindent;
        Debug.WriteLine("Unbiased estimate of sum of deviation squares");
        UE := VA.UnbiasedEstimation;
        Debug.Indent;
        Debug.WriteLine("between groups: " + UE.BetweenGroup.ToString);
        Debug.WriteLine("within groups: " + UE.WithinGroup.ToString);
        Debug.Unindent;
        Debug.WriteLine("Value of Fisher statistics ");
        FS := VA.FisherStatistics;
        Debug.WriteLine(FS.OneFactorAnalysis.ToString);
        Debug.WriteLine("Critical value of Fisher statistics ");
        FC := VA.FisherCritical;
        Debug.WriteLine(FC.OneFactorAnalysis.ToString);
        Debug.WriteLine("Probability ");
        P := VA.Probability;
        Debug.WriteLine(P.OneFactorAnalysis.ToString);
        If VA.VarianceEqualByRows Then
            Debug.WriteLine("Fstat < Fcrit. Hypothesis on equal group averages is accepted");
        Else
            Debug.WriteLine("Fstat > Fcrit. Hypothesis on equal group averages is rejected");
        End If;
    End If;
End Sub UserProc;

Executing the example displays the results of the variance analysis in the console window:

Sum of deviation squares

    between groups: 0,266666666666667

    within groups: 24,6666666666667

   sum: 24,9333333333333

Number of degrees of freedom

    between groups: 4

    within groups: 10

    sum: 14

Unbiased estimated sum of deviation squares

    between groups: 0,0666666666666667

    within groups: 2,46666666666667

Fisher statistics value: 0,027027027027027

Fisher statistics critical value: 3,47804969076512

Probability: 0,99833254475293

Fstat < Fcrit. Hypothesis on the equality of group means is accepted.

Fore.NET Example

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
    VA: ISmVarianceAnalysis;
    res: Integer;
    m: Array[53Of Double;
    SS: IVarianceAnalysisSumSquared;
    DF: IVarianceAnalysisDegreeOfFreedom;
    UE: IVarianceAnalysisUnbiasedEstimation;
    FS, FC, P: IVarianceAnalysisStatistics;
Begin
    VA := New SmVarianceAnalysis.Create();
    m[00] := 1; m[01] := 4; m[02] := 1;
    m[10] := 2; m[11] := 3; m[12] := 2;
    m[20] := 3; m[21] := 3; m[22] := 1;
    m[30] := 4; m[31] := 1; m[32] := 2;
    m[40] := 5; m[41] := 1; m[42] := 1;
    VA.Data := m;
    VA.AnalysisType := VarianceAnalysisType.SingleFactor; //single-factor analysis
    VA.ConfidenceLevel := 0.05;
    res := VA.Execute();
    If res <> 0 Then
        System.Diagnostics.Debug.WriteLine(VA.Errors);
    Else
        System.Diagnostics.Debug.WriteLine("Results: ");
        System.Diagnostics.Debug.WriteLine("Sum of deviation squares");
        SS := VA.SumSquared;
        System.Diagnostics.Debug.Indent();
        System.Diagnostics.Debug.WriteLine("between groups: " + SS.BetweenGroup.ToString);
        System.Diagnostics.Debug.WriteLine("within groups: " + SS.BetweenGroup.ToString);
        System.Diagnostics.Debug.WriteLine("sum: " + SS.Total.ToString());
        System.Diagnostics.Debug.Unindent();
        System.Diagnostics.Debug.WriteLine("Number of degrees of freedom");
        DF := VA.DegreeOfFreedom;
        System.Diagnostics.Debug.Indent();
        System.Diagnostics.Debug.WriteLine("between groups: " + SS.BetweenGroup.ToString());
        System.Diagnostics.Debug.WriteLine("within groups: " + SS.BetweenGroup.ToString());
        System.Diagnostics.Debug.WriteLine("sum: " + DF.Total.ToString());
        System.Diagnostics.Debug.Unindent();
        System.Diagnostics.Debug.WriteLine("Unbiased estimate of sum of deviation squares");
        UE := VA.UnbiasedEstimation;
        System.Diagnostics.Debug.Indent();
        System.Diagnostics.Debug.WriteLine("between groups: " + UE.BetweenGroup.ToString());
        System.Diagnostics.Debug.WriteLine("within groups: " + UE.BetweenGroup.ToString());
        System.Diagnostics.Debug.Unindent();
        System.Diagnostics.Debug.Write("Value of Fisher statistics ");
        FS := VA.FisherStatistics;
        System.Diagnostics.Debug.WriteLine(FS.OneFactorAnalysis.ToString());
        System.Diagnostics.Debug.Write("Critical value of Fisher statistics ");
        FC := VA.FisherCritical;
        System.Diagnostics.Debug.WriteLine(FC.OneFactorAnalysis.ToString());
        System.Diagnostics.Debug.Write("Probability: ");
        P := VA.Probability;
        System.Diagnostics.Debug.WriteLine(P.OneFactorAnalysis.ToString());
        If VA.VarianceEqualByRows Then
            Debug.WriteLine("Fstat < Fcrit. Hypothesis on equal group averages is accepted");
        Else
            System.Diagnostics.Debug.WriteLine("Fstat > Fcrit. Hypothesis on equal group averages is rejected");
        End If;
    End If;
End Sub;

See also:

ISmVarianceAnalysis