Use the VIF test

Asked

Viewed 1,036 times

1

I’m trying to run the VIF test for a two-stage MQO model, but the following shows up:

Warning message: In v1 * v2 : length of larger object is not Shorter object length multiple

Follows the model:

lm(MEDIA_9EF_JUNTO ~ nona_D_esperado + ID_DEPENDENCIA_ADM + ID_LOCALIZACAO + nona_TAXA_PARTICIPACAO_9EF + ICG + NIVEL_SOCIO_ECONOMICO + Zlocalização, data=nona_serie_final_excluido))

follows the class of variables also:

##VERIFICANDO CLASSES

> class(quinta_serie_final_excluido$MEDIA_5EF_JUNTO)
[1] "numeric"
> class(quinta_D_esperado)
[1] "numeric"
> class(quinta_serie_final_excluido$ID_DEPENDENCIA_ADM)
[1] "integer"
> class(quinta_serie_final_excluido$ID_LOCALIZACAO)
[1] "integer"
> class(quinta_TAXA_PARTICIPACAO_5EF)
[1] "numeric"
> class(quinta_serie_final_excluido$ICG)
[1] "integer"
> class(quinta_serie_final_excluido$NIVEL_SOCIO_ECONOMICO)
[1] "integer"
> class(quinta_serie_final_excluido$Zlocalização)
[1] "integer"

1 answer

2

For the implementation of VIF (Variance inflation factor), in a regression analysis, do:

dataset<-data.frame(v1=c(4,5,5,5,6,7,6,6,7,7),v2=c(5,6,6,4,3,2,4,5,6,7),v3=c(4,5,6,6,7,8,5,6,6,7))

reg<-lm(v1~v2+v3,data=dataset)
summary(reg)

#Call:
#lm(formula = v1 ~ v2, data = dataset, subset = v3)

#Residuals:
#Min      1Q  Median      3Q     Max 
#-0.8624 -0.2271  0.1514  0.1651  0.6239 

#Coefficients:
        #Estimate Std. Error t value Pr(>|t|)    
#(Intercept)   7.8073     0.4323  18.060 9.07e-08 ***
#v2           -0.4862     0.1322  -3.679  0.00623 ** 
#---
#Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

#Residual standard error: 0.4363 on 8 degrees of freedom
#Multiple R-squared:  0.6286,   Adjusted R-squared:  0.5821 
#F-statistic: 13.54 on 1 and 8 DF,  p-value: 0.006225

Now, the desired test:

library(car)

vif(reg)
#v2      v3 
#1.16129 1.16129 

Browser other questions tagged

You are not signed in. Login or sign up in order to post.