estRidge {eshrink} | R Documentation |
Estimate Coefficients for Ridge Regression
Description
Computes a vector of regression coefficients for a provided ridge penalty.
Usage
estRidge(lambda, X, y, penalize, XtX = crossprod(X))
Arguments
lambda |
ridge penalty factor |
X |
design matrix for the regression. |
y |
outcome vector. Unless |
penalize |
vector giving penalty structure. Values must be in [0, 1]. See Details for more information. |
XtX |
(optional) cross product of the design matrix. If running simulations or
other procedure for identical |
Details
The input penalize
is a vector of ridge penalty factors,
such that the penalty for covariate j is lambda*penalize[j]
.
Although its primary purpose is for indicating which variables to penalize (1)
and which to not penalize (0), fractional values between 0 and 1 are accepted.
Defaults to c(0, rep(1, p-1)), where
p is number of columns in X (this penalizes all coefficients but
the first).
The design matrix X
is assumed to contain only numeric values, so
any factors should be coded according to desired contrast (e.g., via model.matrix
)
Author(s)
Joshua Keller