ISmBreuschPaganGodfreyTest.FStatistic

Fore Syntax

FStatistic: ISpecificationTestStatistic;

Fore.NET Syntax

FStatistic: Prognoz.Platform.Interop.Stat.ISpecificationTestStatistic;

Description

The FStatistic property returns Fisher statistics value.

Comments

To get Engle statistics value, use the ISmBreuschPaganGodfreyTest.ObsR2 property.

Fore Example

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

Sub UserProc;
Var
    BPG: SmBreuschPaganGodfreyTest;
    SESS: ISpecificationTestStatistic;
    ModelCoef: ICoefficients;
    can, fra, ger: Array[10Of Double;
    i, res: Integer;
Begin
    BPG := New SmBreuschPaganGodfreyTest.Create;
    // Set values of variables   
    Can[0] := 6209; fra[0] := 4110; ger[0] := 3415;
    Can[1] := 6385; fra[1] := 4280; ger[1] := 3673;
    Can[2] := Double.Nan; fra[2] := 4459; ger[2] := 4013;
    Can[3] := 6837; fra[3] := 4545; ger[3] := 4278;
    Can[4] := 6495; fra[4] := 4664; ger[4] := 4577;
    Can[5] := 6907; fra[5] := 4861; ger[5] := 5135;
    Can[6] := 7349; fra[6] := 5195; ger[6] := 5388;
    Can[7] := 7213; fra[7] := 5389; ger[7] := 5610;
    Can[8] := 7061; fra[8] := 5463; ger[8] := 5787;
    Can[9] := 7180; fra[9] := 5610; ger[9] := 6181;
    // Explained data series
    BPG.Explained.Value := can;
    // Explanatory series
    BPG.Explanatories.Clear;
    BPG.Explanatories.Add.Value := fra;
    // Explanatory series for auxiliary regression
    BPG.AdditionalExplanatories.Clear;
    BPG.AdditionalExplanatories.Add.Value := ger;
    //Estimation of constant
    BPG.ModelCoefficients.Intercept.Mode := InterceptMode.AutoEstimate;
    // Set orders of autoregression and moving average
    BPG.ARMA.ParseAR("3");
    BPG.ARMA.ParseMA("2");
    // Method of missing data treatment
    BPG.MissingData.Method := MissingDataMethod.LinTrend;
    // Sample period
    BPG.ModelPeriod.FirstPoint := 1;
    BPG.ModelPeriod.LastPoint := 10;
    res := bpg.Execute;
    For i := 0 To BPG.WarningsCount - 1 Do
        Debug.WriteLine(BPG.Warnings[i]);
    End For;
    SESS := BPG.ScaledExplainedSS;
    ModelCoef := BPG.ModelCoefficients.Coefficients;
    Debug.WriteLine("The Fisher statistics: ");
    Debug.Indent;
    Debug.WriteLine("Statistics value: " + BPG.FStatistic.Statistic.ToString);
    Debug.WriteLine("Probability value: " + BPG.FStatistic.Probability.ToString);
    Debug.Unindent;
    Debug.WriteLine("The Engle statistics: ");
    Debug.Indent;
    Debug.WriteLine("Statistics value: " + BPG.ObsR2.Statistic.ToString);
    Debug.WriteLine("Probability value: " + BPG.ObsR2.Probability.ToString);
    Debug.Unindent;
    Debug.WriteLine("Statistics of adjusted error of regression: ");
    Debug.Indent;
    Debug.WriteLine("Statistics value: " + SESS.Statistic.ToString);
    Debug.WriteLine("Probability value: " + SESS.Probability.ToString);
    Debug.Unindent;
    Debug.WriteLine("===Auxiliary regression===");
    Debug.WriteLine("Estimates of auxiliary regression coefficients");
    Debug.Indent;
    Debug.WriteLine(BPG.ModelCoefficients.Intercept.Estimate.ToString + " " +
        BPG.ModelCoefficients.Intercept.StandardError.ToString + " " +
        BPG.ModelCoefficients.Intercept.TStatistic.ToString + " " +
        BPG.ModelCoefficients.Intercept.Probability.ToString);
    For i := 0 To BPG.ModelCoefficients.Coefficients.Estimate.Length - 1 Do
        Debug.WriteLine("Estimated values of cofficients: " + ModelCoef.Estimate[i].ToString);
        Debug.WriteLine("Standard errors of coefficients: " + ModelCoef.StandardError[i].ToString);
        Debug.WriteLine("t-statistics of coefficients: " + ModelCoef.TStatistic[i].ToString);
        Debug.WriteLine("Probabilities of coefficients: " + ModelCoef.Probability[i].ToString);
    End For;
    Debug.Unindent;
    Debug.WriteLine("Characteristics of auxiliary regression");
    Debug.Indent;
    Debug.WriteLine("Determination coefficient: " + BPG.SummaryStatistics.R2.ToString);
    Debug.WriteLine("Adjusted determination coefficient: " + BPG.SummaryStatistics.AdjR2.ToString);
    Debug.WriteLine("Standard regression error: " + BPG.SummaryStatistics.SE.ToString);
    Debug.WriteLine("Sum of residuals squares: " + BPG.SummaryStatistics.SSR.ToString);
    Debug.WriteLine("Durbin-Watson statistic: " + BPG.SummaryStatistics.DW.ToString);
    Debug.Unindent;
    Debug.WriteLine("Model series of auxiliary regression");
    Debug.Indent;
    For i := 0 To BPG.Fitted.Length - 1 Do
        Debug.Write(i.ToString + " ");
        Debug.WriteLine(BPG.Fitted[i]);
    End For;
    Debug.Unindent;
    Debug.WriteLine("Residuals series of auxiliary regression");
    Debug.Indent;
    For i := 0 To BPG.Residuals.Length - 1 Do
        Debug.Write(i.ToString + " ");
        Debug.WriteLine(BPG.Residuals[i]);
    End For;
    Debug.Unindent;
End Sub UserProc;

After executing the example the console window displays calculation results of the Breusch-Pagan-Godfrey test for heteroscedasticity.

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
    BPG: SmBreuschPaganGodfreyTest;
    SESS: ISpecificationTestStatistic;
    can, fra, ger: Array[10Of double;
    Warnings, Fitted, Residuals, d: System.Array;
    ModelCoef: ICoefficients;
    i, res: integer;
Begin
    BPG := New SmBreuschPaganGodfreyTestClass.Create();
    // Set values of variables   
    Can[0] := 6209; fra[0] := 4110; ger[0] := 3415;
    Can[1] := 6385; fra[1] := 4280; ger[1] := 3673;
    Can[2] := Double.Nan; fra[2] := 4459; ger[2] := 4013;
    Can[3] := 6837; fra[3] := 4545; ger[3] := 4278;
    Can[4] := 6495; fra[4] := 4664; ger[4] := 4577;
    Can[5] := 6907; fra[5] := 4861; ger[5] := 5135;
    Can[6] := 7349; fra[6] := 5195; ger[6] := 5388;
    Can[7] := 7213; fra[7] := 5389; ger[7] := 5610;
    Can[8] := 7061; fra[8] := 5463; ger[8] := 5787;
    Can[9] := 7180; fra[9] := 5610; ger[9] := 6181;
    // Explained data series
    BPG.Explained.Value := can;
    // Explanatory series
    BPG.Explanatories.Clear();
    BPG.Explanatories.Add().Value := fra;
    // Explanatory series for auxiliary regression
    BPG.AdditionalExplanatories.Clear();
    BPG.AdditionalExplanatories.Add().Value := ger;
    //Estimation of constant
    BPG.ModelCoefficients.Intercept.Mode := InterceptMode.imAutoEstimate;
    // Set orders of autoregression and moving average
    BPG.ARMA.ParseAR("3"True);
    BPG.ARMA.ParseMA("2"True);
    // Method of missing data treatment
    BPG.MissingData.Method := MissingDataMethod.mdmLinTrend;
    // Sample period
    BPG.ModelPeriod.FirstPoint := 1;
    BPG.ModelPeriod.LastPoint := 10;
    res := bpg.Execute();
    Warnings := BPG.Warnings;
    For i := 0 To BPG.WarningsCount - 1 Do
        System.Diagnostics.Debug.WriteLine(Warnings[i]);
    End For;
    SESS := BPG.ScaledExplainedSS;
    ModelCoef := BPG.ModelCoefficients.Coefficients;
    Fitted := BPG.Fitted;
    Residuals := BPG.Residuals;
    System.Diagnostics.Debug.WriteLine("The Fisher statistics: ");
    System.Diagnostics.Debug.Indent();
    System.Diagnostics.Debug.WriteLine("Statistics value: " + BPG.FStatistic.Statistic.ToString());
    System.Diagnostics.Debug.WriteLine("Probability value: " + BPG.FStatistic.Probability.ToString());
    System.Diagnostics.Debug.Unindent();
    System.Diagnostics.Debug.WriteLine("The Engle statistics: ");
    System.Diagnostics.Debug.Indent();
    System.Diagnostics.Debug.WriteLine("Statistics value: " + BPG.ObsR2.Statistic.ToString());
    System.Diagnostics.Debug.WriteLine("Probability value: " + BPG.ObsR2.Probability.ToString());
    System.Diagnostics.Debug.Unindent();
    System.Diagnostics.Debug.WriteLine("Statistics of adjusted error of regression: ");
    System.Diagnostics.Debug.Indent();
    System.Diagnostics.Debug.WriteLine("Statistics value: " + SESS.Statistic.ToString());
    System.Diagnostics.Debug.WriteLine("Probability value: " + SESS.Probability.ToString());
    System.Diagnostics.Debug.Unindent();
    System.Diagnostics.Debug.WriteLine("===Auxiliary regression===");
    System.Diagnostics.Debug.WriteLine("Estimates of auxiliary regression coefficients");
    System.Diagnostics.Debug.Indent();
    System.Diagnostics.Debug.WriteLine(BPG.ModelCoefficients.Intercept.Estimate.ToString() + " " +
        BPG.ModelCoefficients.Intercept.StandardError.ToString() + " " +
        BPG.ModelCoefficients.Intercept.TStatistic.ToString() + " " +
        BPG.ModelCoefficients.Intercept.Probability.ToString());
    For i := 0 To ModelCoef.Estimate.Length - 1 Do
        d := ModelCoef.Estimate;
        System.Diagnostics.Debug.WriteLine("Estimated values of coefficients: " + d[i].ToString());
        d := ModelCoef.StandardError;
        System.Diagnostics.Debug.WriteLine("Standard errors of coefficients: " + d[i].ToString());
        d := ModelCoef.TStatistic;
        System.Diagnostics.Debug.WriteLine("t-statistics of coefficients: " + d[i].ToString());
        d := ModelCoef.Probability;
        System.Diagnostics.Debug.WriteLine("Probabilities of coefficients: " + d[i].ToString());
    End For;
    System.Diagnostics.Debug.Unindent();
    System.Diagnostics.Debug.WriteLine("Characteristics of auxiliary regression");
    System.Diagnostics.Debug.Indent();
    System.Diagnostics.Debug.WriteLine(:"Determination coefficient: " + BPG.SummaryStatistics.R2.ToString());
    System.Diagnostics.Debug.WriteLine("Adjusted determination coefficient: " + BPG.SummaryStatistics.AdjR2.ToString());
    System.Diagnostics.Debug.WriteLine("Standard regression error: " + BPG.SummaryStatistics.SE.ToString());
    System.Diagnostics.Debug.WriteLine("Sum of residuals squares: " + BPG.SummaryStatistics.SSR.ToString());
    System.Diagnostics.Debug.WriteLine("Durbin-Watson statistic: " + BPG.SummaryStatistics.DW.ToString());
    System.Diagnostics.Debug.Unindent();
    System.Diagnostics.Debug.WriteLine("Model series of auxiliary regression");
    System.Diagnostics.Debug.Indent();
    For i := 0 To Fitted.Length - 1 Do
        System.Diagnostics.Debug.Write(i.ToString() + " ");
        System.Diagnostics.Debug.WriteLine(Fitted[i]);
    End For;
    System.Diagnostics.Debug.Unindent();
    System.Diagnostics.Debug.WriteLine("Residuals series of auxiliary regression");
    System.Diagnostics.Debug.Indent();
    For i := 0 To Residuals.Length - 1 Do
        System.Diagnostics.Debug.Write(i.ToString() + " ");
        System.Diagnostics.Debug.WriteLine(Residuals[i]);
    End For;
    System.Diagnostics.Debug.Unindent();
End Sub;

See also:

ISmBreuschPaganGodfreyTest | Fisher Statistic