MM robust estimation in ggplot2 using stat_smooth with method = “rlm”

前提是你 提交于 2019-12-04 10:17:40

Unfortunately both stat_smooth and rlm have a method parameter. That makes it a bit harder:

ggplot(df,aes(x=x,y=y)) +
  geom_point() +
  stat_smooth(method=function(formula,data,weights=weight) rlm(formula,
                                                               data,
                                                               weights=weight,
                                                                method="MM"),
              fullrange=TRUE) +
  xlim(0,160)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!