3.5.2.46 Slope

Description

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

b = \frac{\sum{(x-\bar{x})(y-\bar{y})}}{\sum{(x-\bar{x})^2}}

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

Syntax

 double Slope(vector vx, vector vy)

Parameters

vx

Input vector for independent variable.

vy

Input vector for dependent variable.

Return

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

Example

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

See Also

Intercept