R: How to remove outliers from a smoother in ggplot2?

家住魔仙堡 提交于 2019-12-04 07:44:17

Have you tried the family = "symmetric" argument to geom_smooth (which will in turn get passed on to loess)? This will make the loess smooth resistant to outliers.

However, looking at your data, why do you think a linear fit is not adequate? You only have 4 x values, and there certainly doesn't seem to be strong evidence for a departure from linearity.

First, I'm not sure an 'outlier' is even properly defined on such small data.

Second, you'd then have to decide what you mean by "outlier" that is, is it one of the drugs, one of the replicates, or one of the time points?

As Hadley notes, there is little evidence of deviation from linearity.

Finally, I think part of the point of using a smoother is that it deals well with outliers, provided there is enough data. But you have very little.

So, I have to ask exactly why you want to remove outliers. That is, what are you going to do with these data (besides making nice plots)?

I hope this helps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!