输入数据,从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
Run Code Online (Sandbox Code Playgroud)
当我在没有"等待"的情况下运行以下代码时,它完美地工作,但是当我尝试使用模型中包含的"等待"运行它时,它会给出奇点问题.
LME_01<-lme(data_mTBS ~ Adhesive*Approach*Aging*wait, na.action=na.exclude,data = Data, random = ~ 1|data_name);
Run Code Online (Sandbox Code Playgroud)
MEEM中的错误(object,conLin,control $ niterEM):在0级,第1区的backsolve中的奇点
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))
Run Code Online (Sandbox Code Playgroud)
&
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))
Run Code Online (Sandbox Code Playgroud)
提前致谢.
tl;博士 @HongOoi告诉你,wait并且Adhesive在你的模型中被混淆.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")
Run Code Online (Sandbox Code Playgroud)
这告诉你,知道这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)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5819 次 |
| 最近记录: |