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.
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()
andmodel.matrix()
. These must be provided topredict.ridge()
as well, if used.- object
A fitted
ridge()
model.- newdata
A data frame containing the new data to predict
Value
An object of class ridge
with components including:
coef
, a vector of coefficients.fitted
, a vector of fitted values.penalty
, the penalty value.