lmridge {lmridge} | R Documentation |
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 <doi:10.1080/03610927508827232>, Horel and Kennard, 1970 <doi:10.1080/00401706.1970.10488634>.
Usage
lmridge(formula, data, K = 0, scaling=c("sc", "scaled", "non", "centered"), ...)
lmridgeEst(formula, data, K=0, scaling=c("sc", "scaled", "non", "centered"), ...)
## Default S3 method:
lmridge(formula, data, K = 0, scaling=c("sc", "scaled", "non", "centered"), ...)
## S3 method for class 'lmridge'
coef(object, ...)
## S3 method for class 'lmridge'
print(x, digits = max(5,getOption("digits") - 5), ...)
## S3 method for class 'lmridge'
fitted(object, ...)
Arguments
formula |
Standard R formula expression, that is, a symbolic representation of the model to be fitted and has form |
data |
An optional data frame containing the variables in the model. If not found in data, the variables are taken from |
K |
Ridge biasing parameter (may be a vector). |
scaling |
The method to be used to scale the predictors. The scaling option |
object |
A lmridge object, typically generated by a call to |
x |
An object of class |
digits |
Minimum number of significant digits to be used. |
... |
Additional arguments to be passed to or from other methods. |
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.
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 |
xscale |
Square root of sum of squared deviation from mean regarding the scaling option used in |
rfit |
The fitted value of ridge regression for given biasing parameter |
K |
The ridge regression biasing parameter |
d |
A vector of singular values of scaled |
div |
Eigenvalues of scaled regressors. |
Z |
A list of matrix |
Note
The function at the current form cannot handle missing values. The user has to take prior action with missing values before using this function.
Author(s)
Muhammad Imdad Ullah, Muhammad Aslam
References
Hoerl, A. E., Kennard, R. W., and Baldwin, K. F. (1975). Ridge Regression: Some Simulation. Communication in Statistics, 4, 105-123. doi:10.1080/03610927508827232.
Hoerl, A. E. and Kennard, R. W., (1970). Ridge Regression: Biased Estimation of Nonorthogonal Problems. Technometrics, 12, 55-67. doi:10.2307/1267351.
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
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")
lmridgeEst(y~., data = as.data.frame(Hald), K = seq(0, 0.1, 0.01), scaling = "non")