Fit a linear model by ridge regression.
lm.ridge(formula, data, subset, na.action, lambda = 0, model = FALSE,
x = FALSE, y = FALSE, contrasts = NULL, ...)
select(obj)
A list with components
matrix of coefficients, one row for each value of lambda
.
Note that these are not on the original scale and are for use by the
coef
method.
scalings used on the X matrix.
was intercept included?
vector of lambda values
mean of y
column means of x
matrix
vector of GCV values
HKB estimate of the ridge constant.
L-W estimate of the ridge constant.
a formula expression as for regression models, of the form
response ~ predictors
. See the documentation of formula
for other details. offset
terms are allowed.
an optional data frame, list or environment in which to interpret the
variables occurring in formula
.
expression saying which subset of the rows of the data should be used in the fit. All observations are included by default.
a function to filter missing data.
A scalar or vector of ridge constants.
should the model frame be returned? Not implemented.
should the design matrix be returned? Not implemented.
should the response be returned? Not implemented.
a list of contrasts to be used for some or all of factor terms in the
formula. See the contrasts.arg
of model.matrix.default
.
additional arguments to lm.fit
.
an R object, such as an "lm.ridge"
fit.
If an intercept is present in the model, its coefficient is not penalized. (If you want to penalize an intercept, put in your own constant term and remove the intercept.)
Brown, P. J. (1994) Measurement, Regression and Calibration Oxford.
longley # not the same as the S-PLUS dataset
names(longley)[1] <- "y"
lm.ridge(y ~ ., longley)
plot(lm.ridge(y ~ ., longley,
lambda = seq(0,0.1,0.001)))
select(lm.ridge(y ~ ., longley,
lambda = seq(0,0.1,0.0001)))
Run the code above in your browser using DataLab