ISmPooledModel.CrossSectionSDinit

Syntax

CrossSectionSDinit: Double;

Description

The CrossSectionSDinit property determines cross-section standard deviation.

Comments

The CrossSectionSDinit property is used for calculation with saved coefficients.

To get standard deviation of group error, use the ISmPooledModel.CrossSectionSD property.

Example

To execute the example, add links to the Stat and MathFin system assemblies.

Sub UserProc;
Var
    PooledModel: ISmPooledModel;
    yY: Array[62Of Double;
    x1x: Array[72Of Double;
    Coefficients: ICoefficients;
    Intercept: IIntercept;
    i, j, Status: Integer;
    arr, Effects, StError, Est, TStat, Prob: Array Of Double;
    IntStError, IntEst, IntTStat, IntProb: Double;
    str: String;
Begin
    PooledModel := New SmPooledModel.Create;
    // Explained values
    yY[00] := 20;    yY[01] := 17;
    yY[10] := 10;    yY[11] := 7;
    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] := 120;  x1x[41] := 141;
    x1x[50] := 150;  x1x[51] := 151;
    x1x[60] := 160;  x1x[61] := 161;
    PooledModel.Explanatories.Add.Value := x1x;
    PooledModel.Explanatories.Item(0).InitValue:=0.5;
    // Parameters of model coefficients
    PooledModel.ModelCoefficients.Intercept.InitValue:=100;
    // Sample period
    PooledModel.ModelPeriod.FirstPoint := 1;
    PooledModel.ModelPeriod.LastPoint := 5;
    // Latest forecast point
    PooledModel.Forecast.LastPoint := 7;
    // Model type
    PooledModel.CrossSection := PooledModelCrossSectionType.RandomEffect;
    // Method to estimate random effects
    PooledModel.RandomEffectsMethod := PooledModelRandomEffectsMethodType.SwamyArora;
    //Set, that the model uses saved coefficients
    PooledModel.ARMA.MaxIteration:=0;
    PooledModel.ARMA.CalcInitMode:=ARMAInitType.Manual;
    // Cross-section standard deviations
    PooledModel.CrossSectionSDinit := 0.030485421521669304;
    // Initial values of effects for calculation without estimation
    arr:=New Double[PooledModel.Explained.Value.GetUpperBound(2)+1];
    For i:=0 To arr.Length-1 Do
        arr[i]:=(i-1)*math.Power(-1,i+2);
    End For;
    PooledModel.EffectsInits := arr;
    // Specifications of random effects, for calculation without estimation
    PooledModel.IdiosyncraticSDinit := 0.31046596048669278;
    // Start calculation
    Status := PooledModel.Execute;
    Debug.WriteLine(PooledModel.Errors);
    If Status = 0 Then
        Debug.WriteLine("Estimates of constant:");
        Intercept := PooledModel.ModelCoefficients.Intercept;
            IntEst := Intercept.Estimate;
            IntStError := Intercept.StandardError;
            IntTStat := Intercept.TStatistic;
            IntProb := Intercept.Probability;
            Debug.WriteLine(" " + IntEst.ToString + " " 
                + IntStError.ToString + " " + IntTStat.ToString + " " + IntProb.ToString);
        Debug.WriteLine("Estimates of model coefficients:");
        Coefficients := PooledModel.ModelCoefficients.Coefficients;
        j := Coefficients.Estimate.Length;
        For i := 0 To j - 1 Do
            Est := Coefficients.Estimate;
            StError := Coefficients.StandardError;
            TStat := Coefficients.TStatistic;
            Prob := Coefficients.Probability;
            Debug.WriteLine(" " + (i + 1).ToString + ": " + Est[i].ToString + " " 
                + StError[i].ToString + " " + TStat[i].ToString + " " + Prob[i].ToString);
        End For;
        Debug.WriteLine("Calculated effects: ");
        Effects := PooledModel.Effects;
        For i := 0 To PooledModel.Effects.Length-1 Do
            Debug.WriteLine(" " + (i+1).ToString + ": " + Effects[i].ToString);
        End For;
        Debug.WriteLine("Covariance matrix");
        For i := 0 To PooledModel.CovarianceMatrix.GetUpperBound(1Do
            str := "";
            For j := 0 To PooledModel.CovarianceMatrix.GetUpperBound(2Do
                str := str + "  " + (PooledModel.CovarianceMatrix[i, j] As Double).ToString;
            End For;
            Debug.WriteLine(str);
        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.

See also:

ISmPooledModel