Skip to content

names of model coefficients etc

2 messages · David Firth, Brian Ripley

#
I am curious about the reason for the following:
[1] "(Intercept)"  "x"            "cbind(z, w)z" "cbind(z, w)w"
[1] "y"             "x"             "cbind(z, w).z" "cbind(z, w).w"
[1] FALSE  TRUE FALSE FALSE

It would be helpful for some purposes if all components except the 
first here could be TRUE.  Presumably there is some good reason for 
the difference?  Can someone please enlighten me?
#
On Fri, 28 Sep 2001, David Firth wrote:

            
xzw$model is the model frame: xzw$coefficients refers to the model
matrix.  With factors in the model they are very different.

I guess you wanted a linear model fit with x=TRUE and xzw$x, as it

y <- rnorm(100)
x <- rnorm(100)
z <- rnorm(100)
w <- rnorm(100)
xzw<-lm(y ~ x+cbind(z,w), x = TRUE)
colnames(xzw$x)
[1] "(Intercept)"  "x"            "cbind(z, w)z" "cbind(z, w)w"

Further, be careful of calling xzw$coefficients rather than coef(xzw).
You will not always get the same thing with other fitting functions.


Brian