IMsCensus2Transform.NormalizeDailyWeights

Syntax

NormalizeDailyWeights;

Description

The NormalizeDailyWeights method normalizes weight coefficients for days of week.

Comments

Weight coefficients for days of week are normalized if their sum is equal to 7.

On calculation, normalization is executed automatically, and calling the NormalizeDailyWeights method enables the user to normalize data and get weight coefficient values for days of week by means of the IMsCensus2Transform.DailyWeights property before method calculation. This model must be calculated by the X11 method.

Example

Executing the example requires that the repository contains a modeling container with the MS identifier containing a model with the MODEL_CENSUS2 identifier.

Add links to the Metabase, Ms system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    ModelCont: IMetabaseObjectDescriptor;
    Model: IMsModel;
    Transform: IMsFormulaTransform;
    Formula: IMsFormula;
    CENS: IMsCensus2Transform;
    W: Array Of Double;
    i: Integer;
Begin
    // Get current repository
    MB := MetabaseClass.Active;
    // Get modeling container
    ModelCont := MB.ItemById("MS");
    // Get the model
    Model := MB.ItemByIdNamespace("MODEL_CENSUS2", ModelCont.Key).Edit As IMsModel;
    // Get the object to set up model parameters
    Transform := Model.Transform;
    // Get calculation method parameters
    Formula := Transform.FormulaItem(0);
    CENS := Formula.Method As IMsCensus2Transform;
    // Set weight coefficients for days of week and display them in the console window
    W := New Double[7];
    W[0] := 1.17;
    W[1] := 1.00;
    W[2] := 1.12;
    W[3] := 1.10;
    W[4] := 0.95;
    W[5] := 0.98;
    W[6] := 1.07;
    CENS.DailyWeights := W;
    Debug.WriteLine("Weight coefficients of week days before normalization:");
    Debug.Indent;
    For i := 0 To W.Length - 1 Do
        Debug.WriteLine(W[i]);
    End For;
    Debug.Unindent;
    // Normalize weight coefficients for days of week
    CENS.NormalizeDailyWeights;
    // Display values of weight coefficients for days of week after normalization
    Debug.WriteLine("Weight coefficients of week days after normalization:");
    Debug.Indent;
    W := CENS.DailyWeights;
    For i := 0 To W.Length - 1 Do
        Debug.WriteLine(W[i]);
    End For;
    Debug.Unindent;
    // Save changes
    (Model As IMetabaseObject).Save;
End Sub UserProc;

After executing the example the console window displays weight coefficient values for days of week before and after normalization.

See also:

IMsCensus2Transform