[R] Coefficients for aliased models

Ross Darnell r.darnell at uq.edu.au
Mon Apr 24 14:27:50 CEST 2006


I find the reporting of aliased terms in class lm objects as little 
inconsistent.

The best way to show  this is to give an example.

X <- mvrnorm(10,c(0,0),Sigma=matrix(c(1,0.5,0.5,1),nrow=2))
Xnew <- as.data.frame(cbind(X,X[,2])) # make copy of X[,2]
names(Xnew) <- c("y","X","Xcopy")
model <- lm(y~X+Xcopy,data=Xnew)
coef(model)  # reports NA for Xcopy estimate
summary(model) # ditto
coef(summary(model)) # drops NA for Xcopy estimate

Is this intentional? Is there a way of extracting the coefficient table 
from the summary output with the aliased term included?

Many thanks

Ross Darnell




More information about the R-help mailing list