OLSRegression

Performs Ordinary Least Squares fit of the data with the response. The default is to assume that an intercept term will be estimated.

Parameters

regressionData

specifies the data for the regression

Constructors

Link copied to clipboard
constructor(df: AnyFrame, responseName: String, predictorNames: List<String>, hasIntercept: Boolean = true)

Create the regression data from a data frame. The data frame must have a column with the response name responseName and columns with the names in the list predictorNames. The data type of these columns must be Double. hasIntercept indicates if the regression should include an intercept term. The default is true. The data in the data frame does not need to have a column for estimating the intercept.

constructor(regressionData: RegressionData)

Properties

Link copied to clipboard
open override val adjustedRSquared: Double

This is the adjusted R-squared = 1 - ((1 - R-squared)*(n-1)/(n-p)) where n is the number of observations and p is the number of parameters estimated (including the intercept).

Link copied to clipboard
open override val errorVariance: Double

An estimate of the variance of the (residual) errors. This is MSE = SSE/(n-p)

Link copied to clipboard
open override val hasIntercept: Boolean

Indicates true if the regression model includes an intercept term.

Link copied to clipboard
open override val hatMatrix: Array<DoubleArray>

The hat matrix is defined in terms of the design matrix X by

$X(X^{T}X)^{-1}X^{T}$

Link copied to clipboard
open override val numObservations: Int

The total number of observations (y_1, y_2, ..., y_n), where n = the number of observations.

Link copied to clipboard
open override val numParameters: Int

Number of parameters in the model (including the intercept, if estimated)

Link copied to clipboard
open override val parameters: DoubleArray

An array containing the estimated parameters of the regression. The b_0, b_1_,..., b_k, where b_0 is the intercept term and k is the number of parameters estimated, so p = k + 1 is the total number of parameters (including the intercept term).

Link copied to clipboard
open override val parametersStdError: DoubleArray

The standard error estimate for each regression coefficient.

Link copied to clipboard

Estimates for the variance of the regression parameters. The variance-covariance matrix of the regression parameters

Link copied to clipboard
open override val predictorNames: List<String>

The names of the predictor variables

Link copied to clipboard
open override val regressandVariance: Double

An estimate of the variance of Y. The sample variance of the dependent variable.

Link copied to clipboard
open override val regressionStandardError: Double

The average distance that the observed values fall from the regression line. It tells you how wrong the regression model is on average using the units of the response variable. Smaller values are better because it indicates that the observations are closer to the fitted line. The standard deviation of the errors in the regression model. Sometimes called the standard error of the estimate. This is the square root of MSE.

Link copied to clipboard
open override val residuals: DoubleArray

The array of residual errors, e_i = (y_i - yHat_i)

Link copied to clipboard
open override val residualSumOfSquares: Double

This is SSE (sum of squared residual error).

Link copied to clipboard
open override val response: DoubleArray

The response values, the regressand values, the Y's

Link copied to clipboard
open override var responseName: String

The name of the response variable

Link copied to clipboard
open override val rSquared: Double

This is the coefficient of multiple determination. R-squared = SSR/SST = 1 - SSE/SST, where SSE is the sum of squared residuals, SST is the total sum of squares, and SSR is the sum of squares for the regression. Note that SST = SSR + SSE.

Link copied to clipboard

The array of standardize residuals

Link copied to clipboard
open override val totalSumOfSquares: Double

The SST total sum of squares. Sum of squared deviations of Y from its mean.

Functions

Link copied to clipboard
fun loadData(regressionData: RegressionData)

Loads a new dataset for performing the regression analysis.

Link copied to clipboard
open override fun predictorData(name: String): DoubleArray

The data associated with the named predictor. The name must exist as a predictor name.

Link copied to clipboard
open override fun toString(): String