如何在R中绘制多水平模型治疗效果
我想绘制我的多层次模型的组时间交互。我只能在没有多层结构的情况下绘制它。如何包括嵌套?在同一仪器上对每位患者进行3次测量(治疗前、治疗中和治疗后)。患者被随机分为两组(等待名单和治疗组)。 这是我的模型:如何在R中绘制多水平模型治疗效果,r,ggplot2,plot,model,mixed,R,Ggplot2,Plot,Model,Mixed,我想绘制我的多层次模型的组时间交互。我只能在没有多层结构的情况下绘制它。如何包括嵌套?在同一仪器上对每位患者进行3次测量(治疗前、治疗中和治疗后)。患者被随机分为两组(等待名单和治疗组)。 这是我的模型: m8 <- lmer(score ~ 1 + +time*Group +(1| subject), data = df2) m8% 分组依据(ti、Gruppe、ar、ID)%>% 总结(最高身高=最高(分数))%>%#计算最高分数 ungroup()%>%#需要解组以避免管道混淆
m8 <- lmer(score ~ 1 + +time*Group +(1| subject), data = df2)
m8%
分组依据(ti、Gruppe、ar、ID)%>%
总结(最高身高=最高(分数))%>%#计算最高分数
ungroup()%>%#需要解组以避免管道混淆
分组依据(ti、Gruppe、ar)%>%
总结(分数=平均值(最大高度))
(基本的)如果没有一个可复制的例子,人们很难提供帮助。效果
,emmeans
,sjPlot
软件包也可能值得研究,因为我确实更容易达到我的目标!
score <- data %>%
filter(!is.na(score)) %>%
group_by(ti, Gruppe, ar, ID) %>%
summarise(Max_Height = max(score)) %>% # Calculating max score
ungroup() %>% # Need to ungroup so that the pipe doesn't get confused
group_by(ti, Gruppe, ar) %>%
summarise(score = mean(Max_Height))
(basic_mm_scatter <- ggplot(score, aes(ti, score, colour = Gruppe)) +
geom_point() +
theme_bw() +stat_smooth(method = "lm",))