I am trying to run a car::vif()
test in R, to test for multicollinearity. However, when I run the code
reg.model1 <- log(Price2) ~ Detached.house + Semi.detached.house +
Attached.houses + Apartment +
Stock.apartment + Housing.cooperative + Sole.owner + Age +
BRA + Bedrooms + Balcony + Lotsize + Sentrum + Alna + Vestre.Aker +
Nordstrand + Marka + Ullern + Østensjø + Søndre.Nordstrand + Stovner +
Nordre.Aker + Bjerke + Grorud + Gamle.Oslo + St..Hanshaugen +
Grünerløkka + Sagene + Frogner
reg1 <- lm(formula = reg.model1, data = Data)
vif(reg1)
I receive this error in the console:
Error in vif.default(reg1) : there are aliased coefficients in the model.
What I have read is that this means that there is something in the model that is highly correlated. When I look at the correlation matrix the only thing that is highly correlated is the dependent variable Price
. But I also read somewhere that the dependent variable is okay even if it's highly correlated. I also found out that BRA
is 0.8 in correlation so I tried to run it again without this, and still get the same error. Does anyone know what the problem could be, or what I could try to do differently?