| deviance.glmnet {glmnet} | R Documentation |
Extract the deviance from a glmnet object
Description
Compute the deviance sequence from the glmnet object
Usage
## S3 method for class 'glmnet'
deviance(object, ...)
Arguments
object |
fitted glmnet object |
... |
additional print arguments |
Details
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.
Value
(1-dev.ratio)*nulldev
Author(s)
Jerome Friedman, Trevor Hastie and Rob Tibshirani
Maintainer:
Trevor Hastie hastie@stanford.edu
References
Friedman, J., Hastie, T. and Tibshirani, R. (2008) Regularization Paths for Generalized Linear Models via Coordinate Descent
See Also
glmnet, predict, print, and coef
methods.
Examples
x = matrix(rnorm(100 * 20), 100, 20)
y = rnorm(100)
fit1 = glmnet(x, y)
deviance(fit1)