Compute the deviance sequence from the glmnet object

# S3 method for glmnet
deviance(object, ...)

Arguments

object

fitted glmnet object

...

additional print arguments

Value

(1-dev.ratio)*nulldev

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

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)
#> [1] 118.4585 117.7115 116.8089 115.7803 114.9263 114.2173 113.5663 112.6822 #> [9] 111.9413 111.3262 110.8156 110.3127 109.6243 109.0417 108.5013 108.0364 #> [17] 107.5811 107.1566 106.7572 106.3494 105.9965 105.6585 105.3771 105.1181 #> [25] 104.8940 104.6953 104.5307 104.3852 104.2440 104.1262 104.0283 103.9471 #> [33] 103.8797 103.8210 103.7719 103.7306 103.6964 103.6686 103.6449 103.6252 #> [41] 103.6089 103.5953 103.5841 103.5747 103.5669 103.5605 103.5550 103.5499 #> [49] 103.5457 103.5423 103.5396 103.5372 103.5356 103.5336 103.5325 103.5313 #> [57] 103.5304 103.5295 103.5288 103.5283 103.5278 103.5274 103.5270 103.5268 #> [65] 103.5265 103.5264 103.5262 103.5261