[R-sig-ME] Modeling crossed/non-nested effects for a binomial probability

Devin McCabe dmccabe at broadinstitute.org
Wed Nov 2 16:21:05 CET 2016


I have a data set consisting of success/failure counts for samples
belonging to two independent grouping variables x1 and x2, i.e.

    x1   x2    n   success   failure
1   A1   B1   10         4         6
2   A1   B2   20        10        10
3   A1   B3   15         6         9
4   A2   B1   12         6         6
5   A2   B2   20        12         8
   ...  ...  ...       ...       ...

I'd like to model the fact that the probability of success, p, for each
observation is 0.5, but that this probability is independently skewed on
the x1-level by s1 and on the x2-level by s2.

This could be a multiplicative effect (p_ij = 0.5 * s1_i * s2_j) or an
additive one (p_ij = 0.5 + s1_i + s2_j). The objects of my interest are the
independent skew vectors s1 and s2.

Is it possible to do this in with glmer or some other package? I'm
currently doing the following and getting accurate estimates with simulated
data, but I'm unsure of its statistical or computational correctness:

library(lme4)
library(boot)

mod <- glmer(cbind(success, failure) ~ 0 + (1 | x1) + (1 | x2),
             data = d, family = "binomial")

coefs <- coef(mod)
s1 <- inv.logit(coefs$x1$`(Intercept)`) - 0.5
s2 <- inv.logit(coefs$x2$`(Intercept)`) - 0.5

Thanks for your help.

	[[alternative HTML version deleted]]



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