logLik: Minus logLikelihood

Description Usage Arguments Value See Also Examples

View source: R/logLik.R

Description

Returns the minus logarithm of the likelihood given a model and a set of observations.

A slightly modified version of the forward algorithm is used to compute the likelihood, to avoid store unneeded data. The sign is changed because it is usual to minimize instead maximize.

Usage

1
2
3
4
logLik(...)

## S3 method for class 'HMM'
logLik(x, e)

Arguments

x

A HMM model.

e

A vector with the observed events. It admits missing values.

Value

The minus logarithm of the likelihood of the events given the model.

See Also

fit, HMM, initparams

Examples

1
2
3
4
5
6
model <- HMMrectangle(20,20)
S <- function(x) if (x > 5) return(0) else return(20*log(5/x))
emissions(model) <- createEM(c(20,20), towers, S)
model <- initparams(model)
model <- minparams(model)
logLik(model,events)

MobilePhoneESSnetBigData/destim documentation built on Dec. 7, 2020, 7:35 p.m.