On 6/7/07, Alan S Barnett <[EMAIL PROTECTED]> 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.
Well, panel.lmline (not panel.lm, BTW) is defined as: > panel.lmline function (x, y, ...) { if (length(x) > 0) panel.abline(lm(as.numeric(y) ~ as.numeric(x)), ...) } So it's not much of a stretch to define panel.rlmline <- function(x, y, ...) if (require(MASS) && length(x) > 0) panel.abline(rlm(as.numeric(y) ~ as.numeric(x)), ...) The other replies have already shown you how you might use this in a call. -Deepayan ______________________________________________ R-help@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.