ISmOmittedVariablesTest.Residuals

Syntax

Residuals: Array;

Description

The Residuals property returns the residual series, which is calculated for a model with additional regressors.

Example

Sub Main;

Var

OVtest: SmOmittedVariablesTest;

d0: Double;

res: Integer;

y,x,y1,y2: Array Of Double;

Sub Print(Data: Array Of Double);

Var

i: Integer;

CI: ICultureInfo;

Begin

CI := CultureInfo.Current;

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

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

If Double.IsNan(Data[i]) Then

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

Else

Debug.WriteLine(i.ToString + ", " + CI.FormatDoublePrec(Data[i], 4));

End If;

End For;

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

End Sub Print;

Begin

y := New Double[43];

x := New Double[43];

y1 := New Double[43];

y2 := New Double[43];

//values y, y1, y2, x

y[00] := 6209; x[00] := 4110; y1[00] := 3415; y2[00] := 2822;

y[01] := 6385; x[01] := 4280; y1[01] := 3673; y2[01] := 3023;

y[02] := 6752; x[02] := 4459; y1[02] := 4013; y2[02] := 3131;

y[03] := 6837; x[03] := 4545; y1[03] := 4278; y2[03] := 3351;

y[04] := 6495; x[04] := 4664; y1[04] := 4577; y2[04] := 3463;

y[05] := 6907; x[05] := 4861; y1[05] := 5135; y2[05] := 3686;

y[06] := 7349; x[06] := 5195; y1[06] := 5388; y2[06] := 3815;

y[07] := 7213; x[07] := 5389; y1[07] := 5610; y2[07] := 3960;

y[08] := 7061; x[08] := 5463; y1[08] := 5787; y2[08] := 4119;

y[09] := 7180; x[09] := 5610; y1[09] := 6181; y2[09] := 4351;

y[10] := 7132; x[10] := 5948; y1[10] := 6633; y2[10] := 4641;

y[11] := 7137; x[11] := 6218; y1[11] := 6910; y2[11] := 5008;

y[12] := 7473; x[12] := 6521; y1[12] := 7146; y2[12] := 5305;

y[13] := 7722; x[13] := 6788; y1[13] := 7248; y2[13] := 5611;

y[14] := 8088; x[14] := 7222; y1[14] := 7689; y2[14] := 5693;

y[15] := 8516; x[15] := 7486; y1[15] := 8046; y2[15] := 5804;

y[16] := 8941; x[16] := 7832; y1[16] := 8143; y2[16] := 6121;

y[17] := 9064; x[17] := 8153; y1[17] := 8064; y2[17] := 6546;

y[18] := 9380; x[18] := 8468; y1[18] := 8556; y2[18] := 6918;

y[19] := 9746; x[19] := 9054; y1[19] := 9177; y2[19] := 7349;

y[20] := 9907; x[20] := 9499; y1[20] := 9705; y2[20] := 7769;

y[21] := 10333; x[21] := 9866; y1[21] := 9923; y2[21] := 7809;

y[22] := 10863; x[22] := 10217; y1[22] := 10268; y2[22] := 7951;

y[23] := 11693; x[23] := 10763; y1[23] := 10681; y2[23] := 8395;

y[24] := 12242; x[24] := 10683; y1[24] := 10448; y2[24] := 8653;

y[25] := 12227; x[25] := 10494; y1[25] := 10366; y2[25] := 8304;

y[26] := 12910; x[26] := 10938; y1[26] := 10958; y2[26] := 8809;

y[27] := 13049; x[27] := 11198; y1[27] := 11292; y2[27] := 9028;

y[28] := 13384; x[28] := 11546; y1[28] := 11726; y2[28] := 9314;

y[29] := 14036; x[29] := 11865; y1[29] := 12172; y2[29] := 9820;

y[30] := 14242; x[30] := 11781; y1[30] := 12058; y2[30] := 10246;

y[31] := 14704; x[31] := 11681; y1[31] := 11804; y2[31] := 10153;

y[32] := 13802; x[32] := 11903; y1[32] := 11682; y2[32] := 10197;

y[33] := 14197; x[33] := 11900; y1[33] := 12001; y2[33] := 10294;

y[34] := 15010; x[34] := 11986; y1[34] := 12300; y2[34] := 10555;

y[35] := 15589; x[35] := 12206; y1[35] := 12535; y2[35] := 10808;

y[36] := 15932; x[36] := 12734; y1[36] := 13173; y2[36] := 11318;

y[37] := 16631; x[37] := 12990; y1[37] := 13482; y2[37] := 11683;

y[38] := 17394; x[38] := 13516; y1[38] := 13945; y2[38] := 12153;

y[39] := 17758; x[39] := 13866; y1[39] := 14278; y2[39] := 12464;

y[40] := 17308; x[40] := 14141; y1[40] := 14840; y2[40] := 12782;

y[41] := 16444; x[41] := 14141; y1[41] := 15263; y2[41] := 13066;

y[42] := 16413; x[42] := 14237; y1[42] := 15357; y2[42] := 13113;

OVtest := New SmOmittedVariablesTest.Create;

OVtest.Explained.Value := y;

OVtest.Explanatories.Add.Value := y1;

OVtest.Explanatories.Add.Value := y2;

OVtest.OmittedExplanatories.Add.Value := x;

OVtest.ModelCoefficients.Intercept.Mode := InterceptMode.AutoEstimate;

OVtest.ModelPeriod.FirstPoint := 1;

OVtest.ModelPeriod.LastPoint := 43;

OVtest.MissingData.Method := MissingDataMethod.LinInterpolation;

res := OVtest.Execute;

If res <> 0 Then

Debug.WriteLine(OVtest.Errors);

Else

Debug.WriteLine("=== Fisher test ===");

d0 := OVtest.FTest.Statistic;

Debug.WriteLine("value: " + d0.ToString);

d0 := OVtest.FTest.Probability;

Debug.WriteLine("probability: " + d0.ToString);

Debug.WriteLine("== Residuals ==");

Print(OVtest.Residuals);

End If;

End Sub Main;

Executing the example shows a residual series and Fisher test values in the console window:

Module execution started

=== Fisher test ===

value: 2.3044286944647494

probability: 0.13707054245367631

== Residuals ==

---Begin---

0, -117.8834

1, -111.4983

2, 362.4956

3, 288.2234

4, 24.8060

5, 567.6760

6, 898.9950

7, 649.7335

8, 359.7941

9, 420.5040

10, 178.9940

11, -337.3728

12, -448.9539

13, -807.6206

14, -283.1920

15, 226.1333

16, -21.3037

17, -981.1269

18, -961.9740

19, -983.2351

20, -1 232.0556

21, -798.3549

22, -303.3170

23, -114.6215

24, -313.6736

25, 350.8851

26, 532.9945

27, 514.9060

28, 638.1890

29, 672.5635

30, -57.4418

31, 333.0626

32, -905.0592

33, -320.7770

34, 292.5155

35, 548.5244

36, 395.9588

37, 622.1499

38, 761.4058

39, 743.4116

40, 205.0441

41, -716.2102

42, -773.2940

---End---

Module execution finished

See also:

ISmOmittedVariablesTest