[R-sig-ME] vif using GLMMadaptive

Fox, John j|ox @end|ng |rom mcm@@ter@c@
Sun May 3 22:24:03 CEST 2020


Dear Grisenia,

> -----Original Message-----
> From: R-sig-mixed-models <r-sig-mixed-models-bounces using r-project.org> On
> Behalf Of Matos, Grisenia
> Sent: Friday, May 1, 2020 2:13 AM
> To: r-sig-mixed-models using r-project.org
> Subject: [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

I guess that you're using the vif() function in the car package (there are, I believe, other implementations as well). The reference to RStudio is irrelevant -- you'd almost surely get the same error regardless of the which programming editor you use with R.

Aliased coefficients imply that there's either perfect collinearity among the regressors in your model or a flat likelihood at the maxium, making some coefficients unidentified. In this situation, at least some of the VIFs are infinite.

In addition, the meaning of VIFs in models with interactions is ambiguous --- subject to variation depending upon inessential changes to the model, such as how contrasts for factors like sex are defined. To understand the problem, see the Fox and Monette paper referenced in ?vif. 

I hope this helps,
 John

--------------------------------------
John Fox, Professor Emeritus
McMaster University
Hamilton, Ontario, Canada
Web: socialsciences.mcmaster.ca/jfox/


> 
> 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:
> 
> library("GLMMadaptive")
> 
> 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.
> 
> Thanks,
> 
> Grisenia
> 
> 
> 
> 
> 
> 	[[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