To further clear things up for other readers, this formula syntax is a
nice and very useful (if little known) trick for estimating separate
intercepts and x slopes for each level of Trt. It creates a design matrix
like:
[1 0 x_1 0]
[1 0 x_2 0]
[0 1 0 x_3]
[0 1 0 x_4]
where the first two rows belong to Trt=1, the second two rows belong to
Trt=2; columns 1 and 2 are the Trt1 and Trt2 intercepts, respectively; and
columns 3 and 4 contain only the x values for Trt1 and Trt2, respectively,
so their associated coefficients give the group-specific slopes for each
level of Trt.
Jake
On Thu, Sep 7, 2017 at 2:41 PM, Phillip Alday <phillip.alday at mpi.nl>
wrote:
As mentioned previously, the formula syntax for this one is a bit
confusing. The left-hand side was easy enough to figure out from the
brms docs, but the division operator on the RHS was a trick I had never
used before -- it took me looking at the output from the
glmer(...,nAGQ=0) model to get that it's equivalent to
~ 0 + Trt + Trt:x + (x | Rep)
Phillip
On 09/07/2017 06:12 AM, Rolf Turner wrote:
On 07/09/17 10:57, Poe, John wrote:
This is where my being a political scientist on a listserv full of
definitely not political scientists is going to make me look dumb.
I've never actually seen a model specification like that before for a
multilevel model. Is the outcome supposed to be the proportion dead
out of the total population for each row? I'm missing something about
this that is probably very obvious.
After fiddling with it I was able to get it to converge for one chain
but I wouldn't trust it at all right now.
Well, I hadn't seen a model specification quite like that either. It's
brm() syntax, which is a bit different from glm() or glmer() syntax.
The model being fitted is a binomial model, with success probability p
modelled by
g(p) = beta_0 + beta_1 * x + Z_0 + Z_1 * x
where the Z_k are the random effects, and where g() is the link
function, e.g. cloglog(). (I *think* I've got that right.)
Of course beta_0 and beta_1 depend on treatment group and Z_0 and Z_1
depend on "Rep", which is nested within treatment group.
Note that we are talking *generalized* linear mixed models here; the
responses are binomial success counts. "Success" = Dead, since one is
trying to kill the bugs.
For what it's worth the glmer() syntax is
glmer(cbind(Dead,Alive) ~ (0 + Trt)/x + (x | Rep),
family=binomial(link="cloglog"),data=X)
I got the brm() syntax from the vignette; as I said, I'd never seen it
before.
cheers,
Rolf