TraMineRExtras 中的 seqgranularity

seqgranularity in TraMineRExtras

提问人:emanuela.struffolino 提问时间:11/6/2023 更新时间:11/7/2023 访问量:33

问:

我正在使用中的命令。我阅读了我可以指出的帮助文档。例如,如果我从月度数据转向年度数据,并且在 12 个月内,我在一个州有 6 个月,在另一个州有 6 个月,会发生什么?两者中的哪一个将用于定义年度序列? 谢谢!seqgranularityTraMineRExtrasmethod = "mostfreq"

序列 Traminer

评论


答:

0赞 Gilbert 11/6/2023 #1

最常见的类别是通过应用 的结果来标识的,它按字母顺序返回状态频率。 返回第一个遇到的最大值的索引。因此,with ,在共享最大频率的类别中分配字母表中首先出现的类别。which.maxseqistatdwhich.maxmethod="mostfreq"seqgranularity

下面的示例包含两个长度为 24 的序列,显示了结果如何随字母顺序变化

library(TraMineRextras)
dat <- read.table(text = "
                  a/6,b/6,c/2,d/10
                  b/6,a/6,c/10,d/2
                  ")
sdat <- seqformat(dat, from="SPS", to="STS", 
              SPS.in = list(xfix = "", sdsep = "/"), 
              stsep=",")

seq1 <- seqdef(sdat, alphabet=c("a","b","c","d")) 
## "a" precedes "b" in the alphabet
seqgranularity(seq1, method="mostfreq",tspan=12)
      
##   Sequence
## 1 a-d     
## 2 a-c 

seq2 <- seqdef(sdat, alphabet=c("d","c","b","a")) 
## Here "b" precedes "a" in the alphabet
seqgranularity(seq2, method="mostfreq",tspan=12)

##   Sequence
## 1 b-d     
## 2 b-c