[R] Finding out collinearity in regression

Young Cho iidn01 at yahoo.com
Thu Jun 30 05:45:48 CEST 2005


Hi, I am trying to find out a collinearity in
explanatory variables with alias(). 

I creat a dataframe:

dat <- ds[,sapply(ds,nlevels)>=2]
dat$Y <- Response

Explanatory variables are factor and response is
continuous random variable. When I run a regression, I
have the following error:

fit <- aov( Y ~ . , data = dat)
Error in "contrasts<-"(`*tmp*`, value =
"contr.treatment") :
        contrasts can be applied only to factors with
2 or more levels

I think there is a dependency in explanatory
variables. So, I wanted to use alias to find out a
dependency in design matrix but I can't because I
cannot create "fit" in the first place.

One of examples I found is:

carprice1.lm <- lm(gpm100 ~
Type+Min.Price+Price+Max.Price+Range.Price,data=carprice)
alias(carprice1.lm)

But, what if I can create lm object ? Then is there a
way to find out a dependency in design matrix? Thanks
a lot for help in advance!

-Young.




More information about the R-help mailing list