[R-gregmisc-users] SF.net SVN: r-gregmisc: [1263] trunk/gplots/R/plot.lm.R
Brought to you by:
warnes
From: <wa...@us...> - 2008-05-07 18:57:56
|
Revision: 1263 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1263&view=rev Author: warnes Date: 2008-05-07 11:57:29 -0700 (Wed, 07 May 2008) Log Message: ----------- Improve performance of plot.lm for large lm objects by using fitted() instead of predict() to get y-hat Modified Paths: -------------- trunk/gplots/R/plot.lm.R Modified: trunk/gplots/R/plot.lm.R =================================================================== --- trunk/gplots/R/plot.lm.R 2008-05-05 20:28:53 UTC (rev 1262) +++ trunk/gplots/R/plot.lm.R 2008-05-07 18:57:29 UTC (rev 1263) @@ -1,6 +1,3 @@ - -##!!! BROKEN !!! - plot.lm2 <- function( x, which = 1:5, @@ -15,7 +12,10 @@ id.n = 3, labels.id = names(residuals(x)), cex.id = 0.75, - band=TRUE,rug=TRUE + band=TRUE, + rug=TRUE, + width=1/10, + max.n=5000 ) { if (!inherits(x, "lm")) @@ -26,7 +26,10 @@ show[which] <- TRUE r <- residuals(x) n <- length(r) - yh <- predict(x) # != fitted() for glm + if(inherits(x,"glm")) + yh <- predict(x) # != fitted() for glm + else + yh <- fitted(x) if (any(show[2:4])) s <- if(inherits(x, "rlm")) x$s else sqrt(deviance(x)/df.residual(x)) if (any(show[2:3])) { @@ -73,8 +76,8 @@ plot(yh, r, xlab = l.fit, ylab = "Residuals", main = main, ylim = ylim, type = "n", ...) panel(yh, r, ...) - if(rug) rug(yh) ## GRW 2001-06-08 - if(band) bandplot(yh,r,add=TRUE) ## GRW 2001-06-08 + if(rug) rug(yh) ## GRW 2001-06-08 + if(band) bandplot(yh,r,add=TRUE,width=width) ## GRW 2001-06-08 if (one.fig) title(sub = sub.caption, ...) mtext(caption[1], 3, 0.25) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |