Compute the Deviance of a Fitted VLMC Object

Share:

Description

Compute the Deviance, i.e., - 2 log[likelihood(*)] of a fitted VLMC object. The log-likelihood is also known as “entropy”.

Usage

1
2
## S3 method for class 'vlmc'
deviance(object, ...)

Arguments

object

typically the result of vlmc(..).

...

possibly further arguments (none at the moment).

Value

A number, the deviance, i.e., - 2 log.likelihood(*). where the log.likelihood is really what we currently have as entropy().

Author(s)

Martin Maechler

See Also

entropy, vlmc,residuals.vlmc

Examples

1
2
3
4
5
6
7
8
9
example(vlmc)
deviance(vlmc.pres)

devianceR <- function(object)
{
    dn <- dimnames(pr <- predict(object))
    -2 * sum(log(pr[cbind(2:nrow(pr), match(dn[[1]][-1], dn[[2]]))]))
}
all.equal(deviance(vlmc.pres), devianceR(vlmc.pres), tol = 1e-14)