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 event in the successive periods.
seqedplot(seqe,
group=NULL, breaks=20, ages=NULL,
main="auto", type="survival", ignore=NULL,
with.legend="auto",cex.legend=1,
use.layout=(!is.null(group) | with.legend!=FALSE), legend.prop=NA,
rows=NA, cols=NA,
xaxis="all", xlab="time",
yaxis="all",
ylab=ifelse(type=="survival", "survival probability", "mean number of events"),
cpal=NULL,
title, withlegend, axes, ...)
an event sequence object as defined by the seqecreate
function.
Plots one plot for each level of the factor given as argument.
Number of breaks defining a period.
Two numeric values representing minimum and maximum ages to be represented.
String. Title of the graphic. Default is "auto"
, i.e., group levels. Set as NULL
to suppress titles.
String. Type of One of "survival"
or "hazard"
. If type="survival"
, survival curves of the first occurrence of each event are plotted. If type="hazard"
, mean numbers of each event in the successive periods are plotted.
Character vector. An optional list of events that should not be plotted.
Logical or string. 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".
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.
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 with.legend=FALSE
and group=NULL
,
layout is automatically deactivated and par(mfrow=....)
can be used.
proportion of the graphic area used for plotting the legend when use.layout=TRUE
and with.legend=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.
optional arguments to arrange plots when use.layout=TRUE.
optional arguments to arrange plots when use.layout=TRUE.
Logical or one of "all"
and "bottom"
. If set as TRUE
or "all" (default value) x-axes are drawn on each plot in the graphic. If set as "bottom" and group is used, x-axes are drawn under the plots of the bottom panel only. If FALSE, no x-axis is drawn.
Logical or one of "all"
or "left"
. If set as TRUE
or "all"
(default value) y-axes are drawn on each plot in the graphic. If "left"
and group
is used, the y-axis is displayed on plots of the left panel only. If FALSE
no y-axis is drawn.
an optional label for the x-axis. If set to NA
, no label is drawn.
an optional label for the y-axis. If set to NA
, no label is drawn. Can be a vector of labels by group level.
Color palette used for the events. If NULL
, a new color palette is generated.
Deprecated. Use main
instead.
Deprecated. Use with.legend
instead.
Deprecated. Use xaxis
instead.
Additional arguments passed to plot.survfit
, lines.survfit
, and/or legend
.
Matthias Studer
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.
data(actcal.tse)
actcal.tse <- actcal.tse[1:200,]
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)
Run the code above in your browser using DataLab