Logest(
KnownYs: Array;
KnownXs: Array;
HasConstant: Boolean;
ReturnStatistics: Boolean): Array;
Logest(
KnownYs: System.Array;
KnownXs: System.Array;
HasConstant: boolean;
ReturnStatistics: boolean): System.Array;
KnownYs. Set of known y-values.
KnownXs. Set of known x-values.
HasConstant. Determines if the constant b equals to one. Available values:
True. The constant is calculated.
False. b is assumed to be equal to one.
ReturnStatistics. Determines whether to return additional regressive statistics. Available values:
True. The method returns regressive statistics.
False. Regressive statistics are not calculated.
The Logest method returns exponential trend parameters.
This method calculates exponential curve that approximates data, and returns an array of values that describe this curve.
Equation of a curve: y = b * mx.
If there are several x-values, where dependent y-values are functions of independent x-values, the equation of a curve looks like follows: y = b * m1x1 * m2x2.
The values of m are the base raised to the power x, while the values of b are constant. y, x and m can be vectors.
The Logest method returns the following array: {mn;mn-1;…;m1;b}. If additional regressive statistics are calculated, the Logest function returns the following array: {mn;mn-1;…;m1;b;sen;sen-1;…;se1;seb;r2;sey;F;df;ssreg;ssresid}.
Additional regressive statistics are described in the chapter IStatistics.Linest.
The figure shown below gdemonstrates the order of returning additional regressive statistics:
Working with parameters:
If there is only one column in the KnownYs array, each column of the KnownXs array is regarded as a separate variable.
If there is only one row in the KnownYs array, each row of the KnownXs array is regarded as a separate variable.
The KnownXs array can contain one or more variable sets. If only one variable is used, KnownYs and KnownXs can have any form, provided that they have the same dimension. If several variables are used, KnownYs must be a vector (that is, an interval with a row height or a column width).
To execute the example, add a link to the Stat system assembly.
Sub UsesProcLogest;
Var
st: Statistics;
i: Integer;
y, x, res: Array Of Double;
Begin
// Define the range of known values of y
y := New Double[4];
y[0] := 0.2; y[2] := 5;
y[1] := 9; y[3] := 7;
// Define the range of known values of x
x := New Double[4, 2];
x[0, 0] := 1; x[0, 1] := 5;
x[1, 0] := 2; x[1, 1] := 6;
x[2, 0] := 3; x[2, 1] := 7;
x[3, 0] := 4; x[3, 1] := 8;
// Call the method
st := New Statistics.Create;
res := st.Logest(y, x, False, True);
// Show results in console window
Debug.WriteLine(st.Errors);
If st.Status = 0 Then
For i := 0 To 4 Do
Debug.Write(res[i, 0].ToString + "; ");
Debug.WriteLine(res[i, 1]);
End For;
End If;
End Sub UsesProcLogest;
After executing the example the console window shows a results array that contains additional regressive statistics.
Imports Prognoz.Platform.Interop.Stat;
…
Public Shared Sub UsesProcLogest();
Var
st: Statistics;
i: integer;
y, x, res: System.Array;
Begin
// Define the range of known values of y
y := New Double[4];
y[0] := 0.2; y[2] := 5;
y[1] := 9; y[3] := 7;
// Define the range of known values of x
x := New Double[2, 4];
x[0, 0] := 1; x[1, 0] := 5;
x[0, 1] := 2; x[1, 1] := 6;
x[0, 2] := 3; x[1, 2] := 7;
x[0, 3] := 4; x[1, 3] := 8;
// Call the method
st := New Statistics.Create();
res := st.Logest(y, x, False, True);
// Show results in console window
System.Diagnostics.Debug.WriteLine(st.Errors);
If st.Status = 0 Then
For i := 0 To 4 Do
System.Diagnostics.Debug.Write(res[0, i].ToString() + "; ");
System.Diagnostics.Debug.WriteLine(res[1, i]);
End For;
End If;
End Sub;
After executing the example the console window shows a results array that contains additional regressive statistics.
See also: