[R-sig-ME] vif using GLMMadaptive
Ben Bolker
bbo|ker @end|ng |rom gm@||@com
Sun May 3 22:34:18 CEST 2020
My advice would be to sort out the underlying problem (which is
*not* at all related to mixed models) and not move to mixed models in
the hope that that will fix something. I believe (but am not sure) that
you're using vif() from the car package?
* you may be able to un-alias your variables by eliminating the
'main effect' terms in your model; in R formula syntax, A*B is
equivalent to 1+A+B+A:B. So dropping the main effects that are already
included in the * terms, or switching from * to : for interactions, may
solve your problem.
On 5/1/20 2:12 AM, Matos, Grisenia wrote:
> 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:
>
> 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