| 1 |
\name{p.res.2fact} |
| 2 |
\alias{p.res.2fact} |
| 3 |
\title{Plot Numeric (e.g. Residuals) vs 2 Factors Using Boxplots} |
| 4 |
\description{ |
| 5 |
Plots a numeric \dQuote{residual like} variable against two factor |
| 6 |
covariates, using boxplots. |
| 7 |
} |
| 8 |
\usage{ |
| 9 |
p.res.2fact(x, y, z, restricted, notch = FALSE, |
| 10 |
xlab = NULL, ylab = NULL, main = NULL) |
| 11 |
} |
| 12 |
\arguments{ |
| 13 |
\item{x,y}{two factors or numeric vectors giving the levels of factors.} |
| 14 |
\item{z}{numeric vector of same length as \code{x} and \code{y}, |
| 15 |
typically residuals.} |
| 16 |
\item{restricted}{positive value which truncates the size. The |
| 17 |
corresponding symbols are marked by stars.} |
| 18 |
\item{notch}{logical indicating if the boxplots should be notched, see |
| 19 |
\code{\link{boxplot}(*,notch)}.} |
| 20 |
\item{xlab,ylab}{axis labels, see \code{\link{plot.default}}, per |
| 21 |
default the actual argument expressions.} |
| 22 |
\item{main}{main title passed to \code{plot}, defaulting to the |
| 23 |
deparsed \code{z} argument.} |
| 24 |
} |
| 25 |
\details{ |
| 26 |
if values \emph{are} restricted, this make use of the auxiliar |
| 27 |
function \code{\link{u.boxplot.x}}. |
| 28 |
} |
| 29 |
\author{Lorenz Gygax \email{[email protected]} and Martin Maechler, Jan.95; |
| 30 |
starting from \code{\link{p.res.2x}()}. |
| 31 |
} |
| 32 |
\seealso{\code{\link{p.res.2x}}, \code{\link{boxplot}}, |
| 33 |
\code{\link{plot.lm}}, \code{\link{TA.plot}}. |
| 34 |
} |
| 35 |
\examples{ |
| 36 |
I <- 8; J <- 3; K <- 20 |
| 37 |
xx <- factor(rep(rep(1:I, rep(K,I)),J)) |
| 38 |
yy <- factor(rep(1:J, rep(I*K,J))) |
| 39 |
zz <- rt(I*J*K, df=5) #-- Student t with 5 d.f. |
| 40 |
p.res.2fact(xx,yy,zz, restr= 4, main= "i.i.d. t <- 5 random |.| <= 4") |
| 41 |
mtext("p.res.2fact(xx,yy,zz, restr= 4, ..)", |
| 42 |
line=1, adj=1, outer=TRUE, cex=1) |
| 43 |
|
| 44 |
## Real data |
| 45 |
data(warpbreaks) |
| 46 |
(fm1 <- lm(breaks ~ wool*tension, data = warpbreaks)) |
| 47 |
## call via formula method of p.res.2x(): |
| 48 |
p.res.2x(~ ., fm1) # is shorter than, but equivalent to |
| 49 |
## p.res.2x(~ wool + tension, fm1) ## or the direct |
| 50 |
## with(warpbreaks, p.res.2fact(wool, tension, residuals(fm1))) |
| 51 |
## |
| 52 |
## whereas this is "transposed": |
| 53 |
p.res.2x(~ tension+wool, fm1) |
| 54 |
} |
| 55 |
\keyword{hplot} |
| 56 |
\keyword{regression} |