本文介绍了警告:二项式 glm 中的非整数 #successes!(调查包)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 twang 包来创建倾向得分,这些得分在使用 survey::svyglm 的二项式 glm 中用作权重.代码如下所示:

I am using the twang package to create propensity scores, which are used as weights in a binomial glm using survey::svyglm. The code looks something like this:

pscore <- ps(ppci ~ var1+var2+.........., data=dt....)

dt$w <- get.weights(pscore, stop.method="es.mean")

design.ps <- svydesign(ids=~1, weights=~w, data=dt,)

glm1 <- svyglm(m30 ~ ppci, design=design.ps,family=binomial)

这会产生以下警告:

Warning message:
   In eval(expr, envir, enclos) : non-integer #successes in a binomial glm!

有人知道我做错了什么吗?

Does anyone know what I could be doing wrong ?

我不确定这条消息在 stats.SE 上是否会更好,但总的来说,我想我会先在这里尝试.

I wasn't sure if this message would be better on stats.SE, but on balance I thought I would try here first.

推荐答案

没有错,glm 在指定二项式(和泊松)模型时很挑剔.如果检测到没有,它会发出警告.试验或成功的数量是非整体的,但它继续前进并且无论如何都适合模型.如果您想取消警告(并且您确定这不是问题),请改用 family=quasibinomial.

There's nothing wrong, glm is just picky when it comes to specifying binomial (and Poisson) models. It warns if it detects that the no. of trials or successes is non-integral, but it goes ahead and fits the model anyway. If you want to suppress the warning (and you're sure it's not a problem), use family=quasibinomial instead.

这篇关于警告:二项式 glm 中的非整数 #successes!(调查包)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-26 11:02