R ggplot:geomsmooth 95%CI而非标准错误

时间:2017-07-04 15:25:05

标签: r ggplot2

我创建了以下情节:

enter image description here

geom_smooth现在显示标准错误,但我想95% CI。对此有一个简单的解决方法吗?

我使用了以下代码:

MMSEmodel <- (lmer(MMSE~ Age + Eduy + Gender + study +     DateMMSE*AMYLOID_BL*BL_Diaggroups + (1 + DateMMSE|study), seleduy)

fitMMSE <- fitted(MMSEmodel)


MMSEplot <- qplot(DateMMSE, fitMMSE, data=seleduy, geom=c("smooth"), method="glm", color=BL_Diaggroups, linetype=AMYLOID_BL, fill=BL_Diaggroups)+ theme_classic() + xlab("Time (years)") + ylab("MMSE") + scale_x_continuous(expand=c(0,0)) +  coord_cartesian(xlim = c(0,4), ylim = c(15,30)) + scale_color_manual(values=c("#339900", "#FF6600", "#0000CC")) + scale_fill_manual(values=c("#66CC66", "#FF9966", "#3366FF")) + scale_linetype(guide_legend(title = "Amyloid status")) + guides(lty = guide_legend(override.aes = list(col = 'black')))

谢谢!

1 个答案:

答案 0 :(得分:1)

来自ggplot2的{​​{1}}文档:

  

SE
  显示周围光滑的置信区间? (默认情况下为TRUE,请参阅控制级别

由于在您的代码中我没有看到任何覆盖默认设置的参数 - 所以se频段显示95%的置信区间。要将这些更改为90%或99%等,请查找stat_smooth

相关问题