-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathseqpattern.R
More file actions
executable file
·30 lines (26 loc) · 907 Bytes
/
seqpattern.R
File metadata and controls
executable file
·30 lines (26 loc) · 907 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/Rscript
setwd('/Users/e51141/macsrc/datasci/R/')
#install.package(TraMineR)
require(TraMineR)
data(mvad)
dim(mvad)
names(mvad)
########################
## simple ex from TraMineR pkg
########################
# create seq object.
mvad.labels = c("employment","further education","higher education","joblessness","school","training");
mvad.scode = c("EM", "FE", "HE", "JL", "SC", "TR");
mvad.seq = seqdef(mvad, 17:86, states = mvad.scode, labels = mvad.labels);
# seq freq plot
seqfplot(mvad.seq, withlegend = F, border = NA, title = "Sequence frequency plot")
# seq dist plot
seqdplot(mvad.seq, withlegend = F, border = NA, title = "State distribution plot");
########################
## Event seq analysis
########################
# first, create sequence event
mvad.seqe <- seqecreate(mvad.seq);
# find freq subseq with min support
fsubseq = seqefsub(mvad.seqe, pMinSupport = 0.05)
fsubseq