Mode: 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.
See also: