0

我正在尝试在 R 中实现 HMM。现在我的数据集中有 18 列。当我制作一个发射矩阵时,它给出了未定义列的错误,我不知道我在哪里做错了。

library(seqHMM)

emix <- matrix(NA, nrow = 3, ncol = 4)
emix[1,] <- seqstatf(exam_seq[, 1:5])[, 3] + 1
emix[2,] <- seqstatf(exam_seq[, 6:12])
emix[3,] <- seqstatf(exam_seq[, 13:18])

Error in \`[.data.frame`(seqstatf(exam_seq[, 1:5]), , 3) : 
  undefined columns selected

OP 在评论中发布的数据。

structure(list(Freq = c(260, 262, 74, 1, 485, 106, 6, 
219, 215, 1282, 80), Percent = c(8.69565217391304, 
8.76254180602007, 2.47491638795987, 0.0334448160535117, 
16.2207357859532, 3.54515050167224, 0.20066889632107, 
7.32441471571906, 7.19063545150502, 42.876254180602, 
2.67558528428094 )), class = "data.frame", row.names = 
c("So", "Da", "UK", "Tw", "Al", "Ab", "D", "NA", "0", "1", 
"2"))
4

0 回答 0