DPrior: ISlSerie;
The DPrior property determines prior differences.
To specify a priory values use the ISmLRXFilter.Prior property.
To execute the example, add a link to the Stat system assembly.
Sub UserProc;
Var
lrx: SmLRXFilter;
status, i: Integer;
can, w1, w2, w3, P, Dp: Array[15] Of Double;
SumStat: ISummaryStatistics;
Begin
// Specify values of can, P variables
can[00] := 6209; P[00] := 4110;
can[01] := 6385; P[01] := 4280;
can[02] := 6752; P[02] := 4459;
can[03] := Double.Nan; P[03] := 4545;
can[04] := 6495; P[04] := 4664;
can[05] := 6907; P[05] := 4861;
can[06] := 7349; P[06] := 5195;
can[07] := 7213; P[07] := 5389;
can[08] := 7061; P[08] := 5463;
can[09] := 7180; P[09] := 5610;
can[10] := 7132; P[10] := 5948;
can[11] := 7137; P[11] := 6218;
can[12] := 7473; P[12] := 6521;
can[13] := 7722; P[13] := 6788;
can[14] := 8088; P[14] := 7222;
// Specify values of w1, w2,w3 variables
w1[0] := 1; w2[0] := 15; w3[0] := 1;
w1[1] := 2; w2[1] := 14; w3[1] := 2;
w1[2] := 3; w2[2] := 13; w3[2] := 3;
w1[3] := 4; w2[3] := 12; w3[3] := 4;
w1[4] := 5; w2[4] := 11; w3[4] := 5;
w1[5] := 6; w2[5] := 10; w3[5] := 6;
w1[6] := 7; w2[6] := 9; w3[6] := 7;
w1[7] := 8; w2[7] := 8; w3[7] := 8;
w1[8] := 9; w2[8] := 7; w3[8] := 7;
w1[9] := 10; w2[9] := 6; w3[9] := 6;
w1[10] := 11; w2[10] := 5; w3[10] := 5;
w1[11] := 12; w2[11] := 4; w3[11] := 4;
w1[12] := 13; w2[12] := 3; w3[12] := 3;
w1[13] := 14; w2[13] := 2; w3[13] := 2;
w1[14] := 15; w2[14] := 1; w3[14] := 1;
// Create a method
lrx := New SmLRXFilter.Create;
// Specify source series
lrx.Serie.Value := can;
// Specify prior values
lrx.Prior.Value := P;
// Specify weights
lrx.w1.Value := w1;
lrx.w2.Value := w2;
lrx.w3.Value := w3;
//Specify prior differences
Dp[0] := 0;
For i := 1 To 14 Do
DP[i] := P[i] - P[i - 1];
End For;
lrx.DPrior.Value := Dp;
// Specify missing data treatment method
lrx.MissingData.Method := MissingDataMethod.SampleAverage;
// Specify calculation period parameters
lrx.ModelPeriod.FirstPoint := 1;
lrx.ModelPeriod.LastPoint := 15;
// Specify series smoothing degree
lrx.SmoothingParameter := 110;
// Run calculation and output the results to console window
status := lrx.Execute;
Debug.WriteLine(lrx.Errors);
If status = 0 Then
Debug.WriteLine(""); Debug.WriteLine("Summary statistics:");
SumStat := lrx.SummaryStatistics;
Debug.WriteLine(" - Durbin-Watson statistic: " + SumStat.DW.ToString);
Debug.WriteLine(" - Sum of squared residuals: " + SumStat.SSR.ToString);
Debug.WriteLine(""); Debug.WriteLine("Modeling series");
Print(lrx.Fitted);
Debug.WriteLine(""); Debug.WriteLine("Residual series");
Print(lrx.Residuals);
End If;
End Sub UserProc;
// Data output procedure
Sub Print(Data: Array Of Double);
Var
i: Integer;
Begin
Debug.Indent;
For i := 0 To Data.Length - 1 Do
Debug.WriteLine(i.ToString + " " + Data[i].ToString);
End For;
Debug.Unindent;
End Sub Print;
Example execution result: the LRX filter is set up and calculated, calculation results are output to the console window.
See also: