Description Usage Arguments Details Value Author(s) References See Also Examples

Mine for (sub)sequences satisfying user defined criteria in a state sequence object

1 2 3 |

`object` |
A fitted PST, that is an object of class PSTf as returned by the |

`data` |
A sequence object of class 'stslist' as defined with the |

`l` |
integer. Length of the subsequence to search for. |

`pmin` |
numeric. (Sub)-sequences having average or per state probability greater or equal than |

`pmax` |
numeric. (Sub)-sequences having average or per state probability less or equal than |

`prefix` |
character. Subsequences are searched in sequences starting with |

`lag` |
integer. The |

`average` |
logical. If |

`output` |
character. If |

`with.prefix` |
logical. If |

`sorted` |
logical. If |

`decreasing` |
logical. If |

`score.norm` |
logical. If |

The likelihood *P^{S}(x)* of a whole sequence *x* is computed from the state probabilities at each position in the sequence. However, the likelihood of the first states is usually lower than at higher position due to a reduced memory available for prediction. A sequence may not appear as very likely if its first state has a low relative frequency, even if the model predicts high probabilities for the states at higher positions.

The `pmine`

function allows for advanced pattern mining with user defined parameters. It is controlled by the `lag`

and `pmin`

arguments. For example, by setting `lag=2`

and `pmin=0.40`

(example 1), we select all sequences with average (the geometric mean is used) state probability from position *lag+1, …, \ell* above `pmin`

. Instead of considering the average state probability at positions *lag+1, …, \ell*, it is also possible to select frequent patterns that do not contain any state with probability below the threshold. This prevents from selecting sequences having many states with high probability but one ore several states with a low probability.

It is also possible to mine the sequence data for frequent patterns of length *\ell_{j} < \ell*, regardless of the position in the sequence where they occur. By using the `output="patterns"`

argument, the `pmine`

function returns the patterns (as a sequence object) instead of the whole set of distinct sequences containing the patterns. Since the probability of a pattern can be different depending on the context (previous states) the returned subsequences also contain the context preceding the pattern. For more details, see Gabadinho 2016.

A state sequence object, that is an object of class `stslist`

, where weights are the probability score of (sub)sequences.

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.

`cmine`

for context mining

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ```
## 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)
## pruning
## Cut-offs for 5% and 1% (see ?prune)
C99 <- qchisq(0.99,4-1)/2
actcal.pst.C99 <- prune(actcal.pst, gain="G2", C=C99)
## example 1
pmine(actcal.pst.C99, actcal.seq, pmin=0.4, lag=2)
## example 2: patterns of length 6 having p>=0.6
pmine(actcal.pst.C99, actcal.seq, pmin=0.6, l=6)
``` |

PST documentation built on May 29, 2017, 5:16 p.m.

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.