等级不足警告混合模型 [英] rank deficiency warning mixed model lmer

查看:893
本文介绍了等级不足警告混合模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含142个数据条目的数据集:在两种情况下(治疗前后,两年,年份= 0或1)测量了121个人,第二年有46个人处于治疗地块,其余处于对照图(处理= 0或1).这是一些示例数据:

I have a dataset with 142 data entries: 121 individuals measured on two occasions (two years, before and after treatment, Year = 0 or 1), in the second year 46 individuals were in treated plots and the rest were in control plots (treatment = 0 or 1). Here's some example data:

ID <- c("480", "480", "620", "620","712","712")
Year <- c("0", "1", "0", "1","0", "1")
Plot <- c("14", "14", "13", "13","20","20")
Treat <- c("0", "0", "0", "1", "0", "1")
Exp <- c("31", "43", "44", "36", "29", "71")
ExpSqrt <- c("5.567764", "6.557439", "6.633250", "6.000000", "5.385165", "8.426150")

Winter <- data.frame(ID, Year, Plot, Treat,
                  Exp, ExpSqrt,
                  stringsAsFactors = TRUE) 

地块和个人是随机因素,我试图拟合一个混合模型来确定年份,治疗的效果以及它们之间的相互作用:

Plots and individuals are random factors and I'm trying to fit a mixed model to determine the effect of Year, Treatment and the interaction between them:

model_Exp <- lmer(ExpSqrt~Year+Treat+Year*Treat+(1|ID)+(1|Plot),data=Winter)

但我不断收到警告消息:

but I keep getting the warning message:

"fixed-effect model matrix is rank deficient so dropping 1 column / coefficient"

这将删除交互.

我的数据集中没有NA值,并且Exp始终为正,但是我将sqrt转换为非正态分布.这不是一个特别小的数据集,我尝试使用插入符号包中的findLinearCombos函数,但未返回任何结果.

I have no NA values in my dataset and Exp is always positive but I have sqrt transformed this as the distribution was non-normal. It's not a particularly small dataset, I have tried the using the function findLinearCombos from the caret package but it returns no result.

我的理解是存在一些问题,因为治疗1仅在year = 1条件下发生(但并非在所有情况下:Year = 1还包含75个对照个体).

My understanding is that there is some problem because treatment 1 only occurs under condition year=1 (but not in all instances: Year=1 also contains 75 control individuals).

我不确定a)如何或是否可以解决此问题? 或b)如果无法解决该怎么解释?

I am not sure a) how or if this can be resolved? or b) if it can't be resolved how to interpret this?

我已经阅读了有关此警告的一些响应,但是已经做了建议的所有措施来解决它,我还阅读了一些有关Hauck-Donner效应的信息,但是我不确定这是否是我的问题并且相对而言统计资料的新手,我不能完全理解.

I have read some responses about this warning but have done everything I found suggested to resolve it, I've also read a bit about the Hauck-Donner effect, but I'm not sure if this is my problem and being relatively new to stats I can't admit I entirely understand it.

推荐答案

这并不是专门针对线性混合模型的问题.

This is not really specifically a linear-mixed model problem.

归结为以下事实:如果您在之前"(第0年)内没有进行任何治疗,则无法估算相互作用.

It comes down to the fact that you can't estimate an interaction if you don't have any treatment happening in the 'before' period (year 0).

最简单的示例:

(dd <- data.frame(y=1:3,treat=c(0,0,1),year=c(0,1,1)))

##   y treat year
## 1 1     0    0
## 2 2     0    1
## 3 3     1    1

适合模型:

lm(y~treat*year,dd) ## == year+treat+year:treat
## Call:
## lm(formula = y ~ treat * year, data = dd)
## 
## Coefficients:
## (Intercept)        treat         year   treat:year  
##           1            1            1           NA  

lm不会警告您,但是通过删除多余的共线列并为其参数赋予NA值,它实际上与lmer做相同的事情.如果尝试caret::findLinearCombos(dd[c("year","treat")]),您将一无所获(yeartreat并非共线),但是如果您查看R构造为包括处理列的模型矩阵,则会得到: /p>

lm doesn't warn you, but it effectively does the same thing as lmer by removing the extra, collinear column and giving its parameter an NA value. If you try caret::findLinearCombos(dd[c("year","treat")]) you won't get anything back (year and treat are not perfectly collinear), but if you look at the model matrix that R constructs to include the treatment column, you will get something:

X <- model.matrix(~year*treat,dd)
caret::findLinearCombos(X)
## $linearCombos
## $linearCombos[[1]]
## [1] 4 3
## $remove
## [1] 4

这种实验性设计根本不允许您估计交互作用.如果将其从公式中删除(使用year+treat而不是year*treat),您将获得相同的答案,但没有消息.另外,在典型的控制后影响"设计中(在环境影响评估中),您会将要接受治疗的人标记为影响"或已治疗"的人在第0年;那么相互作用将是您实际估计的治疗效果.

This experimental design simply doesn't allow you to estimate the interaction. If you remove it from the formula (use year+treat instead of year*treat) you'll get the same answer, but without the message. Alternatively, in a typical "before-after-control-impact" design (in environmental impact assessment), you would label the individuals who would be getting the treatment as "impact" or "treated" individuals even in year 0; then the interaction would be your actual estimated effect of treatment.

这篇关于等级不足警告混合模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆