I think I found the answer to my own question.
One can use
fittedvalue <- fitted(multivarfit)
plot(fittedvalue, y) in the below function.
Thanks to Verzani's simple R manual for leading me to this.
----- Original Message -----
From: AA
To: R-Help
Sent: Sunday, March 18, 2007 2:42 PM
Subject: simple multivariate linear model plot
Dear R-users,
I am trying to get a simple plot for a linear model. The following function
does the job
of getting all the plots of the lm function but the "main" plot.
multivarplot <-
function(...){
x1 <- rnorm(10); x2 <- rnorm(10); x3 <- rnorm(10)
y <- rnorm(10)
multivarfit <- lm(y ~ x1 + x2 + x3)
par(mfrow = c(3,2))
plot.lm(multivarfit)
}
where the "main" plot is graph of the variable (fitted : x1 + x2 +
x3 ) against y.
This is similar to the graph in Phil Spector's book (intro to the S and
Splus) p. 227.
It seems to be a very simple task but I cannot figure it out.
Thank you for any hint.
I use R 2.4.0 windows xp.
AA.
[[alternative HTML version deleted]]