Learn R Programming

VLMC (version 1.4-0)

deviance.vlmc: Compute the Deviance of a Fitted VLMC Object

Description

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

Usage

## 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().

See Also

entropy, vlmc,residuals.vlmc

Examples

Run this code
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)

Run the code above in your browser using DataLab