【发布时间】:2017-03-10 21:04:47
【问题描述】:
我正在研究 2 个固定变量和 1 个随机变量的相互作用。 Year 有 19 个级别,是数字,海滩是一个因素,有 4 个级别,方法是一个因素,有 3 个级别。 我对下面的错误消息感到困惑。 NS1 是我的巢成功,它是按鸡蛋总数加权的。
fit10<-glmer(NS1~0+beach+method+(1|year)+(1+beach*method|year),data=new1,weights=egg_total,family=binomial())
警告信息:
1: 在 eval(expr, envir, enclos) : non-integer #successes in a 二项式glm!
2: 在 commonArgs(par, fn, control, environment()) : maxfun
3: 在 optwrap(optimizer, devfun, start, rho$lower, control = control, : 来自 bobyqa 的收敛代码 1: bobyqa -- 最大数量 超出功能评估
4: In (function (fn, par, lower = rep.int(-Inf, n), upper = rep.int(Inf, : 在 10000 次评估中未能收敛
5: 在 checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : 无法评估缩放梯度
6: 在 checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : 模型未能收敛:退化 Hessian 有 17 个负特征值
编辑: 我已将代码更改为:
fit10<-glmer(NS1~0+beach+method+(1|year)+(1|beach/year)+ (1+method|year),data=new1,weights=crawls,family=binomial(),control=glmerControl(optimizer = "Nelder_Mead",optCtrl=list(maxfun=100000)))
它只给了我这个警告信息:
Warning message:
In eval(expr, envir, enclos) : non-integer #successes in a binomial glm!
A sample of my data looks like this:
year beach method FC.. NS NS1 egg_total crawls
1 1997 Hillsboro HTL only 7 12.500000 0.12500000 0 8
2 1997 Hillsboro HTL only 4 33.333333 0.33333333 99 6
3 1997 Hillsboro HTL only 3 57.142857 0.57142857 0 7
4 1997 Hillsboro HTL only 2 33.333333 0.33333333 0 3
5 1997 Hillsboro HTL only 0 100.000000 1.00000000 104 2
6 1997 Hillsboro HTL only 0 100.000000 1.00000000 0 2
7 1997 Hillsboro HTL only 0 100.000000 1.00000000 190 4
8 1997 Hillsboro HTL only 1 66.666667 0.66666667 0 3
9 1997 Hillsboro HTL only 0 100.000000 1.00000000 114 1
10 1997 P/FTL HTL only 0 100.000000 1.00000000 0 1
11 1997 P/FTL no clean 0 100.000000 1.00000000 140 1
12 1997 P/FTL no clean 3 40.000000 0.40000000 277 5
13 1997 P/FTL HTL and SB 0 100.000000 1.00000000 0 1
14 1997 JUL no clean 0 100.000000 1.00000000 153 2
15 1997 JUL no clean 0 100.000000 1.00000000 113 2
16 1997 JUL no clean 0 100.000000 1.00000000 0 1
NS1 是简单的 NS/100
这样在 excel 中总共有 866 行
【问题讨论】:
-
欢迎来到 Stack Overflow。请花时间阅读The Tour 并参考Help Center 中的材料,您可以在这里问什么以及如何问。
-
第一个警告是最直接的。你检查过
NS1以确保它是一个整数吗? -
我将 NS1 更改为数字。我得到的只是 0 和 1,值介于 0 和 1 之间,这就是为什么我将其加权为 egg_total。所以 NS1 是我的成功,其余的都是失败
-
我没有关注。也许
NS1是一个比例而不是 0/1 变量?在这种情况下,NS1*egg_total需要是一个整数。将您的数据集示例添加到问题中。查看有关如何制作可重现示例的想法here -
@aosmith,我已经发布了上述数据的样本。