SummaryStatistics: ISummaryStatistics;
The SummaryStatistics property returns summary statistics.
Descriptive statistics are calculated using general formulas.
To execute the example, add a link to the Stat system assembly.
Sub UserProc;
Var
bm: SmBinaryModel;
can: Array[9] Of Double;
bin2: Array[5] Of 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 = 0) Then
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.
See also: