Ridge Regression
DESCRIPTION:
Fit a linear model by ridge regression.
USAGE:
lm.ridge(formula, data, subset, na.action, lambda = 0, model = F,
x = F, y = F, contrasts=NULL, ...)
REQUIRED ARGUMENTS:
- formula
-
a formula expression as for regression models, of the form
response ~ predictors
.
See the documentation of
formula
for other details.
OPTIONAL ARGUMENTS:
- data
-
an optional data frame in which to interpret the variables occurring
in
formula
.
- subset
-
expression saying which subset of the rows of the data should be used
in the fit. All observations are included by default.
- na.action
-
a function to filter missing data.
- lambda
-
A scalar or vector of ridge constants.
- model
-
should the model frame be returned?
- x
-
should the design matrix be returned?
- y
-
should the response be returned?
- contrasts
-
a list of contrasts to be used for some or all of
- ...
-
additional arguments to
lm.fit
.
VALUE:
A list with components
- coef
-
matrix of coefficients, one row for each value of
lambda
.
- scales
-
scalings used on the X matrix.
- Inter
-
was intercept included?
- lambda
-
vector of lambda values
- ym
-
mean of
y
- xm
-
column means of
x
matrix
- GCV
-
vector of GCV values
- kHKB
-
HKB estimate of the ridge constant.
- kLW
-
L-W estimate of the ridge constant.
REFERENCES:
Brown, P. J. (1994)
Measurement, Regression and Calibration.
Oxford.
SEE ALSO:
EXAMPLES:
longley <- data.frame(y = longley.y, longley.x)
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)))
# modified HKB estimator is 0.0042754
# modified L-W estimator is 0.032295
# smallest value of GCV at 0.0028