PDLStatCoefficients(Coord: IMsFormulaTransformCoord; Index: Integer): IMsPDLCoefficients;
PDLStatCoefficients
(Coord: Prognoz.Platform.Interop.Ms.IMsFormulaTransformCoord,
Index: System.Int32): Prognoz.Platform.Interop.Ms.IMsPDLCoefficients;
Coord. Output variable slice, for which calculation is executed.
Index. Lag variable index.
The PDLStatCoefficients property returns lag variable coefficients.
Before getting the coefficients, they must be identified. Use IMsStochasticMethod.Identify for it.
Executing the example requires a modeling container with the CONT_MODEL identifier. The container includes a linear regression model (OLS estimation) with the MODEL identifier that contains several factors. Add links to the Metabase, Ms, Stat system assemblies.
Sub UserProc;
Var
mb: IMetabase;
ContModelDescr: IMetabaseObjectDescriptor;
ModelObj: IMetabaseObject;
pModel: IMsModel;
pTransform: IMsFormulaTransform;
pFormula: IMsFormula;
pRegress: IMsLinearRegressionTransform;
Term: IMsCompositeFormulaTerm;
pPDLTerm: IMsPDLTermOptions;
pVar: IMsFormulaTransformVariable;
pCalc: IMsMethodCalculation;
pCoord: IMsFormulaTransformCoord;
PDLCoeff: IMsPDLCoefficients;
Begin
mb := MetabaseClass.Active;
ContModelDescr := mb.ItemById("CONT_MODEL");
ModelObj := mb.ItemByIdNamespace("MODEL", ContModelDescr.Key).Edit;
pModel := ModelObj As IMsModel;
pTransform := pModel.Transform;
pFormula := pTransform.FormulaItem(0);
pRegress := pFormula.Method As IMsLinearRegressionTransform;
Term := pRegress.Explanatories.Item(0);
pPDLTerm := Term.CustomOptions As IMsPDLTermOptions;
pPDLTerm.IsPDLTerm := True;
pPDLTerm.LagLengthK := 3;
pPDLTerm.PolinomialDegreeP := 1;
pPDLTerm.PDLConstraint := PDLConstraintType.Both;
ModelObj.Save;
pCalc := pTransform.CreateCalculation;
pCalc.Period.IdentificationStartDate := DateTime.ComposeDay(2000, 1, 1);
pCalc.Period.IdentificationEndDate := DateTime.ComposeDay(2010, 12, 31);
pCalc.Period.ForecastStartDate := DateTime.ComposeDay(2011, 1, 1);
pCalc.Period.ForecastEndDate := DateTime.ComposeDay(2015, 12, 31);
pVar := pTransform.Outputs.Item(0);
pCoord := pTransform.CreateCoord(pVar);
pRegress.Identify(pCalc, pCoord);
PDLCoeff := pRegress.PDLStatCoefficients(pCoord, 0);
Debug.WriteLine("Coefficients sum: " + PDLCoeff.EstimatesSum.ToString);
Debug.WriteLine("Standard errors sum: " + PDLCoeff.StdErrSum.ToString);
Debug.WriteLine("t-statistics sum: " + PDLCoeff.TStatSum.ToString);
End Sub UserProc;
After executing the example the first regressor of the model is transformed to the lag variable. Lag, polynomial degree and constraint type are set for the variable. The model is saved, its coefficients are identified, coefficients of the created lag variable are displayed in the console window.
See also: