IMsMethod.ObservationsCount

Fore Syntax

ObservationsCount(Calculation: IMsMethodCalculation; Coord: IMsFormulaTransformCoord): Integer;

Fore.NET Syntax

ObservationsCount
    (Calculation: Prognoz.Platform.Interop.Ms.IMsMethodCalculation,
    Coord: Prognoz.Platform.Interop.Ms.IMsFormulaTransformCoord): System.Int32;

Parameters

Calculation. Model calculation parameters.

Coord. Output variable slice, for which calculation is executed.

Description

The ObservationsCount property returns the number of model observations.

Comments

The general number of observation is determines the by the period of model identification. The IMsModelPeriod interface is used to set it up.

ObservationsCount considers not only the sample period, but also the lag, autoregression and model transformation order.

Fore Example

Executing the example requires that the repository contains a modeling container with the CONT_MODEL identifier. The container includes a model with the MODEL identifier.

Add links to the Metabase, Ms system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    Model: IMsModel;
    Transform: IMsFormulaTransform;
    VarTrans: IMsFormulaTransformVariable;
    Tree: IMsFormulaTransformSlicesTree;
    Slice: IMsFormulaTransformSlice;
    Selector: IMsFormulaTransformSelector;
    Formula: IMsFormula;
    Method: IMsMethod;
    Coord: IMsFormulaTransformCoord;
    Calc: IMsModelCalculation;
    ObsCount: Integer;
Begin
    MB := MetabaseClass.Active;
    Model := MB.ItemByIdNamespace("MODEL", MB.ItemById("CONT_MODEL").Key).Bind As IMsModel;
    Transform := Model.Transform;
    VarTrans := Transform.Outputs.Item(0);
    Tree := VarTrans.SlicesTree(VarTrans);
    Slice := Tree.CreateSlice(1);
    Selector := Transform.CreateSelector;
    Selector.Slice := Slice;
    Formula := Transform.Transform(Selector);
    Method := Formula.Method;
    Coord := Transform.CreateCoord(VarTrans);
    Calc := Model.CreateCalculation;
    Calc.Period.IdentificationStartDate := DateTime.ComposeDay(20000101);
    Calc.Period.IdentificationEndDate := DateTime.ComposeDay(20051231);
    Calc.Period.ForecastStartDate := DateTime.ComposeDay(20060101);
    Calc.Period.ForecastEndDate := DateTime.ComposeDay(20101231);
    ObsCount := Method.ObservationsCount(Calc As IMsMethodCalculation, Coord);
    Debug.WriteLine(Number of observations:  + ObsCount.ToString);
End Sub UserProc;

After executing the example, the number of model observations at the specified sample period is displayed in the console window.

See also:

IMsMethod