Numerix v0.6.0 Numerix.LinearRegression View Source
Linear regression functions.
Link to this section Summary
Functions
Least squares best fit for points {x, y}
to a line y:x↦a+bx
where x
is the predictor and y
the response.
Estimates a response y
given a predictor x
and a set of predictors and responses, i.e.
it calculates y
in y:x↦a+bx
.
Measures how close the observed data are to the fitted regression line, i.e. how accurate the prediction is given the actual data.
Link to this section Functions
fit(x, y)
View Sourcefit(Numerix.Common.vector(), Numerix.Common.vector()) :: {float(), float()}
Least squares best fit for points {x, y}
to a line y:x↦a+bx
where x
is the predictor and y
the response.
Returns a tuple containing the intercept a
and slope b
.
predict(x, xs, ys)
View Sourcepredict(number(), Numerix.Common.vector(), Numerix.Common.vector()) :: number()
Estimates a response y
given a predictor x
and a set of predictors and responses, i.e.
it calculates y
in y:x↦a+bx
.
r_squared(predicted, actual)
View Sourcer_squared(Numerix.Common.vector(), Numerix.Common.vector()) :: float()
Measures how close the observed data are to the fitted regression line, i.e. how accurate the prediction is given the actual data.
Returns a value between 0 and 1 where 0 indicates a prediction that is worse than the mean and 1 indicates a perfect prediction.