I created 5 polr models and then using the Anova anf vif functions to my models.
Here is an example of my data set:
| gender | Work less | happy | lifestatisfied | country | Work much |
|---|---|---|---|---|---|
| 2 | 0 | 7 | 8 | GB | 1 |
| 1 | 1 | 8 | 8 | SE | 0 |
| 1 | 0 | 7 | 9 | DK | 1 |
| 1 | 0 | 6 | 9 | DE | 1 |
| 1 | NA | 7 | 5 | NO | NA |
continued:
| health | education | income | age | marital status |
|---|---|---|---|---|
| 3 | 3 | Na | 61 | NA |
| 4 | 2 | 2 | 30 | NA |
| 1 | 3 | 4 | 39 | 6 |
| 5 | 7 | 5 | 52 | 4 |
| 4 | 1 | 5 | 17 | 5 |
- country is character (i.e. name of countries) I have 5 countries
- gender is dummy 1 or 2
- age is respondents age like 35, 47 etc.
- income is scaled and is 1 to 10
- educ (education) is 1 to 7
- health is scaled 1 to 5
- work less is dummy i.e. 1 or 0
- work much is dummy, i.e. 1 or 0
- marital status is scaled 1 to 6
Here is an example of how I convert my output of vif into table:
vif.model1 = vif(model1)
vif.model1.tolerance = 1/vif.model1
vif.model2 = vif(model2)
vif.model2.tolerance = 1/vif.model2
vif.model3 = vif(model3)
vif.model3.tolerance = 1/vif.model3
vif.model4 = vif(model4)
vif.model4.tolerance = 1/vif.model4
vif.model5 = vif(model5)
vif.model5.tolerance = 1/vif.model5
write.table(vif.model1, "vif.m1.txt", sep = ";", dec = ",")
write.table(vif.model2, "vif.m2.txt", sep = ";", dec = ",")
write.table(vif.model3, "vif.m3.txt", sep = ";", dec = ",")
write.table(vif.model4, "vif.m4.txt", sep = ";", dec = ",")
write.table(vif.model5, "vif.m5.txt", sep = ";", dec = ",")
When I then want to read them in excel I need to do it for all 5, five times.. is there a more easy way to load all the table into one table (with the variable names and model names appearing in the table .. it's not need to be excel. It is also fine if it's something similar to the method of regression output using stargazer.
I tried:
vif.table = table(vif.model1, vif.model2, row.names=TRUE, colnames=TRUE)
But this doesn't work.. the variable names are not included and the table it self just look wrong/weird/strange.
I figured out.. this post helped me: Anova table
and then I just open excel and click on Data -> From Text/CSV and then load my data. It is actually not needed to create tolerance since it easliy can be calculated in excel but I just did it.