LogL: Double;
LogL: double;
The LogL property returns log-likelihood function.
It is used in regression model tests for redundant or missing variables.
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("Log-likelihood function: ");
Debug.WriteLine(ss.LogL);
Debug.Write("Restricted log-likelihood function: ");
Debug.WriteLine(ss.RestrLogL);
Debug.Write("p-value of probability for LR-statistics: ");
Debug.WriteLine(ss.LRprobability);
Debug.Write("LR-statistic: ");
Debug.WriteLine(ss.LRstatistic);
End Sub UserProc;
After executing the example the console window displays summary statistics:
Log-likelihood function.
Restricted log-likelihood function.
p-value of probability for LR-statistics.
LR-statistics value.
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;
// Calculate
res := LinearR.Execute();
ss := LinearR.SummaryStatistics;
System.Diagnostics.Debug.Write("Log-likelihood function: ");
System.Diagnostics.Debug.WriteLine(ss.LogL);
System.Diagnostics.Debug.Write("Restricted log-likelihood function: ");
System.Diagnostics.Debug.WriteLine(ss.RestrLogL);
System.Diagnostics.Debug.Write("p-value of probability for LR -statistics: ");
System.Diagnostics.Debug.WriteLine(ss.LRprobability);
System.Diagnostics.Debug.Write("LR-statistic: ");
System.Diagnostics.Debug.WriteLine(ss.LRstatistic);
End Sub;
See also: