Re: [R] rlm results on trellis plot

From: Chuck Cleland <>
Date: Fri, 08 Jun 2007 09:23:03 -0400

Alan S Barnett 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.

  How about using panel.abline() instead of panel.lmline()?

fit1 <- coef(lm(stack.loss ~ Air.Flow, data = stackloss)) fit2 <- coef(rlm(stack.loss ~ Air.Flow, data = stackloss))

xyplot(stack.loss ~ Air.Flow, data=stackloss,

       panel = function(x, y, ...){
         panel.xyplot(x, y, ...)
         panel.abline(fit1, type="l", col="blue")
         panel.abline(fit2, type="l", col="red")
       }, aspect=1)

Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Fri 08 Jun 2007 - 13:48:34 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 - 16:31:35 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.