ISmLinearRegress.GDLTerms

Syntax

GDLTerms: ISlGDLTerms;

Description

The GDLTerms property determines parameters for estimation of Koyck distributed lags.

Comments

The ISmLinearRegress.UseGDLTerms property determines whether to use Koyck distributed lags model.

Example

To execute the example, add a link to the Stat system assembly.

Sub UserProc;
Var
    lr: ISmLinearRegress;
    y, x1, x3: Array[25Of Double;
    i: Integer;
    init: Array[2Of Double;
    constant: IIntercept;
    exp: ISlSeries;
    GDLTerms: ISlGDLTerms;
    coefs: ICoefficients;
Begin

    // Set variable values
    Y[0] := -0.22;  X1[0]:=0.37; X3[0]:=-135;
    Y[1] := -0.3;   X1[1]:=0.19; X3[1]:=-135;
    Y[2] := -0.34;  X1[2]:=0.08; X3[2]:=-133;
    Y[3] := -0.34;  X1[3]:=0.08; X3[3]:=-129;
    Y[4] := -0.34;  X1[4]:=0.13; X3[4]:=-125;
    Y[5] := -0.34;  X1[5]:=0.21; X3[5]:=-123;
    Y[6] := -0.3;   X1[6]:=0.37; X3[6]:=-121;
    Y[7] := -0.28;  X1[7]:=0.43; X3[7]:=-117;
    Y[8] := -0.22; X1[8]:=0.49; X3[8]:=-115;
    Y[9] := -0.11; X1[9]:=0.55; X3[9]:=-112;
    Y[10] := -0.04; X1[10]:=0.65;   X3[10]:=-109;
    Y[11] := -0.01; X1[11]:=0.73; X3[11]:=-106;
    Y[12] := 0.06; X1[12] := 0.98; X3[12]:=-109;
    Y[13] := 0.09; X1[13] := 1.1;   X3[13]:=-109;
    Y[14] := 0.17; X1[14] := 1.19;  X3[14]:=-115;
    Y[15] := 0.31; X1[15] := 1.26;  X3[15]:=-117;
    Y[16] := 0.37; X1[16] := 1.43;  X3[16]:=-123;
    Y[17] := 0.46; X1[17] := 1.62;  X3[17]:=-123;
    Y[18] := 0.57; X1[18] := 1.72;  X3[18]:=-125;
    Y[19] := 0.62; X1[19] := 1.77;  X3[19]:=-129;
    Y[20] := 0.62; X1[20] := 1.77;  X3[20]:=-133;
    Y[21] := 0.62; X1[21] := 1.77;  X3[21]:=-135;
    Y[22] := 0.62; X1[22] := 1.77;  X3[22]:=-135;
    Y[23] := 0.54; X1[23] := 1.72; X3[23]:=-135;
    Y[24] := 0.58; X1[24] := 1.48;  X3[24]:=-129;

    // Create a method
    lr := New SmLinearRegress.Create;
    // Determine parameters of sample periods and forecasting
    lr.ModelPeriod.FirstPoint := 0;
    lr.ModelPeriod.LastPoint := 15;
    lr.Forecast.LastPoint := 25;
    // Determine constant parameters
    constant := lr.ModelCoefficients.Intercept;
    constant.Mode := InterceptMode.AutoEstimate;
    // Set explained variable
    lr.Explained.Value := y;
    // Set explanatory variables
    exp := lr.Explanatories;
    exp.Add.Value := x1;
    exp.Add.Value := x3;
    // Set Koyck lag parameters
    lr.UseGDLTerms := True;
    GDLTerms := lr.GDLTerms;
    // Determine maximum number of iterations
    GDLTerms.MaxIteration := 300;
    // Determine accuracy used in optimization
    GDLTerms.Tolerance := 0.01;
    // Use numeric derivatives
    GDLTerms.UseAnalyticDeriv := False;
    // Set initial coefficient values
    init[0] := 0.011;
    init[1] := 0.024;
    GDLTerms.AllInitialValues := init;
    // Execute method calculation
    i := lr.Execute;

    // Display results
    If i = 0 Then
        Debug.WriteLine("Constant value: " + constant.Estimate.ToString);
        Debug.WriteLine("Modeling series:");
        Debug.Indent;
        For i := 0 To lr.Fitted.Length - 1 Do
            Debug.WriteLine(lr.Fitted[i]);
        End For;
        Debug.Unindent;
        Debug.WriteLine("Forecasting series:");
        Debug.Indent;
        For i := 0 To lr.Forecast.Value.Length - 1 Do
            Debug.WriteLine(lr.Forecast.Value[i]);
        End For;
        Debug.Unindent;
        coefs := lr.ModelCoefficients.Coefficients;
        Debug.WriteLine("Coefficient values:");
        Debug.Indent;
        Debug.WriteLine("beta0_1: " + coefs.Estimate[0].ToString);
        Debug.WriteLine("beta0_2: " + coefs.Estimate[1].ToString);
        Debug.WriteLine("alpha: " + coefs.Estimate[2].ToString);
        Debug.Unindent;
    End If;
End Sub UserProc;

After executing the example the console window displays results of linear regression model calculation (OLS estimation) using Koyck distributed lags: modeling explained series, forecasting series, and coefficient values.

See also:

ISmLinearRegress | Geometric distributed lag model