stat_smooth (confidence) interval based on SD, rather than SE

995 views
Skip to first unread message

r.nieu...@utwente.nl

unread,
May 26, 2010, 2:38:34 AM5/26/10
to ggp...@googlegroups.com
Hello,

I'm trying to plot some data, which I do not treat as a sample from a
population. However, when I plot these data as a scatterplot, I would
like to add a trend-line (smooth, or linear regression) with some kind
of indication of the dispersion around the trend-line. I tried
stat_smooth, which provides lovely confidence intervals. But, of course,
these are based on the standard error.

Would it be possible to use stat_smooth to provide margings around the
(smoothed) regression line, but based on the standard deviation?

Kind regards,

Rense

Hadley Wickham

unread,
May 26, 2010, 9:53:48 AM5/26/10
to r.nieu...@utwente.nl, ggp...@googlegroups.com
Hi Rense,

There's no built in way to do this - you're best of fitting the model
you want outside of ggplot2 and then using geom_smooth to display the
appropriate error band.

Hadley

> --
> You received this message because you are subscribed to the ggplot2 mailing list.
> Please provide a reproducible example: http://gist.github.com/270442
>
> To post: email ggp...@googlegroups.com
> To unsubscribe: email ggplot2+u...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2
>

--
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

Reply all
Reply to author
Forward
0 new messages