
Extract the deviance from a glmnet object
deviance.glmnet.RdCompute the deviance sequence from the glmnet object
Usage
# S3 method for class 'glmnet'
deviance(object, ...)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.
References
Friedman, J., Hastie, T. and Tibshirani, R. (2008) Regularization Paths for Generalized Linear Models via Coordinate Descent
Author
Jerome Friedman, Trevor Hastie and Rob Tibshirani
Maintainer:
Trevor Hastie [email protected]
Examples
x = matrix(rnorm(100 * 20), 100, 20)
y = rnorm(100)
fit1 = glmnet(x, y)
deviance(fit1)
#> [1] 119.5269 118.6808 117.9783 116.8777 115.9161 115.1178 114.4550 113.9048
#> [9] 113.1212 112.4205 111.8388 111.2624 110.4659 109.8043 109.2430 108.7033
#> [17] 108.1344 107.6591 107.2591 106.8576 106.5087 106.1632 105.8362 105.5254
#> [25] 105.2635 105.0457 104.8649 104.6993 104.5419 104.4029 104.2868 104.1894
#> [33] 104.1086 104.0412 103.9851 103.9386 103.9000 103.8686 103.8419 103.8197
#> [41] 103.8013 103.7860 103.7733 103.7628 103.7541 103.7468 103.7408 103.7360
#> [49] 103.7318 103.7282 103.7249 103.7222 103.7199 103.7184 103.7165 103.7155
#> [57] 103.7144 103.7135 103.7127 103.7121 103.7115 103.7111 103.7107 103.7104
#> [65] 103.7102 103.7100 103.7098 103.7096