Lightweight routine for ridge regression, fitted via a singular value
decomposition. The penalty may be automatically determined by leave-one-out
cross validation. The intercept term is unpenalized.
Usage
ridge(formula, data, penalty = "auto", ...)
# S3 method for ridge
fitted(object, ...)
# S3 method for ridge
coef(object, ...)
# S3 method for ridge
predict(object, newdata, ...)
Value
An object of class ridge with components including:
coef, a vector of coefficients.
fitted, a vector of fitted values.
penalty, the penalty value.
Arguments
formula
A model formula; see formula. The intercept term is
unpenalized; to fit a penalized intercept, remove the intercept and add
your own to the design matrix.
data
An optional data frame or object in which to interpret the
variables occurring in formula.
penalty
The ridge penalty. Must be a single numeric or the string
"auto", in which case the penalty will be determined via leave-one-out
cross validation to minimize the mean squared error.
...
Further arguments, passed on to model.frame() and
model.matrix(). These must be provided to predict.ridge() as well,
if used.