lm.ridge | R Documentation |
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)
formula |
a formula expression as for regression models, of the form
|
data |
an optional data frame, list or environment in which to interpret the
variables occurring in |
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? Not implemented. |
x |
should the design matrix be returned? Not implemented. |
y |
should the response be returned? Not implemented. |
contrasts |
a list of contrasts to be used for some or all of factor terms in the
formula. See the |
... |
additional arguments to |
obj |
an R object, such as an |
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.)
A list with components
coef |
matrix of coefficients, one row for each value of |
scales |
scalings used on the X matrix. |
Inter |
was intercept included? |
lambda |
vector of lambda values |
ym |
mean of |
xm |
column means of |
GCV |
vector of GCV values |
kHKB |
HKB estimate of the ridge constant. |
kLW |
L-W estimate of the ridge constant. |
Brown, P. J. (1994) Measurement, Regression and Calibration Oxford.
lm
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)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.