seqrep.grp | R Documentation |
This function determines representative sequences by group and returns the representatives by group and/or the quality statistics of the representative sets. The function is a wrapper for the TraMineR seqrep
function.
seqrep.grp(seqdata, group = NULL, diss = NULL, ret = "stat",
with.missing = FALSE, mdis, ...)
seqdata |
state sequence object as defined by |
group |
group variable. If |
diss |
dissimilarity matrix. If |
ret |
What should be returned? One of |
with.missing |
Logical. When |
mdis |
Deprecated. Use |
... |
additional arguments passed to |
The function is a wrapper for running seqrep
on the different groups defined by the group
variable.
When diss = NULL
, seqdist
is used to compute the dissimilarities.
If ret="stat"
, a list with the quality statistics for the set of representatives of each group.
If ret="rep"
, a list with the set of representatives of each group. Each element of the list is an object of class stslist.rep
returned by seqrep
.
If ret="both"
, a list with the two previous outcomes.
Gilbert Ritschard
seqrep
data(biofam)
biofam <- biofam[1:100,]
biofam.lab <- c("Parent", "Left", "Married", "Left+Marr",
"Child", "Left+Child", "Left+Marr+Child", "Divorced")
biofam.short <- c("P","L","M","LM","C","LC","LMC","D")
biofam.seq <- seqdef(biofam[,10:25], alphabet=0:7,
states=biofam.short, labels=biofam.lab)
dist <- seqdist(biofam.seq, method="HAM")
seqrep.grp(biofam.seq, group=biofam$plingu02, diss=dist, coverage=.2, pradius=.1)
seqrep.grp(biofam.seq, group=biofam$plingu02, diss=dist, ret="rep", coverage=.2, pradius=.1)
## sequences with missing values
data(ex1)
sqex1 <- seqdef(ex1[,1:13])
nrow(ex1)
gp <- rep(1,7)
gp[5:7] <- 2
seqrep.grp(sqex1, group=gp, method="LCS", ret="rep",
coverage=.2, pradius=.1, with.missing=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.