MissingData: IMissingData;
MissingData: Prognoz.Platform.Interop.Stat.SlMissingData;
The MissingData property determines missing data treatment method.
By default missing data is not treated.
Add a link to the Stat system assembly.
Sub UserProc;
Var
AC: SmAutoCorrelation;
d0, d1, d2, d3, d4: Double;
i, res: Integer;
s: Array[25] Of Double;
Begin
// Create a class instance
AC := New SmAutoCorrelation.Create;
// Set data series values
s[00] := 4110; s[01] := 4280; s[02] := 4459; s[03] := 4545; s[04] := Double.Nan;
s[05] := 4861; s[06] := 5195; s[07] := 5389; s[08] := 5463; s[09] := 5610;
s[10] := 5948; s[11] := 6218; s[12] := 6521; s[13] := 6788; s[14] := Double.Nan;
s[15] := 7486; s[16] := 7832; s[17] := 8153; s[18] := 8468; s[19] := 9054;
s[20] := 9499; s[21] := 9866; s[22] := 10217; s[23] := 10763; s[24] := 10683;
AC.Serie.Value := s;
// Determine start point of sample period
AC.ModelPeriod.FirstPoint := 1;
// Determine end point of sample period
AC.ModelPeriod.LastPoint := 25;
// Determine missing data treatment method
AC.MissingData.Method := MissingDataMethod.Casewise;
// Determine how many times a source time series will be differenced
AC.DifferenceOrder := 3;
// Determine lag
AC.LagOrder := 10;
// Execute calculation
res := AC.Execute;
If res <> 0 Then
Debug.WriteLine(AC.Errors);
Else
// Get standard error
d0 := AC.StandardError;
Debug.WriteLine("Standard error: " + d0.ToString);
Debug.WriteLine("ACF, PACF");
For i := 0 To AC.AutoCorrelationFunction.Length - 1 Do
// Get autocorrelation function (ACF)
d1 := AC.AutoCorrelationFunction[i];
// Get partial autocorrelation function (PACF)
d2 := AC.PartialAutoCorrelationFunction[i];
Debug.WriteLine((i + 1).ToString + ". " + d1.ToString + ", " + d2.ToString);
End For;
Debug.WriteLine("Ljung-Box Q-statistic, Ljung-Box Q-statistic probability");
For i := 0 To AC.AutoCorrelationFunction.Length - 1 Do
// Get Ljung-Box Q-statistics
d3 := AC.QStatistics[i];
// Get Ljung-Box Q-statistics probability
d4 := AC.Probability[i];
Debug.WriteLine((i + 1).ToString + ", " + d3.ToString + ", " + d4.ToString);
End For;
End If;
End Sub UserProc;
After executing the example the console window displays the following:
Standard error.
Autocorrelation function.
Partial autocorrelation function.
Ljung-Box Q-statistic.
Get Ljung-Box Q-statistics probability.
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
AC: SmAutoCorrelation;
d0, d1, d2, d3, d4: Double;
i, res: Integer;
s: Array[25] Of Double;
AutoCorrFunc, QStat: System.Array;
Begin
// Create a class instance
AC := New SmAutoCorrelation.Create();
// Set data series values
s[00] := 4110; s[01] := 4280; s[02] := 4459; s[03] := 4545; s[04] := Double.Nan;
s[05] := 4861; s[06] := 5195; s[07] := 5389; s[08] := 5463; s[09] := 5610;
s[10] := 5948; s[11] := 6218; s[12] := 6521; s[13] := 6788; s[14] := Double.Nan;
s[15] := 7486; s[16] := 7832; s[17] := 8153; s[18] := 8468; s[19] := 9054;
s[20] := 9499; s[21] := 9866; s[22] := 10217; s[23] := 10763; s[24] := 10683;
AC.Serie.Value := s;
// Determine start point of sample period
AC.ModelPeriod.FirstPoint := 1;
// Determine end point of sample period
AC.ModelPeriod.LastPoint := 25;
// Determine missing data treatment method
AC.MissingData.Method := MissingDataMethod.mdmCasewise;
// Determine how many times a source time series will be differenced
AC.DifferenceOrder := 3;
// Determine lag
AC.LagOrder := 10;
// Execute calculation
res := AC.Execute();
If res <> 0 Then
System.Diagnostics.Debug.WriteLine(AC.Errors);
Else
// Get standard error
d0 := AC.StandardError;
System.Diagnostics.Debug.WriteLine("Standard error: " + d0.ToString());
System.Diagnostics.Debug.WriteLine("ACF, PACF");
For i := 0 To AC.AutoCorrelationFunction.Length - 1 Do
// Get autocorrelation function (ACF)
AutoCorrFunc := AC.AutoCorrelationFunction;
d1 := AutoCorrFunc[i] As double;
// Get partial autocorrelation function (PACF)
AutoCorrFunc := AC.PartialAutoCorrelationFunction;
d2 := AutoCorrFunc[i] As double;
System.Diagnostics.Debug.WriteLine((i + 1).ToString() + ". " + d1.ToString() + ", " + d2.ToString());
End For;
System.Diagnostics.Debug.WriteLine("Ljung-Box Q-statistic, Ljung-Box Q-statistic probability");
For i := 0 To AC.AutoCorrelationFunction.Length - 1 Do
// Get Ljung-Box Q-statistics
QStat := AC.QStatistics;
d3 := QStat[i] As double;
// Get Ljung-Box Q-statistics probability
QStat := AC.Probability;
d4 := QStat[i] As double;
System.Diagnostics.Debug.WriteLine((i + 1).ToString() + ", " + d3.ToString() + ", " + d4.ToString());
End For;
End If;
End Sub;
See also: