[R-sig-ME] [EXTERNAL] vif using GLMMadaptive

Philippi, Tom Tom_Ph|||pp| @end|ng |rom np@@gov
Sun May 3 22:30:21 CEST 2020

At a more concrete level than John Fox's reply:

You do not show your exact code that produced the syntax error on family =, but my guess is that you're missing a comma, perhaps after the dataset name and before family, perhaps elsewhere.

More fundamentally, do your indicator variables conservative + liberal + moderate sum to 1, or is there another category that would have 0,0,0 for those three variables?  If they sum to 1, your model is attempting to fit 3 parameters with only 2 degrees of freedom.  Even if there is a 4th category coding as 0,0,0, if that category has a very low frequency the VIF would be high just from these variables.

And, looking at your model, you also have republican and democrat.  Again, do they sum to 1, or is there a substantial independent fraction that codes as 0,0 for those 2 variables?

Whatever you code as republican v democrat is very likely strongly associated with conservative v liberal.  To fit your model you would need substantial numbers of liberal republicans and conservative democrats.  As John wrote, VIF isn't that useful or interpretable given your interactions.  I suggest creating a crosstabulation of {conservative liberal moderate} vs {republican democrat}, and if all cells aren't filled with a reasonable number of observations, think about which of those 2 factors you want to include in the model: you can't obtain estimates if you include both.


-----Original Message-----
From: R-sig-mixed-models <r-sig-mixed-models-bounces using r-project.org> On Behalf Of Matos, Grisenia
Sent: Thursday, April 30, 2020 11:13 PM
To: r-sig-mixed-models using r-project.org
Subject: [EXTERNAL] [R-sig-ME] vif using GLMMadaptive

I am a PhD student and am working on a school  project due over the weekend.  I ran the following regression:
spending.REG <- glm.nb(spending_count ~ conservative + liberal + moderate + trust_gov + liberal*trust_gov + conservative*trust_gov + moderate*trust_gov + income + education + age + female + white + budget_difficult + democrat + republican, data = Trustdata1)

I attempted to get a vif score and got this error in R Studio: there are aliased coefficients in the model

The variables conservative, liberal and moderate are fixed effect where they are either 0 or 1.  The female variable is a 0 or 1.  There are three interactive variables:  moderate*trust_gov, liberal*trust_gov, and conservative*trust_gov.  Moreover, moderate and moderate*trust_gov are the base variables.

I would like to calculate the vif for the regression equation.  First, in order to get rid of the error and thereafter calculate the vif scores, I attempted to use your code:


fm <- mixed_model(y ~ time + sex, random = ~ 1 | id, data = <your_data>, family = zi.negative.binomial(), zi_fixed = ~ sex, zi_random = ~ 1 | id)

it returned an error: unexpected '=' in: "erate + trust_gov + liberal*trust_gov + conservative*trust_gov + moderate*trust_gov + income + education + age + female + white + budget_difficult + democrat + republican, random = 1 | id, dat
                  +                   family ="

Please provide guidance as to what I am doing incorrectly.  I appreciate your help.



	[[alternative HTML version deleted]]

R-sig-mixed-models using r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

More information about the R-sig-mixed-models mailing list