FStatistic: ISpecificationTestStatistic;
FStatistic: Prognoz.Platform.Interop.Stat.ISpecificationTestStatistic;
The FStatistics property returns Fisher statistics value.
To get Engle statistics value, use the ISmARCHTest.ObsR2 property.
To execute the example, add a link to the Stat system assembly.
Sub UserProc;
Var
ARCH: SmARCHTest;
ModelCoef: ICoefficients;
can, fra, ger: Array[10] Of Double;
i, res: Integer;
Begin
ARCH := New SmARCHTest.Create;
// Set values for 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;
// Set explained variable
ARCH.Explained.Value := can;
// Set explanatory variables
ARCH.Explanatories.Clear;
ARCH.Explanatories.Add.Value := fra;
ARCH.Explanatories.Add.Value := ger;
// Use automatic estimation of constant
ARCH.ModelCoefficients.Intercept.Mode := InterceptMode.AutoEstimate;
// Set autoregression order
ARCH.AutoRegressionOrder := 1;
// Set orders of autoregression and moving average
ARCH.ARMA.ParseAR('3');
ARCH.ARMA.ParseMA('2');
// Determine missing data treatment method
ARCH.MissingData.Method := MissingDataMethod.LinTrend;
// Set sample period
ARCH.ModelPeriod.FirstPoint := 1;
ARCH.ModelPeriod.LastPoint := 10;
ModelCoef := ARCH.ModelCoefficients.Coefficients;
// Run calculation and show results
res := ARCH.Execute;
Debug.WriteLine(ARCH.Errors);
Debug.WriteLine("Fisherstatistic:"); Debug.Indent;
Debug.WriteLine("Statistics value: " + ARCH.FStatistics.Statistics.ToString);
Debug.WriteLine("Probability value: " + ARCH.FStatistics.Probability.ToString);
Debug.Unindent;
Debug.WriteLine("Englestatistic:"); Debug.Indent;
Debug.WriteLine("Statistics value: " + ARCH.ObsR2.Statistics.ToString);
Debug.WriteLine("Probability value: " + ARCH.ObsR2.Probability.ToString);
Debug.Unindent;
Debug.WriteLine("Auxiliary regression:");
Debug.WriteLine("Estimates of auxiliary regression coefficients:");
Debug.Indent;
Debug.WriteLine(ARCH.ModelCoefficients.Intercept.Estimate.ToString + " " +
ARCH.ModelCoefficients.Intercept.StandardError.ToString + " " +
ARCH.ModelCoefficients.Intercept.TStatistic.ToString + " " +
ARCH.ModelCoefficients.Intercept.Probability.ToString);
For i := 0 To ARCH.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.TStatistics[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: " + ARCH.SummaryStatistics.R2.ToString);
Debug.WriteLine("Adjusted determination coefficient: " + ARCH.SummaryStatistics.AdjR2.ToString);
Debug.WriteLine("Standard regression error: " + ARCH.SummaryStatistics.SE.ToString);
Debug.WriteLine("Sum of residuals squares: " + ARCH.SummaryStatistics.SSR.ToString);
Debug.WriteLine("Durbin-Watsonstatistic:"+ARCH.SummaryStatistics.DW.ToString); Debug.Unindent;
Debug.WriteLine("Model series of auxiliary regression");
Debug.Indent;
For i := 0 To ARCH.ModelPeriod.LastPoint - 1 Do
Debug.Write(i.ToString + " ");
Debug.WriteLine(ARCH.Fitted[i]);
End For;
Debug.Unindent;
Debug.WriteLine("Residuals series of auxiliary regression");
Debug.Indent;
For i := 0 To ARCH.Residuals.Length - 1 Do
Debug.Write(i.ToString + " ");
Debug.WriteLine(ARCH.Residuals[i]);
End For;
Debug.Unindent;
End Sub UserProc;
After executing the example the console window displays calculation results of the ARCH test for heteroscedasticity.
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
ARCH: SmARCHTest;
ModelCoef: ICoefficients;
can, fra, ger: Array[10] Of double;
i, res: integer;
Fitted, Residuals: Array;
d: System.Array;
Begin
ARCH := New SmARCHTestClass.Create();
// Set values for 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;
// Set explained variable
ARCH.Explained.Value := can;
// Set explanatory variables
ARCH.Explanatories.Clear();
ARCH.Explanatories.Add().Value := fra;
ARCH.Explanatories.Add().Value := ger;
// Use automatic estimation of constant
ARCH.ModelCoefficients.Intercept.Mode := InterceptMode.imAutoEstimate;
// Set autoregression order
ARCH.AutoRegressionOrder := 1;
// Set orders of autoregression and moving average
ARCH.ARMA.ParseAR("3", True);
ARCH.ARMA.ParseMA("2", True);
// Determine missing data treatment method
ARCH.MissingData.Method := MissingDataMethod.mdmLinTrend;
// Set sample period
ARCH.ModelPeriod.FirstPoint := 1;
ARCH.ModelPeriod.LastPoint := 10;
ModelCoef := ARCH.ModelCoefficients.Coefficients;
// Run calculation and show results
res := ARCH.Execute();
System.Diagnostics.Debug.WriteLine(ARCH.Errors);
System.Diagnostics.Debug.WriteLine("Fisherstatistic:"); System.Diagnostics.Debug.Indent();
System.Diagnostics.Debug.WriteLine("Statistics value: " + ARCH.FStatistics.Statistics.ToString());
System.Diagnostics.Debug.WriteLine("Probability value: " + ARCH.FStatistics.Probability.ToString());
System.Diagnostics.Debug.Unindent();
System.Diagnostics.Debug.WriteLine("Englestatistic:"); System.Diagnostics.Debug.Indent();
System.Diagnostics.Debug.WriteLine("Statistics value: " + ARCH.ObsR2.Statistics.ToString());
System.Diagnostics.Debug.WriteLine("Probability value: " + ARCH.ObsR2.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(ARCH.ModelCoefficients.Intercept.Estimate.ToString() + " " +
ARCH.ModelCoefficients.Intercept.StandardError.ToString() + " " +
ARCH.ModelCoefficients.Intercept.TStatistic.ToString() + " " +
ARCH.ModelCoefficients.Intercept.Probability.ToString());
For i := 0 To ARCH.ModelCoefficients.Coefficients.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: " + ARCH.SummaryStatistics.R2.ToString());
System.Diagnostics.Debug.WriteLine("Adjusted determination coefficient: " + ARCH.SummaryStatistics.AdjR2.ToString());
System.Diagnostics.Debug.WriteLine("Standard regression error: " + ARCH.SummaryStatistics.SE.ToString());
System.Diagnostics.Debug.WriteLine("Sum of residuals squares: " + ARCH.SummaryStatistics.SSR.ToString());
System.Diagnostics.Debug.WriteLine("Durbin-Watsonstatistic:"+ARCH.SummaryStatistics.DW.ToString()); System.Diagnostics.Debug.Unindent();
System.Diagnostics.Debug.WriteLine("Model series of auxiliary regression");
Fitted := ARCH.Fitted;
System.Diagnostics.Debug.Indent();
For i := 0 To ARCH.ModelPeriod.LastPoint - 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");
Residuals := ARCH.Residuals;
System.Diagnostics.Debug.Indent();
For i := 0 To ARCH.Residuals.Length - 1 Do
System.Diagnostics.Debug.Write(i.ToString() + " ");
System.Diagnostics.Debug.WriteLine(Residuals[i]);
End For;
System.Diagnostics.Debug.Indent();
End Sub;
See also:
ISmARCHTest | Fisher Statistic