ISlEquation.Residuals

Syntax

Residuals: Array;

Description

The Residuals property returns a residual series.

Example

Sub Main;

Var

ar1, ar2: Array[0..15] Of Double;

j,status: Integer;

var1: ISmVectorAutoRegress;

Eqs: ISlEquations;

Eq: ISlEquation;

ARO: Array[0..0] Of Integer;

Sub Print(Data: Array Of Double);

Var

i: Integer;

d: Double;

Begin

Debug.WriteLine("---Begin---");

For i := 0 To Data.Length - 1 Do

If Double.IsNan(Data[i]) Then

Debug.WriteLine(i.ToString + ", ---empty---");

Else

d := Data[i];

Debug.WriteLine(i.ToString + ", " + d.ToString);

End If;

End For;

Debug.WriteLine("---End---");

End Sub Print;

Begin

//Endogenous1

ar1[0] := 3;

ar1[1] := 8;

ar1[2] := 12;

ar1[3] := 10;

ar1[4] := 26;

ar1[5] := 21;

ar1[6] := 35;

ar1[7] := 29;

ar1[8] := 40;

ar1[9] := 39;

ar1[10] := 51;

ar1[11] := 50;

ar1[12] := 59;

ar1[13] := 58;

ar1[14] := 65;

ar1[15] := 72;

//Endogenous2

ar2[0] := 5;

ar2[1] := 3;

ar2[2] := 9;

ar2[3] := 13;

ar2[4] := 25;

ar2[5] := 21;

ar2[6] := 30;

ar2[7] := 33;

ar2[8] := 43;

ar2[9] := 37;

ar2[10] := 49;

ar2[11] := 47;

ar2[12] := 60;

ar2[13] := 59;

ar2[14] := 69;

ar2[15] := 68;

ARO[0] := 1;

var1 := New SmVectorAutoRegress.Create;

Eqs := var1.Equations;

Eq := Eqs.Add;

Eq.Serie.Value := ar1;

Eq.AutoRegressionOrder := ARO;

Eq.Forecast.LastPoint := 16;

Eq.Intercept.Mode := InterceptMode.AutoEstimate;

Eq := Eqs.Add;

Eq.Serie.Value := ar2;

Eq.AutoRegressionOrder := ARO;

Eq.Forecast.LastPoint := 16;

Eq.Intercept.Mode := InterceptMode.AutoEstimate;

var1.ModelPeriod.FirstPoint := 1;

var1.ModelPeriod.LastPoint := 16;

status := var1.Execute;

If status <> 0 Then

Debug.Writeline(var1.Errors);

Else

For j := 0 To Eqs.Count-1 Do

Debug.WriteLine("=== Residual series for the equation" + j.ToString + " ===");

Print(Eqs.Item(j).Residuals);

End For;

End If;

End Sub Main;

After executing the example the console window displays remainders of series for vector autoregression equations:

Module execution started

=== Residual series for equation 0 ===

---Begin---

0, ---empty---

1, -3.7808662785608291

2, 2.3379121574744168

3, -5.3342298062099331

4, 6.716294729897001

5, -9.3399077892942692

6, 8.3574964424435478

7, -5.8626350949055492

8, 2.0132125150748479

9, -8.2843133283029644

10, 9.4958591634479248

11, -2.7043840598320656

12, 8.1983333200701125

13, -5.0793042092385861

14, 2.8540493927014126

15, 0.41248284523489076

---End---

=== Residual series for equation 1 ===

---Begin---

0, ---empty---

1, -6.477262385252077

2, -0.25310051806125244

3, -1.590209286325603

4, 7.9974151196330112

5, -8.6408542765554301

6, 4.4900666946882275

7, -2.4796483173680315

8, 6.81584915815953

9, -9.1431935462634115

10, 7.4573957746285302

11, -6.1988476917300304

12, 8.4983530702055887

13, -4.1472180885196579

14, 6.8241355336768876

15, -3.1528812409161873

---End---

Module execution finished

See also:

ISlEquation