1

我正在尝试在HMM书中复制一个表:

在此处输入图像描述

具体来说,k=2 模型。

我正在使用代码:

dat<-as.data.frame(c(13,  8,  23,   22, 18, 15, 14, 11, 24, 18, 14, 16, 8,  14, 27, 15, 10, 13, 10, 23, 41, 20, 15, 15, 16, 18, 31, 15, 8,  16, 26, 17, 27, 22, 15, 11, 32, 19, 35, 19, 6,  11, 27, 20, 26, 16, 11, 18, 22, 28, 30, 8,  32, 19, 36, 27, 7,  36, 13, 39, 29, 18, 24, 26, 21, 23, 16, 22, 13, 17, 20, 13, 23, 14, 22, 16, 12, 22, 22, 17, 21, 13, 18, 24, 19, 21, 20, 25, 21, 15, 25, 15, 21, 22, 34, 16, 16, 21, 26, 10, 18, 12, 14, 21, 15, 15, 18))
colnames(dat)<-"x"

x2 <- flexmix(x~1, data=dat, k=2,model=FLXMRglm(formula=x~1,family="poisson"))
summary(x2)

检查先验和日志,似乎语法正在做我想要的:)。我的问题是如何提取分量意味着 lambda(15.777 和 26.840 以上)?我不相信它们只是每个集群中数据的平均值。

4

1 回答 1

4
exp(parameters(x2))

您可以使用parameters来提取系数,但模型默认使用对数链接功能,因此您需要使用exp来转换回原始比例。

于 2013-03-06T23:31:57.143 回答