尝试对成对的数据和重复的度量值运行glmer时出错(lme4) [英] Errors trying to run glmer with paired data and repeated measures (lme4)
问题描述
我想分析两种处理对植物物种丰富度沿时间梯度变化的影响.
I want to analyze the effect of 2 treatments on the variation of the abundance of a plant species along a time gradient.
实验设计由排除(处理=无驼鹿)和对照图(处理=驼鹿)组成.一个站点由1个排除点+ 1个控制点组成.有15个地点(因此有15个排除点+ 15个成对的地块= 30个实验单位).每个实验单元都有唯一的"id".冷杉的丰度(比例:0到1之间的连续值)已被监控了5年(每年一次=重复测量).因此,重复的度量嵌套在"id"中.
The experimental design consist of exclosures (treatment = no moose), paired with control plots (treatment = moose). A site consist of 1 exclosure + 1 control plot. There are 15 sites (so 15 exclosures + 15 paired plots = 30 experimental units). Each experimental units has is unique "id". The abundance (proportion : continuous value between 0 and 1) of fir has been monitored for 5 years (once every year = repeated measures). So the repeated measures is nested inside the "id".
我想分析处理对杉木丰度的影响,同时控制数据的成对结构和重复测量.
I want to analyze the effect of treatments on fir abundance while controlling for the paired structure of the data and the repeated measures.
由于响应数据是一个比例(0和1之间的丰度),所以我被定向为GLMM,其值为family = binomial.
Since the response data is a proportion (abundance between 0 and 1), I have been directed toward GLMM with family=binomial.
但是,我不确定如何对模型进行编码.我试过了:
However, I am not entirely sure on how to code my model. I tried :
fit = glmer(fir ~ treatment*time + (time|id) + (1|site), data=dat1, family=binomial)
如果我正确,(1 | site)"将控制配对结构,而(time | id)"将控制重复结构(因为"time"嵌套在"id"中).
If I get this right, "(1|site)" would control for the paired structure, and "(time|id)" would control for the repeated structure (since "time" is nested into "id").
但是我收到以下错误:
Warning messages:
1: In eval(family$initialize, rho) :
non-integer #successes in a binomial glm!
2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
unable to evaluate scaled gradient
3: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
Hessian is numerically singular: parameters are not uniquely determined
您知道我的模型出了什么问题以及这些错误消息是什么意思吗?
Any idea what goes wrong with my model and what these error messages mean ?
Thx
推荐答案
我已经学会了同时包含配对结构和重复测量的方法.
I have learned a way to include both paired structure and repeated measures.
但是首先,我了解到您不能一目了然地直接使用比例,因为您会丢失有关该比例的坚固性"的信息.例如,如果您在2个地块中的1个地块中有fir,则可获得50%的丰度,但是50%的可信任度"较低,则在120个地块中有60个地块中有fir(这也给出50%的丰度). 此外,不可能在glmer中插入Correlation参数. 在我们的实验中,4200是采样的努力:
But first, I learned that you cannot directly use proportions in a glmer, since you loose information about the "solidity" of that proportion. For example, if you have fir in 1 out of 2 plots, you obtain 50% of abundance, but that 50% is less "trustable" then having 60 plots with fir out of 120 plots (which also give 50% abundance). Additionally, it is not possible to insert a Correlation parameters in glmer. In our experiment, 4200 was the effort of sampling :
dat1$fir2 = round(dat1$fir*4200);
dat1$N = 4200
要同时包含成对的结构和重复的度量,可以使用库(MASS)中的带有惩罚拟似性(或 glmmPQL )的广义线性混合模型.通过与corCAR1()相关的参数来包含重复的测量值.
To include both paired structure and repeated measures, you can use Generalized Linear Mixed Models using Penalized Quasi-Likelihood (or glmmPQL) from library(MASS). The repeated measures are included via a correlation parameter with corCAR1().
上述情况的模型为:
fit2 = glmmPQL(cbind(fir2, N-fir2) ~ treatment*time,
random=~1|site/treatment, data=dat1, family=binomial,
correlation=corCAR1(form = ~time|site/treatment))
干杯!
这篇关于尝试对成对的数据和重复的度量值运行glmer时出错(lme4)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!