deviance.glmnet {glmnet} | R Documentation |
Compute the deviance sequence from the glmnet object
## S3 method for class 'glmnet' deviance(object,...)
object |
fitted glmnet object |
... |
additional print arguments |
A glmnet object has components dev.ratio
and nulldev
.
The former is the fraction of (null) deviance explained. The deviance calculations incorporate weights if
present in the model. The deviance is defined to be 2*(loglike_sat -
loglike), where loglike_sat is the log-likelihood for the saturated
model (a model with a free parameter per observation).
Null deviance is defined to
be 2*(loglike_sat -loglike(Null)); The NULL model refers to the
intercept model, except for the Cox, where it is the 0 model. Hence
dev.ratio=1-deviance/nulldev, and this
deviance
method returns (1-dev.ratio)*nulldev.
(1-dev.ratio)*nulldev
Jerome Friedman, Trevor Hastie and Rob Tibshirani
Maintainer: Trevor Hastie <hastie@stanford.edu>
Friedman, J., Hastie, T. and Tibshirani, R. (2008) Regularization Paths for Generalized Linear Models via Coordinate Descent
glmnet
, predict
, print
, and coef
methods.
x=matrix(rnorm(100*20),100,20) y=rnorm(100) fit1=glmnet(x,y) deviance(fit1)