3.5.2.16 Intercept

Description

This function is used to calculate the intercept of the linear regression of the given curve, which is defined as:

a = \bar{y} - b \bar{x}

where,

b is the slope which is defined as b = \frac{\sum{(x-\bar{x})(y-\bar{y})}}{\sum{(x-\bar{x})^2}},

\bar{x} and \bar{y} are the means of x and y.

Syntax

 double Intercept(vector vx, vector vy)

Parameters

vx

Input vector for independent variable.

vy

Input vector for dependent variable.

Return

Return the the intercept of the linear regression of the given curve.

Example

newbook;
col(A) = data(1,5);
col(B) = uniform(5);
Intercept(col(A),col(B)) = ;

See Also

Slope