IModelling.Census1

Syntax

Census1(Input: ITimeSeries;
        Period: IMsPeriod;
        OutputSeries: MsOutputCensus1SeriesType;
        SeasonalEffect: SeasonalityType;
        [SeasonalPeriod: Integer = 12];
        [Casewise: MsCasewise = 0]): Variant;

Parameters

Input. Output variable.

Period. Period, at which the method is calculated

OutputSeries. Series type that is loaded to the output variable.

SeasonalEffect. Seasonal model.

SeasonalPeriod. Duration of seasonal period.

Casewise. Missing data treatment method.

Description

The Census1 method calculates seasonal component according to the specified parameters.

Comments

If the Period parameter is set to Null, the method is executed at entire time period.

Example

Executing the example requires that the repository contains a modeling container with the MS identifier. This container includes a model with the MODEL_D identifier that is calculated using the determinate equation method and contains at least one input variable.

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

Sub UserProc;
Var
    Mb: IMetabase;
    ModelSpace, ModelObj: IMetabaseObject;
    Transf: IMsFormulaTransform;
    Formula: IMsFormula;
    Model: IMsModel;
    Determ: IMsDeterministicTransform;
    TransVar: IMsFormulaTransformVariable;
    Slice: IMsFormulaTransformSlice;
    TermInfo: IMsFormulaTermInfo;
    Expr: IExpression;
Begin
    
// Get repository
    Mb := MetabaseClass.Active;
    
// Get modeling container
    ModelSpace := Mb.ItemById("MS").Bind;
    
// Get model
    ModelObj := Mb.ItemByIdNamespace("MODEL_D", ModelSpace.Key).Edit;
    Model := ModelObj 
As IMsModel;
    
// Get model calculation parameters
    Transf := Model.Transform;
    Formula := Transf.FormulaItem(
0);
    Determ := Formula.Method 
As IMsDeterministicTransform;
    
// Get the first input variable
    TransVar := Transf.Inputs.Item(0);
    Slice := TransVar.Slices.Item(
0);
    TermInfo := Transf.CreateTermInfo;
    TermInfo.Slice := Slice;
    
// Set mode of variable transfer for calculation
    TermInfo.Type := MsFormulaTermType.Pointwise;
    
// Get expression of model calculation
    Expr := Determ.Expression;
    Expr.References := 
"Ms;Stat";
    
// Set expression of model calculation
    Expr.AsString := "Census1(" + TermInfo.TermInnerText + ", SetPeriod(" +
        
"""" + "01.01.2000" + """" + "," + """" + "01.01.2015" + """" +
        
"), MsOutputCensus1SeriesType.MovingAverage, SeasonalityType.Additive)";
    
// Check that expression is correct
    If Expr.Valid Then
        
// If expression is set correctly, save model
        ModelObj.Save;
    
Else
        
// If expression is incorrect, display message in the console window
        Debug.WriteLine("Model is not saved: error in formula");
    
End If;
End Sub UserProc;

After executing the example the model will calculate values on the basis of the first input variable by the Census1 method for the period from 2000 to 2015. A smoothed series of the input variable is loaded to the output variable.

See also:

IModelling | The Centus1 Method