Gabriel Haeck <haeckgabriel@gmail.com>
This pakcage performs the basic tasks of Linear Regression in (base) Racket. It supports univariate as well as multivariate covariates. The code can be found here.
To install this library, use:
raco pkg install linear-regression
You can keep the package up to date by using
raco pkg update linear-regression
The package gives public use to four functions:
csv-transform
coeffs
predict
r2_adj
This function takes a csv file as input. More specifically, it is structured by rows: The first row contains the observation data, and any subsequent row is a covariate.
It returns a list of two matrices: the first matrix is the observations, and the other matrix are your covariates (which may be multivariate).
This function takes the result from csv-transform and calculates the regression coefficients, as a column matrix.
This function takes a matrix of coefficients (the result of coeffs) and a vector of new data, of the correct dimension. It simply returns the predicted value given the coefficients.
This function takes coefficients (result of coeffs) and data set (result of csv-transform) and calculates the adjusted coefficient of correlation.