deviance
Deviance of a Fitted Model

Description

Returns the deviance or weighted residual sum of squares of the model.
This function is an S Version 3 generic (see Methods). Method functions can be written to handle specific S Version 3 classes of data. Classes that already have methods for this function include glm, lm, mlm, and nls.

Usage

deviance(object, ...)
## Default S3 method:
deviance(object, ...)
## S3 method for class 'glm':
deviance(object, ...)
## S3 method for class 'lm':
deviance(object, ...)
## S3 method for class 'mlm':
deviance(object, ...)
## S3 method for class 'nls':
deviance(object, ...)

Arguments

object a fitted model object.
... additional arguments to be passed to or from future functions.

Details

For glm and nls models, and for the default method, deviance is a simple extractor function. For other models, the gaussian family is assumed, and the weighted residual sum of squares is returned.
Value
returns the deviance of the fitted model.
References
Chambers, J. M. and Hastie, T .J. (Eds.) 1992. Statistical Models in S. Pacific Grove, CA.: Wadsworth & Brooks/Cole.
Examples
x <- c(1,2,3)
y <- c(4,2,8)
lm.fit <- lm(y~x)
deviance(lm.fit)

glm.fit <- glm(area ~ ., family = poisson, data = rock) deviance(glm.fit)

Micmen <- data.frame( conc=c(0.333, 0.167, 0.0833, 0.0416, 0.0208, 0.0104, 0.0052), vel=c(3.636, 3.636, 3.236, 2.666, 2.114, 1.466, 0.866)) nls.fit <- nls(vel~Vm*conc/(K+conc), data = Micmen, start = list(K = 0.02, Vm = 3.7), trace = TRUE, model = TRUE, weights = c(1:4,3:1)/7) deviance(nls.fit)

Package stats version 6.1.1-7
Package Index