[R-gregmisc-users] SF.net SVN: r-gregmisc:[1738] trunk/gplots
Brought to you by:
warnes
From: <wa...@us...> - 2013-10-15 02:09:33
|
Revision: 1738 http://sourceforge.net/p/r-gregmisc/code/1738 Author: warnes Date: 2013-10-15 02:09:31 +0000 (Tue, 15 Oct 2013) Log Message: ----------- Rename boxplot.n to boxplt2 and plot.lm2 to lmplot2 Modified Paths: -------------- trunk/gplots/man/gplots-deprecated.Rd Added Paths: ----------- trunk/gplots/R/boxplot2.R trunk/gplots/R/lmplot2.R trunk/gplots/man/boxplot2.Rd trunk/gplots/man/lmplot2.Rd Removed Paths: ------------- trunk/gplots/R/boxplot.n.R trunk/gplots/R/plot.lm.R trunk/gplots/man/boxplot.n.Rd trunk/gplots/man/boxplot2.Rd trunk/gplots/man/lmplot2.Rd trunk/gplots/man/plot.lm2.Rd Deleted: trunk/gplots/R/boxplot.n.R =================================================================== --- trunk/gplots/R/boxplot.n.R 2013-10-15 01:47:31 UTC (rev 1737) +++ trunk/gplots/R/boxplot.n.R 2013-10-15 02:09:31 UTC (rev 1738) @@ -1,52 +0,0 @@ -# $Id$ - -boxplot.n <- function( ..., top=FALSE, shrink=1.0, textcolor=NULL ) - { - boxcall <- match.call() # get call - boxcall$top <- boxcall$shrink <- boxcall$textcolor <- NULL - boxcall[[1]] <- as.name("boxplot") - - if(is.R()) - { - box <- eval(boxcall, parent.frame()) - mids <- 1:length(box$n) - } - else - { - mids <- eval(boxcall, parent.frame()) - boxcall$plot <- FALSE - box <- eval(boxcall, parent.frame()) - } - - if(top) - { - where <- par("usr")[4] - adj <- c(0.5,1) - } - else - { - where <- par("usr")[3] - adj <- c(0.5,0) - } - tcex <- par("cex") - par(cex=shrink*tcex) - - if(is.R()) - text( x=mids, y=where, labels=paste("n=",box$n,sep=""), adj=adj, - col=textcolor) - else - { - if( is.null(textcolor) ) - textcolor <- 1 - space <- ifelse(top, -1, 1) * par("1em")[2] / 2 - - text( x=mids, y=where + space, labels=paste("n=",box$n,sep=""), adj=adj[1], - col=textcolor) - - } - - par(cex=tcex) - - invisible(box) - } - Copied: trunk/gplots/R/boxplot2.R (from rev 1672, trunk/gplots/R/boxplot.n.R) =================================================================== --- trunk/gplots/R/boxplot2.R (rev 0) +++ trunk/gplots/R/boxplot2.R 2013-10-15 02:09:31 UTC (rev 1738) @@ -0,0 +1,60 @@ +# $Id$ +boxplot.n <- function( ..., top=FALSE, shrink=1.0, textcolor=NULL ) + { + .Deprecated("gboxplot", package="gplots") + cl <- match.call() + mf <- match.call(expand.dots = FALSE) + mf[[1L]] <- quote(boxplot2) + eval(mf, parent.frame()) + } + +boxplot2 <- function( ..., top=FALSE, shrink=1.0, textcolor=NULL ) + { + boxcall <- match.call() # get call + boxcall$top <- boxcall$shrink <- boxcall$textcolor <- NULL + boxcall[[1]] <- as.name("boxplot") + + if(is.R()) + { + box <- eval(boxcall, parent.frame()) + mids <- 1:length(box$n) + } + else + { + mids <- eval(boxcall, parent.frame()) + boxcall$plot <- FALSE + box <- eval(boxcall, parent.frame()) + } + + if(top) + { + where <- par("usr")[4] + adj <- c(0.5,1) + } + else + { + where <- par("usr")[3] + adj <- c(0.5,0) + } + tcex <- par("cex") + par(cex=shrink*tcex) + + if(is.R()) + text( x=mids, y=where, labels=paste("n=",box$n,sep=""), adj=adj, + col=textcolor) + else + { + if( is.null(textcolor) ) + textcolor <- 1 + space <- ifelse(top, -1, 1) * par("1em")[2] / 2 + + text( x=mids, y=where + space, labels=paste("n=",box$n,sep=""), adj=adj[1], + col=textcolor) + + } + + par(cex=tcex) + + invisible(box) + } + Copied: trunk/gplots/R/lmplot2.R (from rev 1672, trunk/gplots/R/plot.lm.R) =================================================================== --- trunk/gplots/R/lmplot2.R (rev 0) +++ trunk/gplots/R/lmplot2.R 2013-10-15 02:09:31 UTC (rev 1738) @@ -0,0 +1,183 @@ +plot.lm2 <- function( + x, + which = 1:5, + caption = c("Residuals vs Fitted", "Normal Q-Q plot", + "Scale-Location plot", "Cook's distance plot"), + panel = panel.smooth, + sub.caption = deparse(x$call), + main = "", + ask = interactive() && nb.fig < length(which) + && .Device != "postscript", + ..., + id.n = 3, + labels.id = names(residuals(x)), + cex.id = 0.75, + band=TRUE, + rug=TRUE, + width=1/10, + max.n=5000 + ) +{ + cl <- match.call() + mf <- match.call(expand.dots = FALSE) + mf[[1L]] <- quote(lmplot2) + eval(mf, parent.frame()) +} + + +lmplot2 <- function( + x, + which = 1:5, + caption = c("Residuals vs Fitted", "Normal Q-Q plot", + "Scale-Location plot", "Cook's distance plot"), + panel = panel.smooth, + sub.caption = deparse(x$call), + main = "", + ask = interactive() && nb.fig < length(which) + && .Device != "postscript", + ..., + id.n = 3, + labels.id = names(residuals(x)), + cex.id = 0.75, + band=TRUE, + rug=TRUE, + width=1/10, + max.n=5000 + ) +{ + if (!inherits(x, "lm")) + stop("Use only with 'lm' objects") + show <- rep(FALSE, 5) + if(!is.numeric(which) || any(which < 1) || any(which > 5)) + stop("`which' must be in 1:5") + show[which] <- TRUE + r <- residuals(x) + n <- length(r) + 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])) { + ylab23 <- if(inherits(x, "glm")) + "Std. deviance resid." else "Standardized residuals" + hii <- lm.influence(x)$hat + w <- weights(x) + # r.w := weighted.residuals(x): + r.w <- if(is.null(w)) r else (sqrt(w)*r)[w!=0] + rs <- r.w/(s * sqrt(1 - hii)) + } + if (any(show[c(1,3)])) + l.fit <- if(inherits(x,"glm")) + "Predicted values" else "Fitted values" + if (is.null(id.n)) + id.n <- 0 + else { + id.n <- as.integer(id.n) + if(id.n < 0 || id.n > n) + stop(paste("`id.n' must be in { 1,..,",n,"}")) + } + if(id.n > 0) { + if(is.null(labels.id)) + labels.id <- paste(1:n) + iid <- 1:id.n + show.r <- order(-abs(r))[iid] + if(any(show[2:3])) + show.rs <- order(-abs(rs))[iid] + text.id <- function(x,y, ind, adj.x = FALSE) + text(x - if(adj.x) strwidth(" ")*cex.id else 0, y, labels.id[ind], + cex = cex.id, xpd = TRUE, adj = if(adj.x) 1) + } + nb.fig <- prod(par("mfcol")) + one.fig <- prod(par("mfcol")) == 1 + if (ask) { + op <- par(ask = TRUE) + on.exit(par(op)) + } + ##---------- Do the individual plots : ---------- + if (show[1]) { + ylim <- range(r) + if(id.n > 0) + ylim <- ylim + c(-1,1)* 0.08 * diff(ylim) + 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,width=width) ## GRW 2001-06-08 + if (one.fig) + title(sub = sub.caption, ...) + mtext(caption[1], 3, 0.25) + if(id.n > 0) { + y.id <- r[show.r] + y.id[y.id < 0] <- y.id[y.id < 0] - strheight(" ")/3 + text.id(yh[show.r], y.id, show.r, adj.x = TRUE) + } + abline(h = 0, lty = 3, col = "gray") + } + if (show[2]) { + ylim <- range(rs) + ylim[2] <- ylim[2] + diff(ylim) * 0.075 + qq <- qqnorm(rs, main = main, ylab = ylab23, ylim = ylim, ...) + qqline(rs) + if (one.fig) + title(sub = sub.caption, ...) + mtext(caption[2], 3, 0.25) + if(id.n > 0) + text.id(qq$x[show.rs], qq$y[show.rs], show.rs, adj.x = TRUE) + } + if (show[3]) { + sqrtabsr <- sqrt(abs(rs)) + ylim <- c(0, max(sqrtabsr)) + yl <- as.expression(substitute(sqrt(abs(YL)), list(YL=as.name(ylab23)))) + yhn0 <- if(is.null(w)) yh else yh[w!=0] + plot(yhn0, sqrtabsr, xlab = l.fit, ylab = yl, main = main, + ylim = ylim, type = "n", ...) + panel(yhn0, sqrtabsr, ...) + + abline(h=mean(sqrtabsr),lty = 3, col = "gray") + if(rug) rug(yh) ## GRW 2001-06-08 + if(band) bandplot(yhn0,sqrtabsr,add=TRUE) ## GRW 2001-06-08 + + if (one.fig) + title(sub = sub.caption, ...) + mtext(caption[3], 3, 0.25) + if(id.n > 0) + text.id(yhn0[show.rs], sqrtabsr[show.rs], show.rs, adj.x = TRUE) + } + if (show[4]) { + cook <- cooks.distance(x, sd=s) + if(id.n > 0) { + show.r <- order(-cook)[iid]# index of largest `id.n' ones + ymx <- cook[show.r[1]] * 1.075 + } else ymx <- max(cook) + plot(cook, type = "h", ylim = c(0, ymx), main = main, + xlab = "Obs. number", ylab = "Cook's distance", ...) + if (one.fig) + title(sub = sub.caption, ...) + mtext(caption[4], 3, 0.25) + if(id.n > 0) + text.id(show.r, cook[show.r] + 0.4*cex.id * strheight(" "), show.r) + } + if (show[5]) + { + ## plot residuals against each predictor ## + data <- model.frame(x) + for( i in 2:ncol(data) ) + { + test <- try( + { + plot.default( x=data[,i], y=r, + xlab=names(data)[i], ylab="Residuals", type="n") + panel( data[,i], r, ... ) + if(rug) rug(data[,i]) + if(band) bandplot(data[,i],r,add=TRUE) + abline(h=0,lty = 3, col = "gray") + } + ) + } + } + if (!one.fig && par("oma")[3] >= 1) + mtext(sub.caption, outer = TRUE, cex = 1.25) + invisible() +} Deleted: trunk/gplots/R/plot.lm.R =================================================================== --- trunk/gplots/R/plot.lm.R 2013-10-15 01:47:31 UTC (rev 1737) +++ trunk/gplots/R/plot.lm.R 2013-10-15 02:09:31 UTC (rev 1738) @@ -1,156 +0,0 @@ -plot.lm2 <- function( - x, - which = 1:5, - caption = c("Residuals vs Fitted", "Normal Q-Q plot", - "Scale-Location plot", "Cook's distance plot"), - panel = panel.smooth, - sub.caption = deparse(x$call), - main = "", - ask = interactive() && nb.fig < length(which) - && .Device != "postscript", - ..., - id.n = 3, - labels.id = names(residuals(x)), - cex.id = 0.75, - band=TRUE, - rug=TRUE, - width=1/10, - max.n=5000 - ) -{ - if (!inherits(x, "lm")) - stop("Use only with 'lm' objects") - show <- rep(FALSE, 5) - if(!is.numeric(which) || any(which < 1) || any(which > 5)) - stop("`which' must be in 1:5") - show[which] <- TRUE - r <- residuals(x) - n <- length(r) - 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])) { - ylab23 <- if(inherits(x, "glm")) - "Std. deviance resid." else "Standardized residuals" - hii <- lm.influence(x)$hat - w <- weights(x) - # r.w := weighted.residuals(x): - r.w <- if(is.null(w)) r else (sqrt(w)*r)[w!=0] - rs <- r.w/(s * sqrt(1 - hii)) - } - if (any(show[c(1,3)])) - l.fit <- if(inherits(x,"glm")) - "Predicted values" else "Fitted values" - if (is.null(id.n)) - id.n <- 0 - else { - id.n <- as.integer(id.n) - if(id.n < 0 || id.n > n) - stop(paste("`id.n' must be in { 1,..,",n,"}")) - } - if(id.n > 0) { - if(is.null(labels.id)) - labels.id <- paste(1:n) - iid <- 1:id.n - show.r <- order(-abs(r))[iid] - if(any(show[2:3])) - show.rs <- order(-abs(rs))[iid] - text.id <- function(x,y, ind, adj.x = FALSE) - text(x - if(adj.x) strwidth(" ")*cex.id else 0, y, labels.id[ind], - cex = cex.id, xpd = TRUE, adj = if(adj.x) 1) - } - nb.fig <- prod(par("mfcol")) - one.fig <- prod(par("mfcol")) == 1 - if (ask) { - op <- par(ask = TRUE) - on.exit(par(op)) - } - ##---------- Do the individual plots : ---------- - if (show[1]) { - ylim <- range(r) - if(id.n > 0) - ylim <- ylim + c(-1,1)* 0.08 * diff(ylim) - 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,width=width) ## GRW 2001-06-08 - if (one.fig) - title(sub = sub.caption, ...) - mtext(caption[1], 3, 0.25) - if(id.n > 0) { - y.id <- r[show.r] - y.id[y.id < 0] <- y.id[y.id < 0] - strheight(" ")/3 - text.id(yh[show.r], y.id, show.r, adj.x = TRUE) - } - abline(h = 0, lty = 3, col = "gray") - } - if (show[2]) { - ylim <- range(rs) - ylim[2] <- ylim[2] + diff(ylim) * 0.075 - qq <- qqnorm(rs, main = main, ylab = ylab23, ylim = ylim, ...) - qqline(rs) - if (one.fig) - title(sub = sub.caption, ...) - mtext(caption[2], 3, 0.25) - if(id.n > 0) - text.id(qq$x[show.rs], qq$y[show.rs], show.rs, adj.x = TRUE) - } - if (show[3]) { - sqrtabsr <- sqrt(abs(rs)) - ylim <- c(0, max(sqrtabsr)) - yl <- as.expression(substitute(sqrt(abs(YL)), list(YL=as.name(ylab23)))) - yhn0 <- if(is.null(w)) yh else yh[w!=0] - plot(yhn0, sqrtabsr, xlab = l.fit, ylab = yl, main = main, - ylim = ylim, type = "n", ...) - panel(yhn0, sqrtabsr, ...) - - abline(h=mean(sqrtabsr),lty = 3, col = "gray") - if(rug) rug(yh) ## GRW 2001-06-08 - if(band) bandplot(yhn0,sqrtabsr,add=TRUE) ## GRW 2001-06-08 - - if (one.fig) - title(sub = sub.caption, ...) - mtext(caption[3], 3, 0.25) - if(id.n > 0) - text.id(yhn0[show.rs], sqrtabsr[show.rs], show.rs, adj.x = TRUE) - } - if (show[4]) { - cook <- cooks.distance(x, sd=s) - if(id.n > 0) { - show.r <- order(-cook)[iid]# index of largest `id.n' ones - ymx <- cook[show.r[1]] * 1.075 - } else ymx <- max(cook) - plot(cook, type = "h", ylim = c(0, ymx), main = main, - xlab = "Obs. number", ylab = "Cook's distance", ...) - if (one.fig) - title(sub = sub.caption, ...) - mtext(caption[4], 3, 0.25) - if(id.n > 0) - text.id(show.r, cook[show.r] + 0.4*cex.id * strheight(" "), show.r) - } - if (show[5]) - { - ## plot residuals against each predictor ## - data <- model.frame(x) - for( i in 2:ncol(data) ) - { - test <- try( - { - plot.default( x=data[,i], y=r, - xlab=names(data)[i], ylab="Residuals", type="n") - panel( data[,i], r, ... ) - if(rug) rug(data[,i]) - if(band) bandplot(data[,i],r,add=TRUE) - abline(h=0,lty = 3, col = "gray") - } - ) - } - } - if (!one.fig && par("oma")[3] >= 1) - mtext(sub.caption, outer = TRUE, cex = 1.25) - invisible() -} Deleted: trunk/gplots/man/boxplot.n.Rd =================================================================== --- trunk/gplots/man/boxplot.n.Rd 2013-10-15 01:47:31 UTC (rev 1737) +++ trunk/gplots/man/boxplot.n.Rd 2013-10-15 02:09:31 UTC (rev 1738) @@ -1,57 +0,0 @@ -% $Id$ -% -% $Log$ -% Revision 1.5 2005/12/01 16:46:52 nj7w -% Updated Greg's email address -% -% Revision 1.4 2005/06/09 14:20:28 nj7w -% Updating the version number, and various help files to synchronize splitting of gregmisc bundle in 4 individual components. -% -% Revision 1.1.1.1 2005/05/25 22:15:30 nj7w -% Initial submission as an individual package -% -% Revision 1.3 2002/04/09 00:51:31 warneg -% -% Checkin for version 0.5.3 -% -% Revision 1.2 2001/08/25 05:46:21 warneg -% Added CVS header. -% -% Revision 1.1 2001/08/25 05:45:10 warneg -% Initial Checkin -% -\name{boxplot.n} -\alias{boxplot.n} -\title{Produce a Boxplot Annotated with the Number of Observations} -\description{ - This funcntion uses \code{boxplot} to produce a boxplot which is then - annotated with the number of observations in each group. -} -\usage{ -boxplot.n(..., top=FALSE, shrink=1, textcolor=NULL) -} -\arguments{ - \item{\dots}{ parameters passed to \code{boxplot}. } - \item{top}{ logical indicating whether the number of observations - should be added to the top or the bottom of the plotting - region. Defaults to \code{FALSE}. } - \item{shrink}{ value to shrink character size (cex) when annotating.} - \item{textcolor}{ text color. } -} -\author{ Gregory R. Warnes \email{gr...@wa...}} -\seealso{ \code{\link{boxplot}}, \code{\link{text}}} - -\examples{ -data(state) - -# n's at bottom -boxplot.n( state.area ~ state.region) - -# n's at top -boxplot.n( state.area ~ state.region, top=TRUE) - -# small red text -boxplot.n( state.area ~ state.region, shrink=0.8, textcolor="red") -} - -\keyword{ hplot } Deleted: trunk/gplots/man/boxplot2.Rd =================================================================== --- trunk/gplots/man/boxplot2.Rd 2013-10-15 01:47:31 UTC (rev 1737) +++ trunk/gplots/man/boxplot2.Rd 2013-10-15 02:09:31 UTC (rev 1738) @@ -1,57 +0,0 @@ -% $Id$ -% -% $Log$ -% Revision 1.5 2005/12/01 16:46:52 nj7w -% Updated Greg's email address -% -% Revision 1.4 2005/06/09 14:20:28 nj7w -% Updating the version number, and various help files to synchronize splitting of gregmisc bundle in 4 individual components. -% -% Revision 1.1.1.1 2005/05/25 22:15:30 nj7w -% Initial submission as an individual package -% -% Revision 1.3 2002/04/09 00:51:31 warneg -% -% Checkin for version 0.5.3 -% -% Revision 1.2 2001/08/25 05:46:21 warneg -% Added CVS header. -% -% Revision 1.1 2001/08/25 05:45:10 warneg -% Initial Checkin -% -\name{boxplot.n} -\alias{boxplot.n} -\title{Produce a Boxplot Annotated with the Number of Observations} -\description{ - This funcntion uses \code{boxplot} to produce a boxplot which is then - annotated with the number of observations in each group. -} -\usage{ -boxplot.n(..., top=FALSE, shrink=1, textcolor=NULL) -} -\arguments{ - \item{\dots}{ parameters passed to \code{boxplot}. } - \item{top}{ logical indicating whether the number of observations - should be added to the top or the bottom of the plotting - region. Defaults to \code{FALSE}. } - \item{shrink}{ value to shrink character size (cex) when annotating.} - \item{textcolor}{ text color. } -} -\author{ Gregory R. Warnes \email{gr...@wa...}} -\seealso{ \code{\link{boxplot}}, \code{\link{text}}} - -\examples{ -data(state) - -# n's at bottom -boxplot.n( state.area ~ state.region) - -# n's at top -boxplot.n( state.area ~ state.region, top=TRUE) - -# small red text -boxplot.n( state.area ~ state.region, shrink=0.8, textcolor="red") -} - -\keyword{ hplot } Copied: trunk/gplots/man/boxplot2.Rd (from rev 1672, trunk/gplots/man/boxplot.n.Rd) =================================================================== --- trunk/gplots/man/boxplot2.Rd (rev 0) +++ trunk/gplots/man/boxplot2.Rd 2013-10-15 02:09:31 UTC (rev 1738) @@ -0,0 +1,42 @@ +\name{boxplot2} +\alias{boxplot2} +\title{Produce a Boxplot Annotated with the Number of Observations} +\description{ + This funcntion uses \code{boxplot} to produce a boxplot which is then + annotated with the number of observations in each group. +} +\usage{ +boxplot2(..., top=FALSE, shrink=1, textcolor=NULL) +} +\arguments{ + \item{\dots}{ parameters passed to \code{boxplot}. } + \item{top}{ logical indicating whether the number of observations + should be added to the top or the bottom of the plotting + region. Defaults to \code{FALSE}. } + \item{shrink}{ value to shrink character size (cex) when annotating.} + \item{textcolor}{ text color. } +} +\author{ Gregory R. Warnes \email{gr...@wa...}} +\note{ + This function replaces \code{boxplot.n}, which has been deprecated + avoid potential problems with S3 method dispatching. +} +\seealso{ + \code{\link{boxplot}}, + \code{\link{text}} +} + +\examples{ +data(state) + +# n's at bottom +boxplot2( state.area ~ state.region) + +# n's at top +boxplot2( state.area ~ state.region, top=TRUE) + +# small red text +boxplot2( state.area ~ state.region, shrink=0.8, textcolor="red") +} + +\keyword{ hplot } Modified: trunk/gplots/man/gplots-deprecated.Rd =================================================================== --- trunk/gplots/man/gplots-deprecated.Rd 2013-10-15 01:47:31 UTC (rev 1737) +++ trunk/gplots/man/gplots-deprecated.Rd 2013-10-15 02:09:31 UTC (rev 1738) @@ -1,57 +1,53 @@ -% $Id$ -% -% $Log$ -% Revision 1.5 2005/12/01 16:46:52 nj7w -% Updated Greg's email address -% -% Revision 1.4 2005/06/09 14:20:28 nj7w -% Updating the version number, and various help files to synchronize splitting of gregmisc bundle in 4 individual components. -% -% Revision 1.1.1.1 2005/05/25 22:15:30 nj7w -% Initial submission as an individual package -% -% Revision 1.3 2002/04/09 00:51:31 warneg -% -% Checkin for version 0.5.3 -% -% Revision 1.2 2001/08/25 05:46:21 warneg -% Added CVS header. -% -% Revision 1.1 2001/08/25 05:45:10 warneg -% Initial Checkin -% -\name{boxplot.n} +\name{gplots-deprecated} \alias{boxplot.n} -\title{Produce a Boxplot Annotated with the Number of Observations} +\alias{plot.lm2} +\title{Deprecated functions} \description{ - This funcntion uses \code{boxplot} to produce a boxplot which is then - annotated with the number of observations in each group. + These funcntion have been deprecated and will be removed in future + releases of gplots. } \usage{ -boxplot.n(..., top=FALSE, shrink=1, textcolor=NULL) + boxplot.n(..., top=FALSE, shrink=1, textcolor=NULL) + plot.lm2( + x, + which = 1:5, + caption = c("Residuals vs Fitted", "Normal Q-Q plot", + "Scale-Location plot", "Cook's distance plot"), + panel = panel.smooth, + sub.caption = deparse(x$call), + main = "", + ask = interactive() && nb.fig < length(which) + && .Device != "postscript", + ..., + id.n = 3, + labels.id = names(residuals(x)), + cex.id = 0.75, + band=TRUE, + rug=TRUE, + width=1/10, + max.n=5000 + ) } \arguments{ - \item{\dots}{ parameters passed to \code{boxplot}. } - \item{top}{ logical indicating whether the number of observations - should be added to the top or the bottom of the plotting - region. Defaults to \code{FALSE}. } - \item{shrink}{ value to shrink character size (cex) when annotating.} - \item{textcolor}{ text color. } + \item{\dots}{see man page for the corresponding replacement function} + \item{top, shrink, textcolor}{See man page for + \code{\link{boxplot2}}.} + \item{x, which, caption, panel, sub.caption, main, ask, id.n, + labels.id, cex.id, band, rug, width, max.n}{See man page for + \code{\link{lmplot2}}.} } -\author{ Gregory R. Warnes \email{gr...@wa...}} -\seealso{ \code{\link{boxplot}}, \code{\link{text}}} - -\examples{ -data(state) - -# n's at bottom -boxplot.n( state.area ~ state.region) - -# n's at top -boxplot.n( state.area ~ state.region, top=TRUE) - -# small red text -boxplot.n( state.area ~ state.region, shrink=0.8, textcolor="red") +\details{ +These functions have been deprecated. Please refer to the manual page +for the replacement function: + \itemize{ + \item \code{boxplot.n} has been replaced by \code{\link{boxplot2}} + \item \code{plot.lm2} has been replaced by \code{\link{lmplot2}} + } } - -\keyword{ hplot } +\author{Gregory R. Warnes \email{gr...@wa...}} +\seealso{ + \code{\link{boxplot2}}, + \code{\link{lmplot2}}, + \code{\link[base]{Deprecated}} +} +\keyword{misc} Deleted: trunk/gplots/man/lmplot2.Rd =================================================================== --- trunk/gplots/man/lmplot2.Rd 2013-10-15 01:47:31 UTC (rev 1737) +++ trunk/gplots/man/lmplot2.Rd 2013-10-15 02:09:31 UTC (rev 1738) @@ -1,71 +0,0 @@ -\name{plot.lm2} -\alias{plot.lm2} -\title{ - Plots to assess the goodness of fit for the linear model objects -} -\description{ - Plots to assess the goodness of fit for the linear model objects - } - \usage{ - plot.lm2( - x, - which = 1:5, - caption = c("Residuals vs Fitted", "Normal Q-Q plot", - "Scale-Location plot", "Cook's distance plot"), - panel = panel.smooth, - sub.caption = deparse(x$call), - main = "", - ask = interactive() && nb.fig < length(which) - && .Device != "postscript", - ..., - id.n = 3, - labels.id = names(residuals(x)), - cex.id = 0.75, - band=TRUE, - rug=TRUE, - width=1/10, - max.n=5000 - ) -} -\arguments{ - \item{x}{lm object} - \item{which}{Numerical values between 1 and 5, indicating which plots - to be shown. The codes are: - - 1- fitted vs residuals plot - 2- Normal Q-Q plot - 3- Scale-Location plot - 4- Cook's distance plot - 5- residuals vs each predictor plot - } - \item{caption}{ Caption for each type of plot} - \item{panel}{ function to draw on the existing plot} - \item{sub.caption}{ SubCaption for the plots } - \item{main}{Main title of the plot} - \item{ask}{whether interactive graphics or postscript } - \item{\dots}{ parameters passed to \code{plot.lm2}. } - \item{id.n}{ integer value, less than or equal to residuals of lm object } - \item{labels.id}{Names of the residuals of the lm object} - \item{cex.id}{Parameter to control the height of text stringsx} - \item{band}{logical vector indicating whether bandplot should also be plotted } - \item{rug}{logical vector indicating whether rug should be added to - the existing plot } - \item{width}{Fraction of the data to use for plot smooths} - \item{max.n}{Maximum number of points to display in plots} -} -\author{Gregory R. Warnes \email{gr...@wa...} and Nitin - Jain \email{nit...@pf...}} -\examples{ -ctl <- rnorm(100, 4) -trt <- rnorm(100, 4.5) -group <- gl(2,100,200, labels=c("Ctl","Trt")) -weight <- c(ctl, trt) -wt.err <- rnorm(length(weight), mean=weight, sd=1/2) -x <- lm(weight ~ group + wt.err) - -plot.lm2(x) - -plot.lm2(x, which=1, width=1/3) -plot.lm2(x, which=1:3, widht=1/3) -} -\keyword{hplot} Copied: trunk/gplots/man/lmplot2.Rd (from rev 1735, trunk/gplots/man/plot.lm2.Rd) =================================================================== --- trunk/gplots/man/lmplot2.Rd (rev 0) +++ trunk/gplots/man/lmplot2.Rd 2013-10-15 02:09:31 UTC (rev 1738) @@ -0,0 +1,79 @@ +\name{lmplot2} +\alias{lmplot2} +\title{ + Plots to assess the goodness of fit for the linear model objects +} +\description{ + Plots to assess the goodness of fit for the linear model objects + } + \usage{ + lmplot2( + x, + which = 1:5, + caption = c("Residuals vs Fitted", "Normal Q-Q plot", + "Scale-Location plot", "Cook's distance plot"), + panel = panel.smooth, + sub.caption = deparse(x$call), + main = "", + ask = interactive() && nb.fig < length(which) + && .Device != "postscript", + ..., + id.n = 3, + labels.id = names(residuals(x)), + cex.id = 0.75, + band=TRUE, + rug=TRUE, + width=1/10, + max.n=5000 + ) +} +\arguments{ + \item{x}{lm object} + \item{which}{Numerical values between 1 and 5, indicating which plots + to be shown. The codes are: + \describe{ + \item{1}{Fitted vs residuals} + \item{2}{Normal Q-Q} + \item{3}{Scale-Location} + \item{4}{Cook's distance} + \item{5}{Residuals vs. predictor} + } + } + \item{caption}{ Caption for each type of plot} + \item{panel}{ function to draw on the existing plot} + \item{sub.caption}{ SubCaption for the plots } + \item{main}{Main title of the plot} + \item{ask}{whether interactive graphics or postscript } + \item{\dots}{ parameters passed to \code{lmplot2}. } + \item{id.n}{ integer value, less than or equal to residuals of lm object } + \item{labels.id}{Names of the residuals of the lm object} + \item{cex.id}{Parameter to control the height of text stringsx} + \item{band}{logical vector indicating whether bandplot should also be plotted } + \item{rug}{logical vector indicating whether rug should be added to + the existing plot } + \item{width}{Fraction of the data to use for plot smooths} + \item{max.n}{Maximum number of points to display in plots} +} +\note{ + This function replaces \code{boxplot.n}, which has been deprecated + avoid potential problems with S3 method dispatching. +} +\author{Gregory R. Warnes \email{gr...@wa...} and Nitin + Jain \email{nit...@pf...}} +\seealso{ + \code{\link[stats]{plot.lm}} + } +\examples{ +ctl <- rnorm(100, 4) +trt <- rnorm(100, 4.5) +group <- gl(2,100,200, labels=c("Ctl","Trt")) +weight <- c(ctl, trt) +wt.err <- rnorm(length(weight), mean=weight, sd=1/2) +x <- lm(weight ~ group + wt.err) + +lmplot2(x) + +lmplot2(x, which=1, width=1/3) +lmplot2(x, which=1:3, widht=1/3) +} +\keyword{hplot} Deleted: trunk/gplots/man/plot.lm2.Rd =================================================================== --- trunk/gplots/man/plot.lm2.Rd 2013-10-15 01:47:31 UTC (rev 1737) +++ trunk/gplots/man/plot.lm2.Rd 2013-10-15 02:09:31 UTC (rev 1738) @@ -1,71 +0,0 @@ -\name{plot.lm2} -\alias{plot.lm2} -\title{ - Plots to assess the goodness of fit for the linear model objects -} -\description{ - Plots to assess the goodness of fit for the linear model objects - } - \usage{ - plot.lm2( - x, - which = 1:5, - caption = c("Residuals vs Fitted", "Normal Q-Q plot", - "Scale-Location plot", "Cook's distance plot"), - panel = panel.smooth, - sub.caption = deparse(x$call), - main = "", - ask = interactive() && nb.fig < length(which) - && .Device != "postscript", - ..., - id.n = 3, - labels.id = names(residuals(x)), - cex.id = 0.75, - band=TRUE, - rug=TRUE, - width=1/10, - max.n=5000 - ) -} -\arguments{ - \item{x}{lm object} - \item{which}{Numerical values between 1 and 5, indicating which plots - to be shown. The codes are: - - 1- fitted vs residuals plot - 2- Normal Q-Q plot - 3- Scale-Location plot - 4- Cook's distance plot - 5- residuals vs each predictor plot - } - \item{caption}{ Caption for each type of plot} - \item{panel}{ function to draw on the existing plot} - \item{sub.caption}{ SubCaption for the plots } - \item{main}{Main title of the plot} - \item{ask}{whether interactive graphics or postscript } - \item{\dots}{ parameters passed to \code{plot.lm2}. } - \item{id.n}{ integer value, less than or equal to residuals of lm object } - \item{labels.id}{Names of the residuals of the lm object} - \item{cex.id}{Parameter to control the height of text stringsx} - \item{band}{logical vector indicating whether bandplot should also be plotted } - \item{rug}{logical vector indicating whether rug should be added to - the existing plot } - \item{width}{Fraction of the data to use for plot smooths} - \item{max.n}{Maximum number of points to display in plots} -} -\author{Gregory R. Warnes \email{gr...@wa...} and Nitin - Jain \email{nit...@pf...}} -\examples{ -ctl <- rnorm(100, 4) -trt <- rnorm(100, 4.5) -group <- gl(2,100,200, labels=c("Ctl","Trt")) -weight <- c(ctl, trt) -wt.err <- rnorm(length(weight), mean=weight, sd=1/2) -x <- lm(weight ~ group + wt.err) - -plot.lm2(x) - -plot.lm2(x, which=1, width=1/3) -plot.lm2(x, which=1:3, widht=1/3) -} -\keyword{hplot} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |