ridge | R Documentation |
Ridge regression
ridge(obj, ...)
## S3 method for class 'formula'
ridge(obj, data, subset, na.action, contrasts = NULL, ...)
## S3 method for class 'matrix'
ridge(obj, y, lambda, ...)
## S3 method for class 'ridge'
coef(
object,
lambda,
which = 1:length(object$lambda),
standardize = FALSE,
drop = TRUE,
...
)
## S3 method for class 'ridge'
summary(object, lambda, which, ...)
## S3 method for class 'ridge'
predict(object, X, lambda, which = 1:length(object$lambda), drop = TRUE, ...)
## S3 method for class 'ridge'
confint(object, parm, level = 0.95, X, lambda, which, ...)
obj |
There are two options for running |
... |
Additional arguments to be passed to methods |
data |
If using the formula interface, a data.frame/list/environment containing the variables in the formula |
subset |
If using the formula interface, a vector describing the subset of the data to be used in fitting the model |
na.action |
If using the formula interface, a function indicating what should happen when the data contain NAs, as in |
contrasts |
If using the formula interface, a list to be passed to |
y |
If using the matrix interface, the vector of responses |
lambda |
An optional value or vector of values for the regression coefficient; if not supplied, this will be set up automatically |
object |
A |
which |
Indices of |
standardize |
Return coefficients on standardized scale (default: FALSE) |
drop |
If requesting coefficients for a single lambda value, drop matrix down to a vector (default: TRUE) |
X |
Matrix of predictor values at which predictions are required. |
parm |
Which parameters to construct confidence intervals for; either a vector of indices or a vector of names (default: all) |
level |
Confidence level (default: 0.95) |
plot.ridge()
, coef.ridge()
, predict.ridge()
, summary.ridge()
, confint.ridge()
attach_data(pollution)
fit <- ridge(X, y)
summary(fit, lambda=0.1)
plot(fit)
plot(fit, xaxis='df')
plot(fit, xaxis='both')
plot(fit, standardize=TRUE)
coef(fit)
coef(fit, standardize=TRUE)
coef(fit, standardize=TRUE, lambda=0.1)
p1 <- cbind(1, std(X)) %*% coef(fit, standardize=TRUE, lambda=1)
p2 <- cbind(1, X) %*% coef(fit, lambda=1)
head(p1); head(p2) # identical
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.