问题描述
我正在使用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
在指定二项式(和Poisson)模型时只是挑剔的.如果它检测到否,它会发出警告.尝试或成功的过程不是完整的,但无论如何它还是可以适应模型的.如果您想取消该警告(并且确定这不是问题),请改用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! (调查包)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!