1
votes

I'm using TraMineRextras and in particular I'm interested in the seqedplot function.

Here there is an example:

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)

Instead of plotting all curves by doing:

seqedplot(actcal.seqe, type="hazard", breaks=6, group=actcal$sex, lwd=3)

I would only plot the selected curves according to the variable sex by using the ignore option:

seqedplot(actcal.seqe, type="survival", group=actcal$sex, lwd=3, ignore= c("NoActivity", "Start", "FullTime", "Stop", "LowPartTime", "Increase", "Decrease"))

How can I plot the Male and Female selected curves in one single graph instead of in two separate graphs?

Thank you in advance

1

1 Answers

0
votes

One way might be to bind the sex onto the event type:

actcal.tse$event <- sprintf("%s-%s", actcal.tse$event, actcal$sex[match(actcal.tse$id, rownames(actcal))])

as there doesn't appear to be an option to use the groups parameter to split within a graph. So try something along these lines, and omit the groups option entirely