## ====================
## plot the biofam data
## ====================
## loading the data and defining an event sequence dataset
## =======================================================
data(biofam)
lab <- c("Parent","Left","Married",
"Left+Marr","Child","Left+Child",
"Left+Marr+Child","Divorced")
biofam.seq <- seqdef(data=biofam[,10:25], alphabet=0:7, labels=lab)
## For this example, we consider only a sample of 200 cases
##set.seed(23653)
##sple <- sample(1:nrow(biofam.seq), size=200)
sple <- 500:700 ## need a sample with all elements of the alphabet
##seqstatl(biofam[sple,10:25])
biofam <- biofam[sple,]
biofam.seq <- biofam.seq[sple,]
bf.seqestate <- seqecreate(biofam.seq, tevent = "state")
head(bf.seqestate)
## plot the data
## =============
## distinctive event sequences
par(mar=c(4,8,2,2))
seqeordplot(seqe=bf.seqestate,alphabet=lab)
par(mar=c(4,8,2,2))
seqeordplot(seqe=bf.seqestate,alphabet=lab,
lwd.max=6,cex=0.9,show=c(0.05,1))
## non-embeddable sequences
par(mar=c(4,8,2,2))
seqeordplot(seqe=bf.seqestate,alphabet=lab,
lwd.max=6,cex=0.9,show=c(0.05,1),
type="non-embeddable")
## some additional options
par(mar=c(4,8,2,2)) # how the sequences end
seqeordplot(seqe=bf.seqestate,alphabet=lab,
type="non-embeddable",lwd.max=2,
orderalign="last",split="last")
par(mar=c(4,8,2,2)) # sequences involving Left+Marr+Child
seqeordplot(seqe=bf.seqestate,alphabet=lab,
type="non-embeddable",
orderalign="Left+Marr+Child")
par(mar=c(4,8,2,2)) # gender differences
seqeordplot(seqe=bf.seqestate,group=biofam$sex,show=c(0.05,1),
alphabet=lab)Run the code above in your browser using DataLab