0

I have tried to run a mixed model in R as such

result < lme(sleep ~ Age + BMI + Family_Type + Bedroom_Darkness + Race + Air_Condition + Bedroom_Sound, random = ~ Date_value | user_id, data = df)

but i get an error

Error in lme.formula(sleep ~ Age + BMI + Family_Type + Bedroom_Darkness +  : 
nlminb problem, convergence error code = 1
message = iteration limit reached without convergence (10)

So I wish to test for collinearity, so I put my predictor variables in a data frame which looks like (but with hundreds or rows)

 Bedroom_Darkness                   Family_Type            Air_Condition   Bedroom_Sound    Race     BMI         Age
Medium Dark (without eye mask)    Married and No Child    Yes             Quiet            Others   23.80540    41
Medium Dark (without eye mask)    Married and No Child    Yes             Quiet            Indian   20.66116    52 
Medium Dark (with eye mask)       Single                  No              Quiet            Chinese   21.35921   31

but when i run the vif function from the usda package

vif(df_predictors)

I get

         Variables      VIF
1 Bedroom_Darkness       NA
2      Family_Type       NA
3    Air_Condition       NA
4    Bedroom_Sound       NA
5             Race       NA
6              BMI 1.267998
7              Age 3.170107

So how can i get the VIF for the categorical variables?

Runner Bean
  • 4,895
  • 12
  • 40
  • 60
  • The tools of regression analysis are applied by indicating the categories of qualitative categorical variable through dummy variables. So you need to recode your categorical variables to dummy variables. – Miha Apr 05 '17 at 11:54
  • Dummy variables are commonly used, but it is widely debated if they should be used. Categorical variables are a hard bunch to estimate collinearity for and be sure that you are seeing what you think you are seeing. Here is a link to an explanation of why: http://www.stata.com/statalist/archive/2003-06/msg00288.html and one to and explanation of how you might try anyway..notice it is debated in the comments below:http://stackoverflow.com/questions/33397689/multi-collinearity-for-categorical-variables. – sconfluentus Apr 05 '17 at 11:59

0 Answers0