ISmPooledModel.WeightedSummaryStatistics

Fore Syntax

WeightedSummaryStatistics: ISummaryStatistics;

Fore.NET Syntax

WeightedSummaryStatistics: Prognoz.Platform.Interop.Stat.ISummaryStatistics;

Description

The WeightedSummaryStatistics property returns weighted descriptive statistics of a model.

Comments

Descriptive statistics are calculated using general formulas. The property does not calculate statistics, not relevant for the current model.

Fore Example

To execute the example, add a link to the Stat system assembly.

Sub UserProc;
Var
    PooledModel: ISmPooledModel;
    yY: Array[62Of Double;
    x1x, x2x: Array[72Of Double;
    Constan: IIntercept;
    Status, i: Integer;
    d1,d2: Array Of Double;
Begin
    PooledModel := New SmPooledModel.Create;
    // Explained values
    yY[00] := 20;  yY[01] := 17;
    yY[10] := 7;   yY[11] := 28;
    yY[20] := -50; YY[21] := 21;
    yY[30] := 20;  yY[31] := 17;
    yY[40] := 25;  yY[41] := 7;
    yY[50] := -50; YY[51] := 0.1;
    PooledModel.Explained.Value := YY;
    // Explanatory values
    x1x[00] := 4;   x1x[01] := -1.5;
    x1x[10] := 0.5; x1x[11] := 5;
    x1x[20] := -2;  x1x[21] := 2.5;
    x1x[30] := 130; x1x[31] := 131;
    x1x[40] := 141; x1x[41] := 145;
    x1x[50] := 150; x1x[51] := 151;
    x1x[60] := 160; x1x[61] := 161;
    PooledModel.Explanatories.Add.Value := x1x;
    // Weights
    x2x[00] := 3;    x2x[01] := 0.5;
    x2x[10] := 6;    x2x[11] := 1;
    x2x[20] := 0.75; x2x[21] := 2;
    x2x[30] := 230;  x2x[31] := 231;
    x2x[40] := 240;  x2x[41] := 241;
    x2x[50] := 250;  x2x[51] := 251;
    x2x[60] := 260;  x2x[61] := 261;
    PooledModel.Weights := x2x;
    // Sample period
    PooledModel.ModelPeriod.FirstPoint := 1;
    PooledModel.ModelPeriod.LastPoint := 5;
    // Latest forecast point
    PooledModel.Forecast.LastPoint := 7;
    // Weights
    PooledModel.GLSWeights := GLSWeightsType.PeriodWeights;
    // Model type
    PooledModel.CrossSection := PooledModelCrossSectionType.None;
    // Parameters of model coefficients
    Constan := PooledModel.ModelCoefficients.Intercept;
    Constan.Mode := InterceptMode.None;
    // Run calculation
    Status := PooledModel.Execute;
    If Status = 0 Then
        Debug.WriteLine("=== Weighted summary statistics ===");
        Debug.WriteLine(" Determination coefficient: " + PooledModel.WeightedSummaryStatistics.R2.ToString);
        Debug.WriteLine(" Mean error: " + PooledModel.WeightedSummaryStatistics.ME.ToString);
        Debug.WriteLine(" Standard error: " + PooledModel.WeightedSummaryStatistics.SE.ToString);
        Debug.WriteLine(" Standard deviation of residuals: " + PooledModel.WeightedSummaryStatistics.SEE.ToString);
        Debug.WriteLine("=== Summary statistics ===");
        Debug.WriteLine(" Determination coefficient: " + PooledModel.SummaryStatistics.R2.ToString);
        Debug.WriteLine(" Mean error: " + PooledModel.SummaryStatistics.ME.ToString);
        Debug.WriteLine(" Standard error: " + PooledModel.SummaryStatistics.SE.ToString);
        Debug.WriteLine(" Standard deviation of residuals: " + PooledModel.SummaryStatistics.SEE.ToString);
        Debug.WriteLine("=== Residuals ===");
        For i := 0 To PooledModel.Residuals.GetUpperBound(1Do
            d1 := PooledModel.Residuals;
            d2 := PooledModel.Residuals;
            Debug.WriteLine(" " + d1[i,0].ToString + " " + d2[i,1].ToString);
        End For;
    End If;
End Sub UserProc;

After executing the example the panel data regression model with random effects is calculated; calculation results are displayed in the console window.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.Stat;

Public Shared Sub Main(Params: StartParams);
Var
    PooledModel: ISmPooledModel;
    yY: Array[26Of Double;
    x1x, x2x: Array[27Of Double;
    Constan: IIntercept;
    Status, i: Integer;
    d1,d2: System.Array;
Begin
    PooledModel := New SmPooledModel.Create();
    // Explained values
    yY[00] := 20;   yY[10] := 17;
    yY[01] := 7;    yY[11] := 28;
    yY[02] := -50;  YY[12] := 21;
    yY[03] := 20;   yY[13] := 17;
    yY[04] := 25;   yY[14] := 7;
    yY[05] := -50;  YY[15] := 0.1;
    PooledModel.Explained.Value := YY;
    // Explanatory values
    x1x[00] := 4;    x1x[10] := -1.5;
    x1x[01] := 0.5;  x1x[11] := 5;
    x1x[02] := -2;   x1x[12] := 2.5;
    x1x[03] := 130;  x1x[13] := 131;
    x1x[04] := 141;  x1x[14] := 145;
    x1x[05] := 150;  x1x[15] := 151;
    x1x[06] := 160;  x1x[16] := 161;
    PooledModel.Explanatories.Add().Value := x1x;
    // Weights
    x2x[00] := 3;    x2x[10] := 0.5;
    x2x[01] := 6;    x2x[11] := 1;
    x2x[02] := 0.75; x2x[12] := 2;
    x2x[03] := 230;  x2x[13] := 231;
    x2x[04] := 240;  x2x[14] := 241;
    x2x[05] := 250;  x2x[15] := 251;
    x2x[06] := 260;  x2x[16] := 261;
    PooledModel.Weights := x2x;
    // Sample period
    PooledModel.ModelPeriod.FirstPoint := 1;
    PooledModel.ModelPeriod.LastPoint := 5;
    // Latest forecast point
    PooledModel.Forecast.LastPoint := 7;
    // Type of weights
    PooledModel.GLSWeights := GLSWeightsType.glswtPeriodWeights;
    // Model type
    PooledModel.CrossSection := PooledModelCrossSectionType.pmcstNone;
    // Parameters of model coefficients
    Constan := PooledModel.ModelCoefficients.Intercept;
    Constan.Mode := InterceptMode.imNone;
    // Run calculation
    Status := PooledModel.Execute();
    If Status = 0 Then
        System.Diagnostics.Debug.WriteLine("=== Weighted summary statistics ===");
        System.Diagnostics.Debug.WriteLine(" Determination coefficient: " + PooledModel.WeightedSummaryStatistics.R2.ToString());
        System.Diagnostics.Debug.WriteLine(" Mean error: " + PooledModel.WeightedSummaryStatistics.ME.ToString());
        System.Diagnostics.Debug.WriteLine(" Standard error: " + PooledModel.WeightedSummaryStatistics.SE.ToString());
        System.Diagnostics.Debug.WriteLine(" Standard deviation of residuals: " + PooledModel.WeightedSummaryStatistics.SEE.ToString());
        System.Diagnostics.Debug.WriteLine("=== Summary statistics ===");
        System.Diagnostics.Debug.WriteLine(" Determination coefficient: " + PooledModel.SummaryStatistics.R2.ToString());
        System.Diagnostics.Debug.WriteLine(" Mean error: " + PooledModel.SummaryStatistics.ME.ToString());
        System.Diagnostics.Debug.WriteLine(" Standard error: " + PooledModel.SummaryStatistics.SE.ToString());
        System.Diagnostics.Debug.WriteLine(" Standard deviation of residuals: " + PooledModel.SummaryStatistics.SEE.ToString());
        System.Diagnostics.Debug.WriteLine("=== Residuals ===");
        For i := 0 To PooledModel.Residuals.GetUpperBound(1Do
            d1 := PooledModel.Residuals;
            d2 := PooledModel.Residuals;
            System.Diagnostics.Debug.WriteLine(" " + d1[0,i].ToString() + " " + d2[1,i].ToString());
        End For;
    End If;
End Sub;

See also:

ISmPooledModel