extract.coef.cv.glmnet | R Documentation |
Extract Coefficient Information from Models
## S3 method for class 'cv.glmnet' extract.coef(model, lambda = "lambda.min", ...)
model |
Model object from which to extract information. |
lambda |
Value of penalty parameter. Can be either a numeric value or one of "lambda.min" or "lambda.1se" |
... |
Further arguments |
Gets the coefficient values and variable names from a model. Since glmnet does not have standard errors, those will just be NA.
A data.frame
containing the coefficient, the standard
error and the variable name.
Jared P. Lander
library(glmnet) library(ggplot2) library(useful) data(diamonds) diaX <- useful::build.x(price ~ carat + cut + x - 1, data=diamonds, contrasts=FALSE) diaY <- useful::build.y(price ~ carat + cut + x - 1, data=diamonds) modG1 <- cv.glmnet(x=diaX, y=diaY, k=5) extract.coef(modG1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.