【问题标题】:Is lme4:::profile.merMod() supposed to work with glmer models?lme4:::profile.merMod() 应该与 glmer 模型一起使用吗?
【发布时间】:2015-08-05 19:54:45
【问题描述】:

lme4:::profile.merMod() 是否应该与 glmer 模型一起使用?负二项式模型呢?

我有一个抛出此错误的负二项式模型:

Error in names(opt) <- profnames(fm, signames) : 'names' attribute [2] must be the same length as the vector [1]

当我尝试在我的模型 profile(model12) 上运行 profile 函数以获得随机效应的标准误差时。

是我遗漏了什么还是 lme4 有问题?

我应该提到我使用的是glmer(..., family = negative.binomial(theta = lme4:::est_theta(poissonmodel))) 而不是glmer.nb(),因为我在使用glmer.nb() 时遇到了update() 函数的问题。

【问题讨论】:

  • 这仍然是当前版本的 lme4 的问题吗?

标签: r lme4 mixed-models


【解决方案1】:

我可以使用 CRAN 版本 (1.1-8) 重现您的错误。在最新的开发版本中,glmer.nb 有了一些改进,所以如果你安装了编译工具,我肯定会做devtools::install_github("lme4/lme4") 并再试一次。此外,update() 现在更适用于 NB 型号,因此您可能不需要解决方法。

这适用于版本 1.1-9:

library("lme4")
m1 <- glmer.nb(TICKS~cHEIGHT+(1|BROOD),data=grouseticks)
pp <- profile(m1)
lattice::xyplot(pp)

请注意,您使用est_theta 的解决方案仅执行迭代解决方案的一两个初始步骤,其中theta 值和其他参数交替优化...

m0 <- glmer(TICKS~cHEIGHT+(1|BROOD),data=grouseticks,family=poisson)
m2 <- update(m0, 
     family = negative.binomial(theta  = lme4:::est_theta(m0)))
cbind(glmer.nb=fixef(m1),pois=fixef(m0),fakenb=fixef(m2))
##                glmer.nb        pois      fakenb
## (Intercept)  0.58573085  0.56835340  0.57759498
## cHEIGHT     -0.02520326 -0.02521386 -0.02520702

profile() 在这个模型上也可以正常工作,至少在开发版本中......

【讨论】:

  • 感谢 @Ben Bolker 对包更新的建议和对 est_theta 解决方法的评论,我没有注意到。我今晚会试试这些并更新这篇文章。
  • 感谢您发送模型 (glmer_nb_model12.rda),但是...模型被弄乱了(已安装在 1.1-8 中)-您需要重新安装 1.1-9 .
  • 我发送了更新的模型。 glmer.nb 模型的更新和绘图功能是固定的,但配置文件功能不是。
  • 嗯,好的,我再看看
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-11-24
  • 1970-01-01
相关资源
最近更新 更多