Graphical representation of a set of events sequences.

Share:

Description

This function provides two ways to represent a set of events. The first one (type="survival") plots the survival curves of the first occurrence of each event. The second one (type="hazard") plots the mean counts of each events in a given time frame.

Usage

1
2
3
4
5
6
seqedplot(seqe, group = NULL, breaks = 20, ages = NULL, title = NULL,
   type = "survival", ignore = NULL, withlegend = "auto", cex.legend = 1,
   use.layout = (!is.null(group) | withlegend != FALSE),
   legend.prop = NA, rows = NA, cols = NA, axes = "all", xlab = "time",
   ylab = ifelse(type == "survival", "survival probability", "mean number of events"),
   cpal = NULL, ...)

Arguments

seqe

an event sequence object as defined by the seqecreate function.

group

Plots one plot for each level of the factor given as argument.

breaks

Number of breaks defining a period.

ages

Two numeric values representing minimum and maximum ages to be represented.

title

title for the graphic. Default is NULL.

type

the type of the plot. If type="survival", plots the survival curves of the first occurence of each event. If type="hazard", plots the mean numbers of each event in a given time frame.

ignore

Character. An optional list of events that will not be plotted.

withlegend

defines if and where the legend of the state colors is plotted. The default value "auto" sets the position of the legend automatically. Other possible values are "right" or FALSE. Obsolete value TRUE is equivalent to "auto".

cex.legend

expansion factor for setting the size of the font for the labels in the legend. The default value is 1. Values lesser than 1 will reduce the size of the font, values greater than 1 will increase the size.

use.layout

if TRUE, layout is used to arrange plots when using the group option or plotting a legend. When layout is activated, the standard par(mfrow=....) for arranging plots does not work. With withlegend=FALSE and group=NULL, layout is automatically deactivated and par(mfrow=....) can be used.

legend.prop

proportion of the graphic area used for plotting the legend when use.layout=TRUE and withlegend=TRUE. Default value is set according to the place (bottom or right of the graphic area) where the legend is plotted. Values from 0 to 1.

rows

optional arguments to arrange plots when use.layout=TRUE.

cols

optional arguments to arrange plots when use.layout=TRUE.

axes

if set to "all" (default value) x-axes are drawn for each plot in the graphic. If set to "bottom" and group is used, axes are drawn only under the plots located at the bottom of the graphic area. If FALSE, no x-axis is drawn.

xlab

an optional label for the x-axis. If set to NA, no label is drawn.

ylab

an optional label for the y-axis. If set to NA, no label is drawn.

cpal

Color palette used for the events. If NULL, a new color palette is generated.

...

Additionnal arguments passed to lines.

Author(s)

Matthias Studer

References

Studer, M., Müller, N.S., Ritschard, G. & Gabadinho, A. (2010), "Classer, discriminer et visualiser des séquences d'événements", In Extraction et gestion des connaissances (EGC 2010), Revue des nouvelles technologies de l'information RNTI. Vol. E-19, pp. 37-48.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data(actcal.tse)
actacl.tse <- actcal.tse[1:500,]
iseq <- unique(actcal.tse$id)
nseq <- length(iseq)
data(actcal)
actcal <- actcal[rownames(actcal) %in% iseq,]
actcal.seqe <- seqecreate(actcal.tse)
seqelength(actcal.seqe) <- rep(12, nseq)
seqedplot(actcal.seqe, type="hazard", breaks=6, group=actcal$sex, lwd=3)
seqedplot(actcal.seqe, type="survival", group=actcal$sex, lwd=3)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.