Fit a linear model by ridge regression, returning an object of class "ridge"
.
ridge(formula, data, subset, lambda = 1.0, method = "GCV", ngrid = 200, tol = 1e-07,
na.action, model = FALSE, x = FALSE, y = FALSE, contrasts = NULL, ...)
an object of class "formula"
(or one that
can be coerced to that class): a symbolic description of the model to
be fitted.
an optional data frame, list or environment (or object coercible
by as.data.frame
to a data frame) containing the variables in
the model. If not found in data
, the variables are taken from
environment(formula)
, typically the environment from which ridge
is called.
an optional vector specifying a subset of observations to be used in the fitting process.
a scalar or vector of ridge constants. A value of 0 corresponds to ordinary least squares.
the method for choosing the ridge parameter lambda. If method = "none"
,
then lambda is 'fixed'. If method = "GCV"
(the default) then the ridge
parameter is chosen automatically using the generalized cross validation (GCV) criterion.
For method = "grid"
, optimal value of lambda is selected computing the GCV
criterion over a grid.
number of elements in the grid used to compute the GCV criterion.
Only required if method = "grid"
and lambda
is a scalar.
tolerance for the optimization of the GCV criterion. Default is 1e-7
.
logicals. If TRUE
the corresponding components of
the fit (the model frame, the model matrix, the response) are returned.
an optional list. See the contrasts.arg
of
model.matrix.default
.
additional arguments to be passed to the low level regression fitting functions (not implemented).
A list with the following components:
dimensions of model matrix.
a named vector of coefficients.
a named vector of coefficients.
the fitted mean values.
the residuals, that is response minus fitted values.
the residual sum of squares.
the effective number of parameters.
vector (if method = "grid"
) of GCV values.
HKB estimate of the ridge constant.
LW estimate of the ridge constant.
vector (if method = "grid"
) of lambda values.
value of lambda with the minimum GCV (only relevant if method = "grid"
).
the matched call.
the terms
object used.
(only where relevant) the contrasts used.
if requested, the response used.
if requested, the model matrix used.
if requested, the model frame used.
ridge
function fits in linear ridge regression without scaling or centering
the regressors and the response. In addition, If an intercept is present in the model, its
coefficient is penalized.)
Golub, G.H., Heath, M., Wahba, G. (1979). Generalized cross-validation as a method for choosing a good ridge parameter. Technometrics 21, 215-223.
Hoerl, A.E., Kennard, R.W., Baldwin, K.F. (1975). Ridge regression: Some simulations. Communication in Statistics 4, 105-123.
Hoerl, A.E., Kennard, R.W. (1970). Ridge regression: Biased estimation of nonorthogonal problems. Technometrics 12, 55-67.
Lawless, J.F., Wang, P. (1976). A simulation study of ridge and other regression estimators. Communications in Statistics 5, 307-323.
# NOT RUN {
z <- ridge(GNP.deflator ~ ., data = longley, lambda = 4, method = "grid")
z # ridge regression on a grid over seq(0, 4, length = 200)
z <- ridge(GNP.deflator ~ ., data = longley)
z # ridge parameter selected using GCV (default)
# }
Run the code above in your browser using DataLab