尝试在 R 中使用泊松分布拟合 glmer 时出错:PIRLS 步骤减半未能减少 pwrssUpdate 中的偏差

问题描述 投票:0回答:1

我正在运行的模型不会收敛/显示错误。您对使用非正态焦点数据有什么建议吗?大多数数据都是零膨胀或高度倾斜的。

我想要运行的模型是这样的(响应只是一个例子):

model <- glmer(Duration_behavior_1 ~ 
                 status * days_since_event +
                 focal_age + 
                 focal_rank +
                 pink +
                 year + 
                 hour +
                 (1|FocalID) + 
                 (1|partner.ID),
               family = 'poisson',
               offset = Focal_duration,
               data = data)

但我收到此错误:

Error in (function (fr, X, reTrms, family, nAGQ = 1L, verbose = 0L, maxit = 100L,  :
  (maxstephalfit) PIRLS step-halvings failed to reduce deviance in pwrssUpdate

我认为问题在于偏移。如果我删除它,我会收到此警告:

Warning messages:
1: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  Model failed to converge with max|grad| = 0.00252314 (tol = 0.002, component 1)
2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  Model is nearly unidentifiable: very large eigenvalue
 - Rescale variables?;Model is nearly unidentifiable: large eigenvalue ratio
 - Rescale variables?

但是,当然,需要偏移量来控制观察的持续时间......

您认为建议将分布更改为负二项式,而不是使用泊松分布吗?

r glm poisson
1个回答
0
投票

您几乎肯定想使用

log(Focal_duration)
作为偏移量,而不是
Focal_duration

假设

eta
是不包括偏移量的线性预测器,例如
beta0 + beta1*x1 + beta2*x2 + ...
(还包括基于随机效应的组件)。那么预测值为
eta + offset
,期望平均值为
exp(eta)*exp(offset)
。如果偏移量 (
Focal_duration
) 的值相当大(比如 60 秒?),那么
exp(offset)
的值就很大(例如
exp(60)
~ 1.1e26),这 [而且不是您想要的]搞乱数值计算。

© www.soinside.com 2019 - 2024. All rights reserved.