PST (version 0.84.1)

logLik: Log-Likelihood of a variable length Markov chain model


Retrieve the log-likelihood of a fitted VLMC. This is the logLik method for objects of class PSTf returned by the pstree and prune functions.


## S3 method for class 'PSTf':


a probabilistic suffix tree, i.e., an object of class "PSTf" as returned by the pstree, prune or


  • An object of class logLik, a negative numeric value with the df (degrees of freedom) attribute containing the number of free parameters of the model.


The likelihood of a learning sample containing $n$ sequences, given a model $S$ fitted to it, is $$L(S)=\prod_{i=1}^{n} P^{S}(x^{i})$$ where $P^{S}(x^{i})$ is the probability of the $i$th observed sequence predicted by $S$. Note that the log-likelihood of a VLMC model is not used in the estimation of the model's parameters (see pstree). It is obtained once the model is estimated by calling the predict function. The value is stored in the logLik slot of the probabilistic suffix tree representing the model (a PSTf object returned by the pstree or prune function). The AIC and BIC values can also be obtained with the corresponding generic functions, which call logLik and use its result.

See Also



## activity calendar for year 2000
## from the Swiss Household Panel
## see ?actcal

## selecting individuals aged 20 to 59
actcal <- actcal[actcal$age00>=20 & actcal$age00 <60,]

## defining a sequence object
actcal.lab <- c("> 37 hours", "19-36 hours", "1-18 hours", "no work")
actcal.seq <- seqdef(actcal,13:24,labels=actcal.lab)

## building a PST
actcal.pst <- pstree(actcal.seq, nmin=2, ymin=0.001)

## Cut-offs for 5% and 1% (see ?prune)
C99 <- qchisq(0.99,4-1)/2

## pruning
actcal.pst.C99 <- prune(actcal.pst, gain="G2", C=C99)

## Comparing AIC
AIC(actcal.pst, actcal.pst.C99)