IStatistics.Intercept

Syntax

Intercept(KnownYs: Array; KnownXs: Array): Double;

Parameters

KnownYs. Dependent data set;

KnownXs. Independent set of data.

NOTE. KnownYs and KnownXs must not be empty and must contain equal number of points.

Description

The Intercept method calculates the point of intersection of a line with the Y axis using KnownXs and KnownYs.

Comments

The intersection point lies on the optimal regression line running through KnownXs and KnownYs. The Intercept method is used to calculate the value of dependent variable when the value of independent variable is equal to zero.

Given below is the equation for the point of intersection of a linear regression line:

Where the slope is calculated as follows:

Example

To execute the example, add a link to the Stat system assembly.

Sub UserProc;

Var

st: Statistics;

d0: Double;

y, x, nx: Array Of Double;

Begin

y := New Double[10];

x := New Double[10];

y[00] := 1.6; x[00] := 2;

y[01] := 1.7; x[01] := 4;

y[02] := 1.8; x[02] := 2;

y[03] := 1.9; x[03] := 5;

y[04] := 2; x[04] := 12;

y[05] := 2.1; x[05] := 6;

y[06] := 2.2; x[06] := 15;

y[07] := 2.3; x[07] := 17;

y[08] := 2.4; x[08] := 14;

y[09] := 2.8; x[09] := 3;

st := New Statistics.Create;

d0 := st.Intercept(y,x);

If st.Status <> 0 Then

Debug.WriteLine(st.Errors);

Else

Debug.WriteLine("Intercept: " + d0.ToString);

End If;

End Sub UserProc;

After you have executed this example the console window shows the value indicating the point of intersection of the line with the y axis:

Module execution started

Intercept: 1.887792207792208

Module execution finished

See also:

IStatistics