ISmBinaryModel.SummaryStatistics

Fore Syntax

SummaryStatistics: ISummaryStatistics;

Fore.NET Syntax

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

Description

The SummaryStatistics property returns summary statistics.

Comments

Descriptive statistics are calculated using general formulas.

Fore Example

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

Sub UserProc;
Var
    bm: SmBinaryModel;
    can: Array[
9Of Double;
    bin2: Array[
5Of Integer;
    i, res: Integer;
    Intercept: IIntercept;
    Explanatories: ISlSeries;
Begin
    bm := 
New SmBinaryModel.Create;
    
// Set values of the explanatory series
    can[00] := 6.209; can[05] := 5;
    can[
01] := 6.385; can[06] := 6;
    can[
02] := 6.29; can[07] := Double.Nan;
    can[
03] := 6.25; can[08] := 8;
    can[
04] := 6.1;
    
// Set values of the explained series
    bin2[00] := 1; bin2[03] := 0;
    bin2[
01] := 1; bin2[04] := 0;
    bin2[
02] := 0;
   // Set values for the first and the last points of the sample period
    bm.ModelPeriod.FirstPoint := 1;
    bm.ModelPeriod.LastPoint := 
5;
    // Set value for the last forecast point
    bm.Forecast.LastPoint := 9;
    // Select missing data treatment method
    bm.MissingData.Method := MissingDataMethod.Casewise;
    // Set model type
    bm.BinaryDistr := BinaryDistrType.Probit;
    // Set value of group division and accuracy
    bm.ClassificationCutOff := 0.5;
    bm.Tolerance := 
0.001;
    // Set method of estimating the constant
    Intercept := bm.ModelCoefficients.Intercept;
    Intercept.Mode := InterceptMode.AutoEstimate;
    
// Set explained series
    bm.BinaryExplained := bin2;
    
// Set explanatory series
    Explanatories := bm.Explanatories;
    Explanatories.Add.Value := can;
    // Perform calculation and display error  messages
    res:=bm.Execute;
    // Display calculation results
    If (res = 0Then
        Debug.WriteLine(
" === Model series ===");
        
For i := 0 To bm.Fitted.Length - 1 Do
            Debug.WriteLine(bm.Fitted[i])
        
End For;
        Debug.WriteLine(
" === Residuals series ===");
        
For i := 0 To bm.Residuals.Length - 1 Do
            Debug.WriteLine(bm.Residuals[i])
        
End For;
        Debug.WriteLine(
" === Descriptive statistics === ");
        Debug.WriteLine(
"McFadden determination coefficient: "+bm.SummaryStatistics.McFaddenRsquared.ToString);
        Debug.WriteLine(
"Sum of residual squares: "+bm.SummaryStatistics.SSR.ToString);
        Debug.WriteLine(
"Akaike information criterion: "+bm.SummaryStatistics.AIC.ToString);
        Debug.WriteLine(
"Schwarz information criterion: "+bm.SummaryStatistics.SC.ToString);
        
Else
            Debug.WriteLine(bm.Errors);
    
End If
End Sub UserProc;

After executing the example the console window displays a modeling series, residual series, and calculated summary statistics.

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
    bm: SmBinaryModel;
    can: Array[9Of Double;
    bin2: Array[5Of Integer;
    i, res: Integer;
    Intercept: IIntercept;
    Explanatories: ISlSeries;
    Fitted, Residuals: System.Array;
Begin
    bm := New SmBinaryModel.Create();
    // Set values of explanatory series
    can[00] := 6.209; can[05] := 5;
    can[01] := 6.385; can[06] := 6;
    can[02] := 6.29; can[07] := Double.Nan;
    can[03] := 6.25; can[08] := 8;
    can[04] := 6.1;
    // Set explained series values
    bin2[00] := 1; bin2[03] := 0;
    bin2[01] := 1; bin2[04] := 0;
    bin2[02] := 0;
   // Set values for the first and the last points of the identification period
    bm.ModelPeriod.FirstPoint := 1;
    bm.ModelPeriod.LastPoint := 5;
    // Set value for the last forecast point
    bm.Forecast.LastPoint := 9;
     // Set missing data treatment method
    bm.MissingData.Method := MissingDataMethod.mdmCasewise;
    // Set model type
    bm.BinaryDistr := BinaryDistrType.bdtProbit;
    // Set value of group division and accuracy
    bm.ClassificationCutOff := 0.5;
    bm.Tolerance := 0.001;
    // Set method of calculating the constant
    Intercept := bm.ModelCoefficients.Intercept;
    Intercept.Mode := InterceptMode.imAutoEstimate;
    // Set explained series
    bm.BinaryExplained := bin2;
    // Set explanatory series
    Explanatories := bm.Explanatories;
    Explanatories.Add().Value := can;
    // Perform calculation and display error  messages
    res:=bm.Execute();
    // Display calculation results
    If (res = 0Then
        System.Diagnostics.Debug.WriteLine(" === Model series ===");
        Fitted := bm.Fitted;
        For i := 0 To bm.Fitted.Length - 1 Do
            System.Diagnostics.Debug.WriteLine(Fitted[i])
        End For;
        System.Diagnostics.Debug.WriteLine(" === Residuals series === ");
        Residuals := bm.Residuals;
        For i := 0 To bm.Residuals.Length - 1 Do
            System.Diagnostics.Debug.WriteLine(Residuals[i])
        End For;
        System.Diagnostics.Debug.WriteLine(" === Descriptive statistics === ");
        System.Diagnostics.Debug.WriteLine("McFadden determination coefficient: "+bm.SummaryStatistics.McFaddenRsquared.ToString());
        System.Diagnostics.Debug.WriteLine("Sum of residuals squares: "+bm.SummaryStatistics.SSR.ToString());
        System.Diagnostics.Debug.WriteLine("Akaike information criterion: "+bm.SummaryStatistics.AIC.ToString());
        System.Diagnostics.Debug.WriteLine("Schwarz information criterion: "+bm.SummaryStatistics.SC.ToString());
        Else
            System.Diagnostics.Debug.WriteLine(bm.Errors);
    End If;
End Sub;

See also:

ISmBinaryModel