Investment Studio > Expressions > Functions > Statistical > INTERCEPT

float intercept(float array known_ys, float array known_xs)

Returns the y value at x = 0, computed by linear regression (i.e. least square fit of a straight line to the data) of a set of known y(x) pairs.

known_ys and known_xs contain the known y(x) pairs. Arrays with different dimensions are allowed as long as they all have the same number of elements (e.g. 2 x 3 and 3 x 2 arrays). Corresponding elements are determined by order of appearance (reading from left to right, top to bottom).

All array elements are converted to float, with exclusion if conversion fails.

Equivalent to forecast(0, known_ys, known_xs).

Example

=intercept({1, 2, 3, 4}, {4, 3, 2, 1})

equals 5.

See also correl, forecast, growth, intercept, linest, logest, rsq, slope, steyx, trend.