ISmPooledModel.ARMA

Syntax

ARMA: ISlARMA;

Description

The ARMA property returns autoregression and moving average parameters.

Comments

By default autoregression and moving average parameters are not defined.

The AR order cannot be used for random effect model, that is, if ISmPooledModel.CrossSection = PooledModelCrossSectionType.RandomEffect.

The AM order cannot be used for a model of regression on panel data.

Example

Add a link to the Stat system assembly.

Sub UserProc;
Var
    PooledModel: ISmPooledModel;
    yY: Array[62Of Double;
    X1x, x2x: Array[72Of Double;
    Coefficients: ICoefficients;
    ARMA: ISlARMA;
    i, j, Status, MPLastPoint, ForecastValue: Integer;
    StandardError, Estimate, d1, d2: Array Of Double;
Begin
    PooledModel := New SmPooledModel.Create;
    // Explained values
    yY[00] := 20;  yY[01] := 17;
    yY[10] := 7;   yY[11] := Double.Nan;
    yY[20] := -50; YY[21] := 21;
    yY[30] := 20;  yY[31] := 17;
    yY[40] := 25;  yY[41] := 7;
    yY[50] := -50; YY[51] := 0.1;
    PooledModel.Explained.Value := YY;
    // Explanatory values
    x1x[00] := 4;   x1x[01] := -1.5;
    x1x[10] := 0.5; x1x[11] := 5;
    x1x[20] := -2;  x1x[21] := 2.5;
    x1x[30] := 130; x1x[31] := 131;
    x1x[40] := 141; x1x[41] := Double.Nan;
    x1x[50] := 150; x1x[51] := 151;
    x1x[60] := 160; x1x[61] := 161;
    PooledModel.Explanatories.Add.Value := x1x;
    // Weights
    x2x[00] := 3;    x2x[01] := 0.5;
    x2x[10] := 6;    x2x[11] := 1;
    x2x[20] := 0.75; x2x[21] := 2;
    x2x[30] := 230;  x2x[31] := 231;
    x2x[40] := 240;  x2x[41] := 241;
    x2x[50] := 250;  x2x[51] := 251;
    x2x[60] := 260;  x2x[61] := 261;
    PooledModel.Weights := x2x;
    // Sample period
    PooledModel.ModelPeriod.FirstPoint := 2;
    PooledModel.ModelPeriod.LastPoint := 5;
    // Latest forecast point
    PooledModel.Forecast.LastPoint := 7;
    // Model type
    PooledModel.CrossSection := PooledModelCrossSectionType.None;
    // Missing data treatment
    PooledModel.MissingData.Method := MissingDataMethod.SampleAverage;
    // Parameters of autoregression and moving average
    ARMA := PooledModel.ARMA;
    ARMA.ParseAR("1");
    // Run calculation and output obtained coefficients
    Status := PooledModel.Execute;
    Debug.WriteLine(PooledModel.Errors);
    If Status = 0 Then
        Coefficients := PooledModel.ModelCoefficients.Coefficients;
        j := Coefficients.Estimate.Length;
        Debug.WriteLine("Coefficient values:");
        For i := 0 To j - 1 Do
            Estimate := Coefficients.Estimate;
            StandardError := Coefficients.StandardError;
            Debug.WriteLine(" " + (i + 1).ToString + ": " + Estimate[i].ToString + ", " + StandardError[i].ToString);
        End For;
        Debug.WriteLine("=== Modeling series ===");
        For i := 0 To PooledModel.Fitted.GetUpperBound(1Do
            d1 := PooledModel.Fitted;
            d2 := PooledModel.Fitted;
            Debug.WriteLine(" " + d1[i,0].ToString + " " + d2[i,1].ToString);
        End For;
        Debug.WriteLine("=== Residuals series ===");
        For i := 0 To PooledModel.Residuals.GetUpperBound(1Do
            d1 := PooledModel.Residuals;
            d2 := PooledModel.Residuals;
            Debug.WriteLine(" " + d1[i,0].ToString + " " + d2[i,1].ToString);
        End For;
        Debug.WriteLine("=== Forecast series);
        MPLastPoint := PooledModel.ModelPeriod.LastPoint;
        ForecastValue := PooledModel.Forecast.Value.GetUpperBound(1);
        For i := MPLastPoint To ForecastValue Do
            d1 := PooledModel.Forecast.Value;
            d2 := PooledModel.Forecast.Value;
            Debug.WriteLine((i+1).ToString + ". " + d1[i,0].ToString + " " + d2[i,1].ToString);
        End For;
    End If;
End Sub UserProc;

After executing the example the panel data regression model with random effects is calculated; calculation results are displayed in the console window.

See also:

ISmPooledModel