【问题标题】:Singularity in backsolve at level 0, block 1 in LME modelLME 模型中第 0 级、第 1 块反解中的奇异性
【发布时间】:2018-05-24 09:06:56
【问题描述】:

输入数据, 从https://pastebin.com/1f7VuBkx 复制(太大,此处无法包含)

data.frame':    972 obs. of  7 variables:
$ data_mTBS : num  20.3 22.7 0 47.8 58.7 ...
$ data_tooth: num  1 1 1 1 1 1 1 1 1 1 ...
$ Adhesive  : Factor w/ 4 levels "C-SE2","C-UBq",..: 2 2 2 2 2 2 2 2 2 2 ...
$ Approach  : Factor w/ 2 levels "ER","SE": 1 1 1 1 1 1 1 1 1 1 ...
$ Aging     : Factor w/ 2 levels "1w","6m": 1 1 1 1 1 1 2 2 2 2 ...
$ data_name : Factor w/ 40 levels "C-SE2-1","C-SE2-10",..: 11 11 11 11 11 11 11 11 11 11 ...
$ wait      : Factor w/ 2 levels "no","yes": 1 1 1 1 1 1 1 1 1 1 ...
head(Data)


   data_mTBS data_tooth Adhesive Approach Aging data_name wait
1     20.27          1    C-UBq       ER    1w   C-UBq-1   no
2     22.73          1    C-UBq       ER    1w   C-UBq-1   no
3      0.00          1    C-UBq       ER    1w   C-UBq-1   no
4     47.79          1    C-UBq       ER    1w   C-UBq-1   no
5     58.73          1    C-UBq       ER    1w   C-UBq-1   no
6     57.02          1    C-UBq       ER    1w   C-UBq-1   no

当我在没有“等待”的情况下运行以下代码时,它可以完美运行,但是当我尝试在模型中包含“等待”的情况下运行它时,它会出现奇点问题。

LME_01<-lme(data_mTBS ~ Adhesive*Approach*Aging*wait, na.action=na.exclude,data = Data, random = ~ 1|data_name);

MEEM(object, conLin, control$niterEM) 中的错误:奇点 在第 0 级反解,第 1 块

contrast_Aging<-contrast(LME_01,a = list(Aging =c("1w"),Adhesive = levels(Data$Adhesive),Approach = levels(Data$Approach) ),b = list(Aging =c("6m"), Adhesive = levels(Data$Adhesive),Approach = levels(Data$Approach)))

c1<-as.matrix(contrast$X)
Contrastsi2<-summary(glht(LME_01, c1))

&

contrast_Approach<-contrast(LME_01,
                                    a = list(Approach = c("SE"), Aging =levels(Data$Aging)   ,Adhesive = levels(Data$Adhesive)),
                                    b = list(Approach = c("ER"), Aging =levels(Data$Aging)   ,Adhesive = levels(Data$Adhesive)))

c2<-as.matrix(contrast$X)
Contrastsi3<-summary(glht(LME_01, c2))

提前致谢。

【问题讨论】:

  • 检查您的数据中是否同时包含 wait=no 和 yes
  • @HongOoi 'no' 只适用于一层'Adhesive'; C-UBq。其他 3 个级别的“粘合剂”等待“是”。
  • 那么……是不是真的要告诉你粘合剂不是什么?
  • 是的,它与 Aging and Approach 同等重要。
  • 其实没有,我加了它是因为在比较 SE:ER 和比较 1w 和 6m 时我得到了相同的对比度。我用对比代码编辑了帖子。感谢您的帮助

标签: r mixed-models


【解决方案1】:

tl;dr 正如@HongOoi 告诉你的那样,waitAdhesive 在你的模型中被混淆了。 lme 比 R 中的许多其他建模函数更愚蠢/更顽固,它会明确警告您混淆了固定效果或自动为您删除其中一些。

如果你绘制数据,会更容易看到这一点:

## source("SO50505290_data.txt")

library(ggplot2)
ggplot(dd,aes(Adhesive,data_mTBS,
              fill=Aging,
              alpha=Approach))+
  facet_grid(.~wait,scale="free_x",space="free",
             labeller=label_both)+
  guides(alpha = guide_legend(override.aes = list(fill = "darkgray")))+
  geom_boxplot()
ggsave("SO50505290.png")

这表明您知道wait=="no" 与知道Adhesive=="C-UBq" 相同。

备份并考虑您提出的问题可能更有意义,但如果您使用lme4::lmer 这样做,它会告诉您

固定效应模型矩阵秩不足,因此删除 16 列/系数

library(lme4)
LME_02<-lmer(data_mTBS ~ Adhesive*Approach*Aging*wait+
               (1|data_name), 
            na.action=na.exclude,data = dd)

【讨论】:

    猜你喜欢
    • 2021-02-12
    • 2021-09-02
    • 1970-01-01
    • 1970-01-01
    • 2011-02-12
    • 1970-01-01
    • 2020-04-18
    • 1970-01-01
    • 2021-03-25
    相关资源
    最近更新 更多