IStatistics.Logest

Syntax

Logest(
    KnownYs: Array;
    KnownXs: Array;
    HasConstant: Boolean;
    ReturnStatistics: Boolean): Array;

Parameters

KnownYs. Set of known y-values.

KnownXs. Set of known x-values.

HasConstant. Determines if the constant b equals to one. Available values:

ReturnStatistics. Determines whether to return additional regressive statistics. Available values:

Description

The Logest method returns exponential trend parameters.

Comments

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:

Example

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[42];
    x[00] := 1; x[01] := 5;
    x[10] := 2; x[11] := 6;
    x[20] := 3; x[21] := 7;
    x[30] := 4; x[31] := 8;
    // Call the method
    st := New Statistics.Create;
    res := st.Logest(y, x, FalseTrue);
    // 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.

See also:

IStatistics