IMs2SLSTransform.ARMA

Syntax

ARMA: ISlARMA;

Description

The ARMA property returns autoregression and moving average parameters.

Comments

Be default, autoregression order and moving average order are not specified.

If autoregression or moving average order is set for a model, upper and lower dynamic confidence limits of forecasting series are calculated.

Example

Executing the example requires that the repository contains a modeling container with the MS identifier containing a model with the MODEL_2SLS identifier. This model must be calculated by the Linear Regression (Instrumental Variables Estimation) method.

Add links to the Metabase, Ms, Stat system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    hModel: IMetabaseObjectDescriptor;
    oModel: IMsModel;
    oTransform: IMsFormulaTransform;
    oSelector: IMsFormulaTransformSelector;
    oOutputVariable: IMsFormulaTransformVariable;
    SLS: IMs2SLSTransform;
    ARMA: ISlARMA;
    coo: IMsFormulaTransformCoord;
    calc: IMsMethodCalculation;
    per: IMsModelPeriod;
    AR, MR: Array[1Of Integer;
    CoefficientsAR, CoefficientsMA: ICoefficients;
Begin
    MB := MetabaseClass.Active;
    // Get linear regression model
    hModel := MB.ItemByIdNamespace("MODEL_2SLS", MB.GetObjectKeyById("MS"));
    oModel := hModel.Edit As IMsModel;
    // Get calculation parameters
    oTransform := oModel.Transform;
    oSelector := oTransform.CreateSelector;
    // Get output variable
    oOutputVariable := oTransform.Outputs.Item(0As IMsFormulaTransformVariable;
    oSelector.Slice := oOutputVariable.Slices.Item(0);
    // Set up linear regression calculation
    SLS := oTransform.Transform(oSelector).Method As IMs2SLSTransform;
    ARMA := SLS.ARMA;
    // Determine autoregression order
    AR[0] := 3;
    ARMA.OrderAR := AR;
    // Set moving average order
    MR[0] := 2;
    ARMA.OrderMA := MR;
    // Set maximum number of iterations
    ARMA.MaxIteration := 30;
    // Set accuracy of solution
    ARMA.Tolerance := 0.5;
    // Specify that on calculating confidence limits we do not consider
    // that coefficients are found approximately
    SLS.CoefUncertaintyInSECalc := False;
    // Set the parameters of missing data treatment
    SLS.MissingData.Method := MissingDataMethod.LinTrend;
    // Identify coefficients
    coo := oTransform.CreateCoord(oOutputVariable);
    calc := oTransform.CreateCalculation;
    per := calc.Period;
    per.IdentificationStartDate := oModel.Period.IdentificationStartDate;
    per.IdentificationEndDate := oModel.Period.IdentificationEndDate;
    per.ForecastStartDate := oModel.Period.ForecastStartDate;
    per.ForecastEndDate := oModel.Period.ForecastEndDate;
    calc.CurrentPoint := oModel.Period.IdentificationStartDate;
    SLS.Identify(calc, coo);
    // Get autoregression coefficients
    CoefficientsAR := SLS.ARMACoefficients(coo).CoefficientsAR;
    Debug.WriteLine("Coefficients of autoregression");
    Debug.Write("  Value: ");
    Debug.WriteLine(CoefficientsAR.Estimate[0]);
    Debug.Write("  Standard error: ");
    Debug.WriteLine(CoefficientsAR.StandardError[0]);
    Debug.Write("  t-statistic: ");
    Debug.WriteLine(CoefficientsAR.TStatistic[0]);
    Debug.Write("  Probability:");
    Debug.WriteLine(CoefficientsAR.Probability[0]);
    // Get moving average coefficients
    CoefficientsMA := SLS.ARMACoefficients(coo).CoefficientsMA;
    Debug.WriteLine("Coefficients of moving average");
    Debug.Write("  Value: ");
    Debug.WriteLine(CoefficientsMA.Estimate[0]);
    Debug.Write("  Standard error: ");
    Debug.WriteLine(CoefficientsMA.StandardError[0]);
    Debug.Write("  t-statistic: ");
    Debug.WriteLine(CoefficientsMA.TStatistic[0]);
    Debug.Write("  Probability:");
    Debug.WriteLine(CoefficientsMA.Probability[0]);
    (oModel As IMetabaseObject).Save;
End Sub UserProc;

After executing the example autoregression and moving average orders are determined for the model. The maximum number of iterations, accuracy of solution, missing data treatment method and calculation options of confidence limits, and so on are changed. The values of summary statistics that are calculated for coefficients of autoregression and moving average are displayed in the console window.

See also:

IMs2SLSTransform