glmnet (version 4.1-1)

deviance.glmnet: Extract the deviance from a glmnet object

Description

Compute the deviance sequence from the glmnet object

Usage

# 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

Run this code
# NOT RUN {
x = matrix(rnorm(100 * 20), 100, 20)
y = rnorm(100)
fit1 = glmnet(x, y)
deviance(fit1)
# }

Run the code above in your browser using DataCamp Workspace