Re: [R] rlm results on trellis plot

From: hadley wickham <h.wickham_at_gmail.com>
Date: Fri, 08 Jun 2007 16:25:17 +0200

On 6/7/07, Alan S Barnett <asb_at_mail.nih.gov> wrote:
> How do I add to a trellis plot the best fit line from a robust fit? I
> can use panel.lm to add a least squares fit, but there is no panel.rlm
> function.

It's not trellis, but it's really easy to do this with ggplot2:

install.packages("ggplot2", dep=T)
library(ggplot2)

p <- qplot(x, y, data=diamonds)

p + geom_smooth(method="lm")
p + geom_smooth(method="rlm")
p + geom_smooth(method="lm", formula="y ~ poly(x,3)")

see http://had.co.nz/ggplot2/stat_smooth.html for more examples.

Hadley



R-help_at_stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri 08 Jun 2007 - 15:24:33 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 08 Jun 2007 - 15:31:54 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.