Description Usage Arguments Value Examples
View source: R/lm_ridge_beta.R
This function is used to return ridge regression estimators.
1 | lm_ridge_beta(X, Y, lambda)
|
X |
a design matrix containing all predictors. |
Y |
a response vector. |
lambda |
a lambda value specified, serving as the coefficient of the penalty terms. |
ridge regression estimators.
1 2 3 4 5 6 7 8 | #If do not have a design matrix and a response vector,
#firstly turn the formula and dataset into the required matrix
mf<-model.frame(Sepal.Width~.,iris)
mt<-attr(mf,"terms")
X <- model.matrix(mt, mf)
Y <- as.matrix(model.response(mf))
#call the function
lm_ridge_beta(X,Y,10)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.