ridge.lm: Fitting Linear Models with Ridge Penalty

Description Usage Arguments Value

View source: R/ridge.lm.R

Description

Implementation of the analytical solution for a linear regression model with a Ridge penalty term.

Usage

1
ridge.lm(formula, data, lambda, intercept = F, standardize = F, beta.tol = 0)

Arguments

formula

an object of class formula: a symbolic description of the model to be fitted following the standard of lm.

data

an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment (formula), typically the environment from which this function is called.

lambda

penalty term scaling hyperparameter.

intercept

optional boolean indicating whether to fit an intercept. If TRUE, standardize is ignored. Default is FALSE.

standardize

optional boolean indicating whether to return results for standardized data. If intercept is TRUE, this argument is ignored. Default is FALSE. TRUE, standardize is ignored. Default is FALSE.

beta.tol

optional absolute tolerance for rounding down parameter standardized estimates. If the absolute value of a parameter estimate in the standardized model is smaller than beta.tol, it is rounded down to zero. Default is 0, that is, no rounding.

Value

ridge.lm returns an object of class mlkit.lm.fit. An object of class mlkit.lm.fit is a list containing at least the following components:

coefficients

a named vector of optimal coefficients.

loss

residual sum of squares for optimal coefficients.

r2

coefficient of determination for optimal coefficients.

adj.r2

adjusted coefficient of determination for optimal coefficients.


Accelerytics/mlkit documentation built on Dec. 31, 2020, 9:46 a.m.