• line(vx, vy)—Returns a vector containing the coefficients a and b for a line of the form a + b·x that best approximates the data in vectors vx and vy in the least-squares sense.
• slope(vx, vy)—Returns the slope of line that best fits data in vx and vy.
• intercept(vx, vy)—Returns the intercept of line that best fits data in vx and vy.
• stderr(vx,vy)—Returns the standard error associated with a linear regression for the points in vx and vy. It measures how closely data points are spread about the regression line using the following formula:
where n = rows(vx) = rows(vy).
Watch this video to learn more about linear regression:
Arguments
• vx is a vector of real numbers representing the x values.
• vy is a vector of real numbers representing the y values. vy must be the same length as vx.