ProbabilityUpperConfidenceLevel: Array;
ProbabilityUpperConfidenceLevel: System.Array;
The ProbabilityUpperConfidenceLevel property returns upper confidence limit for a probabilistic forecasting series.
To get lower confidence limit for a probabilistic forecasting series, use the ISmBinaryModel.ProbabilityLowerConfidenceLevel property.
To execute the example, add a link to the Stat system assembly.
Sub UserProc;
Var
bm: SmBinaryModel;
can: Array[14] Of Double;
bin2: Array[9] Of Integer;
i, res: Integer;
Intercept: IIntercept;
Explanatories: ISlSeries;
Begin
bm := New SmBinaryModel.Create;
// Set values of explanatory series
can[00] := 6.209; can[08] := 5;
can[01] := 6.385; can[09] := 6;
can[02] := 6.29; can[10] := Double.Nan;
can[03] := Double.Nan; can[11] := 8;
can[04] := 6.1; can[12] := 5;
can[05] := 5; can[13] := 5;
can[06] := 5.5;
can[07] := 4.45;
// Set explained series values
bin2[00] := 1; bin2[05] := 0;
bin2[01] := 1; bin2[06] := 1;
bin2[02] := 0; bin2[07] := 0;
bin2[03] := 1; bin2[08] := 1;
bin2[04] := 1;
// Set values for the first and the last points of the identification period
bm.ModelPeriod.FirstPoint := 1;
bm.ModelPeriod.LastPoint := 9;
// Set value for the last forecast point
bm.Forecast.LastPoint := 14;
// Set method of missing data treatment
bm.MissingData.Method := MissingDataMethod.SampleAverage;
// 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 calculating 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(" === Forecast series ===");
For i := 0 To bm.Forecast.Value.Length - 1 Do
Debug.WriteLine(bm.Forecast.Value[i])
End For;
Debug.WriteLine(" === Probabilistic forecasting series === ");
For i := 0 To bm.ProbabilityForecast.Length - 1 Do
Debug.WriteLine(bm.ProbabilityForecast[i])
End For;
Debug.WriteLine(" === Lower confidence limit for probabilistic forecasting series === ");
For i := 0 To bm.ProbabilityLowerConfidenceLevel.Length - 1 Do
Debug.WriteLine(bm.ProbabilityLowerConfidenceLevel[i])
End For;
Debug.WriteLine(" === Upper confidence limit for probabilistic forecasting series === ");
For i := 0 To bm.ProbabilityUpperConfidenceLevel.Length - 1 Do
Debug.WriteLine(bm.ProbabilityUpperConfidenceLevel[i])
End For;
Else
Debug.WriteLine(bm.Errors);
End If;
End Sub UserProc;
After executing the example the console window displays: values of forecast series and probabilistic forecasting series, lower and upper confidence limits for probabilistic forecasting series.
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[14] Of Double;
bin2: Array[9] Of Integer;
i, res: Integer;
Intercept: IIntercept;
Explanatories: ISlSeries;
Forecast, ProbForecast, ProbLowerConfLvl, ProbUpConfLvl: System.Array;
Begin
bm := New SmBinaryModel.Create();
// Set values of explanatory series
can[00] := 6.209; can[08] := 5;
can[01] := 6.385; can[09] := 6;
can[02] := 6.29; can[10] := Double.Nan;
can[03] := Double.Nan; can[11] := 8;
can[04] := 6.1; can[12] := 5;
can[05] := 5; can[13] := 5;
can[06] := 5.5;
can[07] := 4.45;
// Set explained series values
bin2[00] := 1; bin2[05] := 0;
bin2[01] := 1; bin2[06] := 1;
bin2[02] := 0; bin2[07] := 0;
bin2[03] := 1; bin2[08] := 1;
bin2[04] := 1;
// Set values for the first and the last points of the identification period
bm.ModelPeriod.FirstPoint := 1;
bm.ModelPeriod.LastPoint := 9;
// Set value for the last forecast point
bm.Forecast.LastPoint := 14;
// Set method of missing data treatment
bm.MissingData.Method := MissingDataMethod.mdmSampleAverage;
// 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 = 0) Then
System.Diagnostics.Debug.WriteLine(" === Forecast series ===");
Forecast := bm.Forecast.Value;
For i := 0 To bm.Forecast.Value.Length - 1 Do
System.Diagnostics.Debug.WriteLine(Forecast[i])
End For;
System.Diagnostics.Debug.WriteLine(" === Probabilistic forecasting series === ");
ProbForecast := bm.ProbabilityForecast;
For i := 0 To bm.ProbabilityForecast.Length - 1 Do
System.Diagnostics.Debug.WriteLine(ProbForecast[i])
End For;
System.Diagnostics.Debug.WriteLine(" === Lower confidence limit for probabilistic forecasting series === ");
ProbLowerConfLvl := bm.ProbabilityLowerConfidenceLevel;
For i := 0 To bm.ProbabilityLowerConfidenceLevel.Length - 1 Do
System.Diagnostics.Debug.WriteLine(ProbLowerConfLvl[i])
End For;
System.Diagnostics.Debug.WriteLine(" === Upper confidence limit for probabilistic forecasting series === ");
ProbUpConfLvl := bm.ProbabilityUpperConfidenceLevel;
For i := 0 To bm.ProbabilityUpperConfidenceLevel.Length - 1 Do
System.Diagnostics.Debug.WriteLine(ProbUpConfLvl[i])
End For;
Else
System.Diagnostics.Debug.WriteLine(bm.Errors);
End If;
End Sub;
See also: