Coefficients: ICoefficients;
The Coefficients property determines coefficients' parameters.
To determine parameters of the model constant, use the IModelCoefficients.Intercept property.
To execute the example, add a link to the Stat system assembly.
Sub UserProc;
Var
LR: ISmLinearRegress;
Intercept: IIntercept;
ModelCoefficients: IModelCoefficients;
Coefficients: ICoefficients;
can, fra: Array[10] Of Double;
res, i: Integer;
Begin
LR := New SmLinearRegress.Create;
// Set values for variables
Can[0] := 6209; fra[0] := 4110;
Can[1] := 6385; fra[1] := 4280;
Can[2] := 6495; fra[2] := 4459;
Can[3] := 6837; fra[3] := 4545;
Can[4] := 6495; fra[4] := 4664;
Can[5] := 6907; fra[5] := 4861;
Can[6] := 7349; fra[6] := 5195;
Can[7] := 7213; fra[7] := 5389;
Can[8] := 7061; fra[8] := 5463;
Can[9] := 7180; fra[9] := 5610;
// Set explained variable
LR.Explained.Value := can;
// Set explanatory variables
LR.Explanatories.Clear;
LR.Explanatories.Add.Value := fra;
// Missing data treatment
LR.MissingData.Method := MissingDataMethod.LinInterpolation;
// Parameters of coefficients
ModelCoefficients := LR.ModelCoefficients;
Coefficients := ModelCoefficients.Coefficients;
// Parameters of model constant
Intercept := ModelCoefficients.Intercept;
Intercept.Mode := InterceptMode.AutoEstimate;
res := LR.Execute;
Debug.WriteLine(LR.Errors);
Debug.WriteLine("-----Model coefficients:");
For i := 0 To Coefficients.Estimate.Length - 1 Do
Debug.WriteLine(Coefficients.Estimate[i]);
End For;
Debug.WriteLine("-----Probability of coefficients:");
For i := 0 To Coefficients.Probability.Length - 1 Do
Debug.WriteLine(Coefficients.Probability[i]);
End For;
Debug.WriteLine("-----Standard coefficient errors:");
For i := 0 To Coefficients.StandardError.Length - 1 Do
Debug.WriteLine(Coefficients.StandardError[i]);
End For;
Debug.WriteLine("-----t-statistics of coefficients:");
For i := 0 To Coefficients.TStatistic.Length - 1 Do
Debug.WriteLine(Coefficients.TStatistic[i]);
End For;
Debug.WriteLine("-----Model constant:");
Debug.WriteLine(Intercept.Estimate);
End Sub UserProc;
As a result of the example execution, the following settings are defined:
Method of missing data treatment.
Parameters of coefficients.
Parameters of model coefficients.
The console window displays values of coefficients and constants.
See also: