[S] plot.mlm

Christian Hoffmann (christian.hoffmann@wsl.ch)
Mon, 29 Jun 1998 15:56:36 +0200


Hi,

There is an obvoius bug in "plot.mlm", confusing y-labels and plots.
Here is a corrected version. It plots expected against fitted, afterwards
absolute residuals against fitted.

If this proposal is not what the original author of "plot.mlm" wanted,
please suggest something else.

"plot.mlm" <-
function(x, xlab, ylab, ..., ask = T)
{ # make two final loops, C.Hoffmann 1998.06.29
op <- par(ask = ask)
on.exit(par(op))
form <- formula(x)
f <- predict(x)
r <- residuals(x)
y <- f + r
q <- dim(y)[2]
if(is.null(q))
stop("not a multiple response model")
if(missing(ylab)) {
ylab <- dimnames(y)[[2]]
ylab <- c(ylab, paste("absolute residuals of", ylab))
}
if(missing(xlab))
xlab <- paste("Fitted:", deparse(form[[3]]), collapse = " ")
xlab <- rep(xlab, length = 2 * q)
ylab <- rep(ylab, length = 2 * q)
for(i in 1:q) {
plot(f[, i], y[, i], xlab = xlab[i], ylab = ylab[i], ...)
abline(0, 1, lty = 2)
}
for(i in 1:q) {
plot(f[, i], abs(r[, i]), xlab = xlab[i+q], ylab = ylab[i+q], ...)
}
}

Regards

Christian W. Hoffmann
Swiss Federal Institute for Forest, Snow and Landscape Research
CH-8903 Birmensdorf, Switzerland
phone: ++41-1-739 22 77 fax : ++41-1-739 22 15 e-mail: hoffmann@wsl.ch
WWW: http://www.wsl.ch/wsidb/leute/cho/choHPENG.html
I prefer WWW pages which can be viewed best with *any* browser, contain
*no* cookies, *no* Java, *no* frames, and *no* required images !
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news