How can I solve multicollinearity?

268 Views Asked by At

I constructed a linear model and tried to calculate the VIF of the variables but I get the following error:

 vif(lm_model3101)

Error in vif.default(lm_model3101) : 
  there are aliased coefficients in the model

To check which numeric variables are corelated, i calculated the correlation of the used numeric variables and there is no perfect or nearly perfect correlation between any variables:

cor(multi)


mydata..CRU.Index. mydata..GDP.per.capita. mydata.price_per_unit mydata.price_discount mydata..AC..Volume.
mydata..CRU.Index.             1.000000000             0.006036169             0.1646463          -0.097077238        -0.006590327
mydata..GDP.per.capita.        0.006036169             1.000000000             0.1526220           0.008135387        -0.137733119
mydata.price_per_unit          0.164646319             0.152621974             1.0000000          -0.100344865        -0.310770525
mydata.price_discount         -0.097077238             0.008135387            -0.1003449           1.000000000         0.339961760
mydata..AC..Volume.           -0.006590327            -0.137733119            -0.3107705           0.339961760         1.000000000

What could the problem be? any help or suggestions? The rest of our explanatory variables are factorial so they can not be correlated

1

There are 1 best solutions below

2
On

Having aliased coefficients doesn't necessarily mean two predictors are perfectly correlated. It means that they are linearly dependent, that is at least one terms is a linear combination of the others. They could be factors or continuous variables. To find them, use the alias function. For example:

y <- runif(10)
x1 <- runif(10)
x2 <- runif(10)
x3 <- x1 + x2

alias(y~x1+x2+x3)

Model :
y ~ x1 + x2 + x3

Complete :
   (Intercept) x1 x2
x3 0           1  1 

This identifies x3 as being the sum of x1 and x2