pqplot: Prediction quality plot

Description Usage Arguments Details Author(s) References Examples

Description

Plot the predicted probability of each state in a sequence

Usage

1
2
3
4
## S4 method for signature 'PSTf,stslist'
pqplot(object, data, cdata, L, stcol, plotseq=FALSE, 
	ptype="b", cex.plot=1, space=0,
	measure="prob", pqmax, seqscale, ...)

Arguments

object

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

data

a sequence object, i.e., an object of class 'stslist' as created by TraMineR seqdef function, either subsetted with the index of the sequence to predict or containing one sequence.

cdata

Not implemented yet.

L

integer. Maximal context length for sequence prediction. This is the same as pruning the PST by removing all nodes of depth<L before prediction.

stcol

character. Color to use to plot the prediction qualities.

plotseq

logical. If TRUE, the sequence is displayed separately, and the prediction plot is plotted above.

ptype

character. Type of plot, either 'b' for barplot or 'l' for line.

cex.plot

numeric. Expansion factor for setting the size of the font for the axis labels and names. The default value is 1. Values lesser than 1 will reduce the size of the font, values greater than 1 will increase the size.

space

numeric. Space separating each state in the plot.

measure

character. Measure used for prediction quality. Either 'prob' or 'logloss'.$

pqmax

numeric. Maximum coordinate for the prediction quality plot, i.e. the max of the y axis.

seqscale

numeric. If plotseq=TRUE, width of the bar representing the sequence as a proportion of the y axis range.

...

optional graphical parameters to be passed to the plot function.

Details

The pqplot() function displays either the predicted probabilities or the log-loss for each position of a single sequence as a series of barplots. For more details, see Gabadinho 2016.

Author(s)

Alexis Gabadinho

References

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

Examples

1
2
3
4
5
6
7
data(s1)
s1 <- seqdef(s1)
S1 <- pstree(s1, L=3)

z <- seqdef("a-b-a-a-b")
pqplot(S1, z)
pqplot(S1, z, measure="logloss", plotseq=TRUE)

Example output

Loading required package: TraMineR

TraMineR stable version 2.0-7 (Built: "Sat,)
Website: http://traminer.unige.ch
Please type 'citation("TraMineR")' for citation information.

Loading required package: RColorBrewer

PST version 0.94 (Built: 2017-09-22)
Website: http://r-forge.r-project.org/projects/pst
 [>] 2 distinct states appear in the data: 
     1 = a
     2 = b
 [>] state coding:
       [alphabet]  [label]  [long label] 
     1  a           a        a
     2  b           b        b
 [>] 1 sequences in the data set
 [>] min/max sequence length: 27/27
 [>] 1 sequence(s) - min/max length: 27/27
 [>] max. depth L=3, nmin=1
     [L]  [nodes]
       0        1
       1        2
       2        4
       3        8
 [>] computing sequence(s) likelihood ... (0.01 secs)
 [>] total time: 0.285 secs
 [>] 2 distinct states appear in the data: 
     1 = a
     2 = b
 [>] state coding:
       [alphabet]  [label]  [long label] 
     1  a           a        a
     2  b           b        b
 [>] 1 sequences in the data set
 [>] min/max sequence length: 5/5
 [>] computing prob., max. length=3
 [>] computing prob., max. length=3

PST documentation built on May 2, 2019, 3:43 a.m.

Related to pqplot in PST...