Computes a vector of regression coefficients for a provided ridge penalty.
estRidge(lambda, X, y, penalize, XtX = crossprod(X))
ridge penalty factor
design matrix for the regression.
outcome vector. Unless X
contains an intercept column, this should typically be centered.
vector giving penalty structure. Values must be in [0, 1]. See Details for more information.
(optional) cross product of the design matrix. If running simulations or
other procedure for identical X
, providing a pre-computed value
can reduce computational cost.
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
)