Mode: InterceptMode;
Mode: Prognoz.Platform.Interop.Stat.InterceptMode;
The Mode property determines mode of constant assignment.
If:
Mode = InterceptMode.InterceptMode, that is, constant value is defined manually; use the IIntercept.Estimate property to enter constant value.
Mode = InterceptMode.AutoEstimate, that is, constant value is estimated automatically; thus, use the IIntercept.Estimate property to get constant value.
To execute the example, add links to the system assemblies Stat and MathFin.
Sub UserIntercept;
Var
lr: ISmLinearRegress;
Fact: Array[40] Of Double;
Intercept: IIntercept;
i: Integer;
res: Integer;
Begin
lr := New SmLinearRegress.Create;
// Set values of the explained series
For i := 0 To 39 Do
Fact[i] := Math.RandBetween(-40, 40);
End For;
// Set explained series
lr.Explained.Value := Fact;
// Get parameters of constant in the model
Intercept := lr.ModelCoefficients.Intercept;
// Specify that the constant value is estimated automatically
Intercept.Mode := InterceptMode.AutoEstimate;
// Calculate the model
res := lr.Execute;
Debug.WriteLine(lr.Errors);
If (res = 0) Then
// Output value and coefficients of the constant
Debug.WriteLine("Value: " + Intercept.Estimate.ToString);
Debug.WriteLine("Probability: " + Intercept.Probability.ToString);
Debug.WriteLine("Standard error: " + Intercept.StandardError.ToString);
Debug.WriteLine(" t-statistic: " + Intercept.TStatistic.ToString);
End If;
End Sub UserIntercept;
Example execution result: the console window displays value and coefficients of the constant.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Stat;
Imports Prognoz.Platform.Interop.MathFin;
…
Public Shared Sub UserIntercept();
Var
lr: ISmLinearRegress;
Fact: Array[40] Of Double;
Math: MathClass;
Intercept: IIntercept;
i: Integer;
res: Integer;
Begin
lr := New SmLinearRegress.Create();
// Set explained series values
Math := New MathClass.Create();
For i := 0 To 39 Do
Fact[i] := Math.RandBetween(-40, 40);
End For;
// Set explained series
lr.Explained.Value := Fact;
// Get parameters of constant in the model
Intercept := lr.ModelCoefficients.Intercept;
// Specify that the constant value is estimated automatically
Intercept.Mode := InterceptMode.imAutoEstimate;
// Calculates model
res := lr.Execute();
System.Diagnostics.Debug.WriteLine(lr.Errors);
If (res = 0) Then
// Output value and coefficients of the constant
System.Diagnostics.Debug.WriteLine("Value: " + Intercept.Estimate.ToString());
System.Diagnostics.Debug.WriteLine("Probability: " + Intercept.Probability.ToString());
System.Diagnostics.Debug.WriteLine("Standard error: " + Intercept.StandardError.ToString());
System.Diagnostics.Debug.WriteLine(" t-statistic: " + Intercept.TStatistic.ToString());
End If;
End Sub UserIntercept;
See also: