Learn R Programming

PST (version 0.94.1)

pqplot: Prediction quality plot

Description

Plot the predicted probability of each state in a sequence

Usage

# S4 method for 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.

Author

Alexis Gabadinho

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.

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

Run this code
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)

Run the code above in your browser using DataLab