MAE: Double;
MAE: double;
The MAE property returns mean absolute error.
The standard absolute error is the mean of absolute deviations of dependent variable source values from model values.
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;
// Calculate
res := LinearR.Execute;
ss := LinearR.SummaryStatistics;
Debug.Write("Mean absolute error: ");
Debug.WriteLine(ss.MAE);
Debug.Write("Maximum absolute residual value: ");
Debug.WriteLine(ss.MaxAE);
Debug.Write("McFadden determination coefficient: ");
Debug.WriteLine(ss.McFaddenRsquared);
Debug.Write("Mean of dependent variable: ");
Debug.WriteLine(ss.MD);
Debug.Write("Mean error: ");
Debug.WriteLine(ss.ME);
Debug.Write("Mean squared error: ");
Debug.WriteLine(ss.MSE);
Debug.Write("Root mean squared error: ");
Debug.WriteLine(ss.SqMSE);
Debug.Write("Number of iterations, within which the decision was found: ");
Debug.WriteLine(ss.NumOfIter);
End Sub UserProc;
After executing the example the console window displays calculated summary statistics.
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("Mean absolute error: ");
System.Diagnostics.Debug.WriteLine(ss.MAE);
System.Diagnostics.Debug.Write("Maximum absolute residual value: ");
System.Diagnostics.Debug.WriteLine(ss.MaxAE);
System.Diagnostics.Debug.Write("McFadden determination coefficient: ");
System.Diagnostics.Debug.WriteLine(ss.McFaddenRsquared);
System.Diagnostics.Debug.Write("Mean of dependent variable: ");
System.Diagnostics.Debug.WriteLine(ss.MD);
System.Diagnostics.Debug.Write("Mean error: ");
System.Diagnostics.Debug.WriteLine(ss.ME);
System.Diagnostics.Debug.Write("Mean squared error: ");
System.Diagnostics.Debug.WriteLine(ss.MSE);
System.Diagnostics.Debug.Write("Root mean squared error: ");
System.Diagnostics.Debug.WriteLine(ss.SqMSE);
System.Diagnostics.Debug.Write("Number of iterations, within which the solution was found: ");
System.Diagnostics.Debug.WriteLine(ss.NumOfIter);
End Sub;
See also: