AdjR2: Double;
AdjR2: double;
The AdjR2 property returns adjusted determination coefficient.
A model with a greater criterion value is preferable.
To execute the example, add a link to the Stat system assembly.
Sub UserProc;
Var
LinearR: SmLinearRegress;
can, fr: Array[9] Of Double;
res, i: Integer;
Con: IIntercept;
ss: ISummaryStatistics;
Begin
LinearR := New SmLinearRegress.Create;
For i := 0 To 8 Do
can[i] := 1230 + i * 302;
fr[i] := 579.5 + i * 9.4;
End For;
// Set model parameters
LinearR.Explained.Value := can;
LinearR.Explanatories.Add.Value := fr;
Con := LinearR.ModelCoefficients.Intercept;
con.Mode := InterceptMode.ManualEstimate;
con.Estimate := 35.7;
// Run calculation
res := LinearR.Execute;
ss := LinearR.SummaryStatistics;
Debug.Write("Adjusted determination coefficient: ");
Debug.WriteLine(ss.AdjR2);
Debug.Write("Adjusted determination coefficient (uncentered): ");
Debug.WriteLine(ss.AdjR2_2);
Debug.Write("Akaike information criterion: ");
Debug.WriteLine(ss.AIC);
Debug.Write("Logarithmic average of the likelihood function: ");
Debug.WriteLine(ss.AvgLogL);
End Sub UserProc;
After executing the example the console window displays summary statistics:
Adjusted determination coefficient.
Adjusted determination coefficient (uncentered).
Akaike information criterion.
Mean of log-likelihood function.
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
LinearR: SmLinearRegress;
can, fr: Array[9] Of Double;
res, i: Integer;
Con: IIntercept;
ss: ISummaryStatistics;
Begin
LinearR := New SmLinearRegress.Create();
For i := 0 To 8 Do
can[i] := 1230 + i * 302;
fr[i] := 579.5 + i * 9.4;
End For;
// Set model parameters
LinearR.Explained.Value := can;
LinearR.Explanatories.Add().Value := fr;
Con := LinearR.ModelCoefficients.Intercept;
con.Mode := InterceptMode.imManualEstimate;
con.Estimate := 35.7;
// Run calculation
res := LinearR.Execute();
ss := LinearR.SummaryStatistics;
System.Diagnostics.Debug.Write("Adjusted determination coefficient: ");
System.Diagnostics.Debug.WriteLine(ss.AdjR2);
System.Diagnostics.Debug.Write("Adjusted determination coefficient (uncentered): ");
System.Diagnostics.Debug.WriteLine(ss.AdjR2_2);
System.Diagnostics.Debug.Write("Akaike information criterion: ");
System.Diagnostics.Debug.WriteLine(ss.AIC);
System.Diagnostics.Debug.Write("Logarithmic average of the likelihood function: ");
System.Diagnostics.Debug.WriteLine(ss.AvgLogL);
End Sub;
See also: