lmridge (version 1.2)

lmridge: Linear Ridge Regression

Description

Fits a linear ridge regression model after scaling regressors and returns an object of class "lmridge" (by calling lmridgeEst function) designed to be used in plotting method, testing of ridge coefficients and for computation of different ridge related statistics. The ridge biasing parameter \(K\) can be a scalar or a vector. See Hoerl et al., 1975 <https://doi.org/10.1080/03610927508827232>, Horel and Kennard, 1970 <http://doi.org/10.2307/1267351>.

Usage

lmridge(formula, data, K = 0, scaling=c("sc", "scaled", "centered"), …)
lmridgeEst(formula, data, K=0, scaling=c("sc", "scaled", "centered"), …)
# S3 method for default
lmridge(formula, data, K = 0, scaling=c("sc", "scaled", "centered"), …)
# S3 method for lmridge
coef(object, …)
# S3 method for lmridge
print(x, digits = max(5,getOption("digits") - 5), …)
# S3 method for lmridge
fitted(object, …)

Arguments

formula

Standard R formula expression, that is, a symbolic representation of the model to be fitted and has form response~predictors. For further details, see formula.

data

An optional 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 lmridge or lmridgeEst is called.

K

Ridge biasing parameter (may be a vector).

scaling

The method to be used to scale the predictors. The scaling option "sc" scales the predictors to correlation form, such that the correlation matrix has unit diagonal elements. "scaled" option standardizes the predictors to have zero mean and unit variance. "centered" option centers the predictors.

object

A lmridge object, typically generated by a call to lmridge for fitted.lmridge, predict.lmridge, vcov.lmridge, residuals.lmridge, infocr.lmridge, coef.lmridge, summary.lmridge and press.lmridge functions.

x

An object of class lmridge (for the hatr.lmridge, rstats1.lmridge, rstats2.lmridge, vif.lmridge, kest.lmridge, summary.lmride, print.lmridge, print.summary.lmridge, print.klmridge, print.rstats1, print.rstats2, and plot.lmridge, bias.plot, cv.plot, info.plot, isrm.plot, and rplots.plot functions).

digits

Minimum number of significant digits to be used.

Additional arguments to be passed to or from other methods.

Value

lmridge function returns an object of class "lmridge" after calling list of named objects from lmridgeEst function:

coef

A named vector of fitted coefficients.

call

The matched call.

Inter

Was an intercept included?

scaling

The scaling method used.

mf

Actual data used.

y

The response variable.

xs

The scaled matrix of predictors.

xm

The vector of means of the predictors.

terms

The terms object used.

xscale

Square root of sum of squared deviation from mean regarding the scaling option used in lmridge or lmridgeEst function as argument.

rfit

The fitted value of ridge regression for given biasing parameter \(K\).

K

The ridge regression biasing parameter \(K\) which can be scalar or a vector.

d

A vector of singular values of scaled X matrix.

div

Eigenvalues of scaled regressors.

Z

A list of matrix \((X'X+KI)^{-1}X'\) for further computations.

Details

lmridge or lmridgeEst function fits in linear ridge regression after scaling the regressors and centering the response. The lmridge is default a function that calls lmridgeEst for computation of ridge coefficients and returns an object of class "lmridge" designed to be used in plotting method, testing of ridge coefficients and for computation of different ridge related statistics. If intercept is present in the model, its coefficient is not penalized. However, intercept is estimated from the relation \(y=\overline{y}-\beta \overline{X}\). print.lmridge tries to be smart about formatting of ridge coefficients.

References

Hoerl, A. E., Kennard, R. W., and Baldwin, K. F. (1975). Ridge Regression: Some Simulation. Communication in Statistics, 4, 105-123. Hoer et al., 1975.

Hoerl, A. E. and Kennard, R. W., (1970). Ridge Regression: Biased Estimation of Nonorthogonal Problems. Technometrics, 12, 55-67. Hoerl and Kennard, 1970.

Imdad, M. U. Addressing Linear Regression Models with Correlated Regressors: Some Package Development in R (Doctoral Thesis, Department of Statistics, Bahauddin Zakariya University, Multan, Pakistan), 2017.

See Also

Testing of ridge coefficient summary.lmridge

Examples

Run this code
# NOT RUN {
data(Hald)
mod <- lmridge(y~., data = as.data.frame(Hald), K = seq(0, 0.1, 0.01), scaling = "sc")
## Scaled Coefficients
mod$coef

## Re-Scaled Coefficients
coef(mod)

## ridge predicted values
predict(mod)

## ridge residuals
residuals(mod)

##ridge and VIF trace
plot(mod)

## ridge VIF values
vif(mod)

## ridge Var-Cov matrix
vcov(mod)

## ridge biasing parameter by researchers
kest(mod)

## ridge fitted values
fitted(mod)

## ridge statistics 1
rstats1(mod)

## ridge statistics 2
rstats2(mod)

## list of objects from lmridgeEst function
lmridgeEst(y~., data = as.data.frame(Hald), K = seq(0, 0.1, 0.01), scaling = "sc")
# }

Run the code above in your browser using DataCamp Workspace