Reputation: 11
I'm running the following code:
library(lme4)
library(nlme)
nest.reg2 <- glmer(SS ~ (bd|cond), family = "binomial",
data = combined2)
coef(nest.reg2)
summary(nest.reg2)
Which produces the following output:
$cond
bd (Intercept)
LL -1.014698 1.286768
no -3.053920 4.486349
SS -5.300883 8.011879
Generalized linear mixed model fit by maximum likelihood (Laplace
Approximation) [glmerMod]
Family: binomial ( logit )
Formula: SS ~ (bd | cond)
Data: combined2
AIC BIC logLik deviance df.resid
1419.7 1439.7 -705.8 1411.7 1084
Scaled residuals:
Min 1Q Median 3Q Max
-8.0524 -0.8679 -0.4508 1.0735 2.2756
Random effects:
Groups Name Variance Std.Dev. Corr
cond (Intercept) 33.34 5.774
bd 13.54 3.680 -1.00
Number of obs: 1088, groups: cond, 3
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.3053 0.1312 -2.327 0.02 *
My question is how do I test the significance of each of the coefficients for this model? The Summary function seems to only provide a p-value for the intercept, not the coefficients.
When I try anova(nest.reg2)
I get nothing, just:
Analysis of Variance Table
Df Sum Sq Mean Sq F value
I've tried the solutions proposed here (How to obtain the p-value (check significance) of an effect in a lme4 mixed model?) to no avail.
To clarify, the cond
variable is a factor with three levels (SS
, no
, and LL
), and I believe that the coef
command produces coefficients for the continuous bd
variable at each of those levels, so what I'm trying to do is test the significance of those coefficients.
Upvotes: 1
Views: 914
Reputation: 226522
There are several issues here.
glmer(SS ~ bd + (1|cond), ...)
which will model the overall (population-level) distinctions among the levels of bd
and include variation in the intercept among levels of cond
.
bd
represented in each cond
group, then you can in principle also allow for variation in treatment effects among cond
groups:glmer(SS ~ bd + (bd|cond), ...)
cond
) isn't really enough, in practice, to estimate variability among groups. That's why you're seeing a correlation of -1.00 in your output, which indicates you have a singular fit (e.g. see here for more discussion).cond
as a fixed effect (adjusting the contrasts on cond
so that the main effect of bd
is estimated as the average across groups rather than the effect in the baseline level of cond
).glm(SS~bd*cond,contrasts=list(cond=contr.sum),...)
Upvotes: 3