Skip to content
Prev 19990 / 20628 Next

Bradley Terry GLMM in R ?

Also:

  you *can* use generic design matrices in lme4, using the modular 
interface described in ?lme4::modular.  I didn't engage with this thread 
enough yet to figure exactly *which* Z and X matrices you wanted to 
construct (I think in this case it's mostly the Z matrix you're worried 
about?), but the basic approach would be


## 1. use a formula and data with *approximately* what you want (e.g. 
using the right grouping variables)
lmod <- lFormula(...)
## 2. substitute whatever you want in lmod$reTrms$Zt and lmod$reTrms$Ztlist
## 3. finish
devfun <- do.call(mkLmerDevfun, lmod)
opt <- optimizeLmer(devfun)
mkMerMod(environment(devfun), opt, lmod$reTrms, fr = lmod$fr)

   There's an example here

https://bbolker.github.io/mixedmodels-misc/notes/multimember.html

   cheers
    Ben Bolker
On 2022-10-16 5:49 p.m., Shira Mitchell wrote: