linear-regression
1 Installation
2 Using the Package
2.1 csv-transform
2.2 coeffs
2.3 predict
2.4 r2_  adj
8.12

linear-regression🔗ℹ

Gabriel Haeck <haeckgabriel@gmail.com>

 (require linear-regression) package: linear-regression

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.

1 Installation🔗ℹ

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

2 Using the Package🔗ℹ

The package gives public use to four functions:

2.1 csv-transform🔗ℹ

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).

2.2 coeffs🔗ℹ

This function takes the result from csv-transform and calculates the regression coefficients, as a column matrix.

2.3 predict🔗ℹ

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.

2.4 r2_adj🔗ℹ

This function takes coefficients (result of coeffs) and data set (result of csv-transform) and calculates the adjusted coefficient of correlation.