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.

1 2 | ```
## S4 method for signature 'PSTf'
logLik(object)
``` |

`object` |
a probabilistic suffix tree, i.e., an object of class |

The likelihood of a learning sample containing *n* sequences, given a model *S* fitted to it, is

*
L(S)=∏_{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. For more details, see Gabadinho 2016.

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.

Alexis Gabadinho

Gabadinho, A. & Ritschard, G. (2016). Analyzing State Sequences with Probabilistic Suffix Trees: The PST R Package. *Journal of Statistical Software*, **72**(3), pp. 1-39.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ```
## activity calendar for year 2000
## from the Swiss Household Panel
## see ?actcal
data(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)
logLik(actcal.pst)
## 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)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.