# [Rd] Alias does not label rows and columns correctly. (PR#2586)

**dsmith@santafe.edu
**
dsmith@santafe.edu

*Thu Feb 27 02:39:02 2003*

Alias does not label rows and columns correctly. Instead of labeling the
rows with the removed predictors, and the cols with the included predictors;
instead, it labels the columns with the first r predictors (where r is the
rank of the matrix) and the rows with the remaining predictors.
Here's an example:
> Y<-c(0,1,2)
> X1<-c(0,1,0)
> X2<-c(0,1,0)
> X3<-c(0,0,1)
> alias(lm(Y ~ X1 + X2 + X3))
Model :
Y ~ X1 + X2 + X3
Complete :
(Intercept) X1 X2
X3 1
X1 and X2 are colliner, but alias reports X1 is collinear with X3.
The error is only in the assignment of names, the matrix alias prints
is correct. Here's a fix (there may well be a better one, I'm new to R)
in function alias.lm, replace the line:
# dimnames(beta12) <- list(dn[p1], dn[ -p1])
with:
c<-object$coefficients
dimnames(beta12) <- list(names(c[!is.na(c)]), names(c[is.na(c)]))
Derek