Solved – R – How to get estimates and p-values for random effects in glmer

lme4-nlmemultilevel-analysisp-valuerrandom-effects-model

I have data about around 100,000 protests nested within 40 countries and I want to analyze when the claims of a protest are directed at the state, based on action and country level characteristics, using glmer. So, I would like to obtain p-values of both the fixed and random effects. My model looks like this:

targets <- glmer(state ~ ENV + HLH + HRI + LAB + SMO + Capital + 
(1 + rile + parties + rep + rep2 + gdppc + election| Country), 
data = df, family = binomial)

After centering and standardizing the predictors, the model converges fine after some hours. However, the output only gives me the Variance & Std.Dev. of the random effects, as well as the correlations among them, which makes sense for most multilevel analyses but not for my purposes. I am not so much interested in the variation of the intercepts and slopes of the model by country, but I rather want to know the direction of the impact of both action and state level characteristics, as well as whether it is significant. The summary of the glmer model gives me already that for the fixed effects. Is there any way I can get the estimates and the p-values for the random effects too?

If this cannot be done with Multilevel Regression Models or lme4 does not provide that output, is there any other model or software that would give such an output?

Best Answer

I don't think there is anyway to get p-values for the random effects, but you can use the est. of variance +/- ((Std.Dev/sqrt(n)) * 1.96) as a rough hand calculation to see if the interval includes zero - if it does then it is not significant at the 0.05 level - although this can be adjusted to different significance values. There are two schools of thought around random effects, as I understand it. There are those who believe that if a random effects should be retained regardless of signficance (purists), and those that remove them if they are insignificant. I am personally in the former - here are some good reasons for why.

As for calculating fixed effect p-values one can use must the same approach but calculating n is a little more complicated. There are three other approaches.

1) Fit the model without the effect of interest and then compare the two models using an anova (as they are nested) and this is an analogue for the desired p-value.

3) Use the predictmeans::predictmeans function - this outputs pairwise differences by default, as well as a few other informative plots.

3) The lmtest package might work for this - it was built to calculate these.

I can't check the later right now I am afraid as I am having a little trouble with R I am afraid....

Let me know if you are still having trouble after trying those out though!