Thanks to visit codestin.com
Credit goes to github.com

Skip to content

HaeckGabriel/RacketLinearRegression

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Linear Regression in Racket

The Linear Regression methodology in Racket.

Reading a csv FileBasicsFeatures

This library performs linear regression in base Racket. More precisely, it obtains the coefficients of regression, calculates the adjusted coefficient of correlation and lets users predict an outcome given an observation and coefficients. This package works for multivariate covariates.

The Racket package can also be viewed here.

An example is provided in the example folder.

Reading a csv File

The csv-transform function reads a csv file as input and returns a list with the first element being the observation values ( $Y$ ) and the second element being the covariates ( $X$ ). Note: The data is entered by rows and not columns. That is, the first row of the csv file are your observation data, and each subsequent row is a covariate.

Basics

Obtaining the Coefficients

The coefficients $\hat{\beta}$ are obtained as follows:

$$ \hat{\beta} = (X \cdot X^\top)^{-1} \cdot X^\top \cdot Y^\top $$

Adjusted Coefficient of Regression

The adjusted Coefficient of Regression, denoted $R^2_\text{a}$, is defined as

$$ R^2_\text{a} = 1 - \left( \frac{n-1}{n-p} \right) \cdot \frac{ \text{SSE} }{ \text{SSTO} }. $$

Note that if we consider the univariate case, that is $p = 1$, we recuperate the well-known $R^2$ formula.

Features

What this package accomplishes/wants to accomplish in the future

  • Read user input for csv file
  • Obtain Coefficients
  • Perform Predictions given Coefficients and new data
  • Calcualte $R^2_{\text{a}}$
  • Get Confidence Intervals for each coefficient
  • Perform ANOVA

About

Linear Regression in Racket.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages