抱歉,如果我在这里遗漏了一些非常明显的东西,但我是混合效果建模的新手。
我正在尝试将二项式存在/不存在响应建模为周围区域内栖息地百分比的函数。我的固定效果是栖息地的百分比,我的随机效果是地点(我绘制了 3 个不同的农场地点)。
glmmsetaside <- glmer(treat~setas+(1|farm),
family=binomial,data=territory)
什么时候verbose=TRUE
:
0: 101.32427: 0.333333 -0.0485387 0.138083
1: 99.797113: 0.000000 -0.0531503 0.148455
2: 99.797093: 0.000000 -0.0520462 0.148285
3: 99.797079: 0.000000 -0.0522062 0.147179
4: 99.797051: 7.27111e-007 -0.0508770 0.145384
5: 99.797012: 1.45988e-006 -0.0495767 0.141109
6: 99.797006: 0.000000 -0.0481233 0.136883
7: 99.797005: 0.000000 -0.0485380 0.138081
8: 99.797005: 0.000000 -0.0485387 0.138083
我的输出是这样的:
Generalized linear mixed model fit by the Laplace approximation
Formula: treat ~ setasidetrans + (1 | farm)
AIC BIC logLik deviance
105.8 112.6 -49.9 99.8
Random effects:
Groups Name Variance Std.Dev.
farm (Intercept) 0 0
Number of obs: 72, groups: farm, 3
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.04854 0.44848 -0.108 0.914
setasidetrans 0.13800 1.08539 0.127 0.899
Correlation of Fixed Effects:
(Intr)
setasidtrns -0.851
我基本上不明白为什么我的随机效应是0?是因为随机效应只有3个级别吗?我不明白为什么会这样。我已经尝试过很多不同的模型,结果总是为 0。
这不可能是因为随机效应不能解释任何变化,因为我知道不同农场的栖息地不同。
这是一组使用的示例数据dput
:
list(territory = c(1, 7, 8, 9, 10, 11, 12, 13, 14, 2, 3, 4, 5,
6, 15, 21, 22, 23, 24, 25, 26, 27, 28, 16, 17, 18, 19, 20, 29,
33, 34, 35, 36, 37, 38, 39, 40, 30, 31, 32, 41, 45, 46, 47, 48,
49, 50, 51, 52, 42, 43, 44, 53, 55, 56, 57, 58, 59, 60, 61, 62,
54, 63, 65, 66, 67, 68, 69, 70, 71, 72, 64), treat = c(1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0), farm = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3),
built = c(5.202332763, 1.445026852, 2.613422283, 2.261705833,
2.168842186, 1.267473928, 0, 0, 0, 9.362387965, 17.55433115,
4.58020626, 4.739300829, 8.638442377, 0, 1.220760647, 7.979990338,
13.30789514, 0, 8.685544976, 3.71617163, 0, 0, 6.802926951,
8.925512803, 8.834006678, 4.687723044, 9.878232478, 8.097800267,
0, 0, 0, 0, 5.639651095, 9.381654651, 8.801754791, 5.692392532,
3.865304919, 4.493438554, 4.826277798, 3.650995554, 8.20818417,
0, 8.169597157, 8.62030666, 8.159474015, 8.608979238, 0,
8.588288678, 7.185700856, 0, 0, 3.089524893, 3.840381223,
31.98103158, 5.735501995, 5.297691011, 5.17141191, 6.007539933,
2.703345394, 4.298077606, 1.469986793, 0, 4.258511595, 0,
21.07029581, 6.737664009, 14.36176373, 3.056631919, 0, 32.49289428,
0)
它继续为不同类型的栖息地(例如built
,setaside
是其中之一)提供大约 10 个列,其中包含百分比。