Skip to content

Modelling with uncertain (but not missing) categorical random effect values

3 messages · Mike Lawson, Ben Bolker

#
Thanks for the suggestions Philip and Ben,

I'm coming back to this after a hiatus and this may be quite a basic question.

I managed to get the lme4 hack working with my data, but not if I
include other random effects (that are not multi membership and not in
the matrix).
i.e. in the example you provide, if I add a new random predictor, how
do I incorporate this into the model? As this line directly changes
Ztlist and Zt to be the matrix:

lmod$reTrms$Zt <- lmod$reTrms$Ztlist[[1]] <- Matrix(t(W))

Many thanks,
Mike
On Tue, 3 Aug 2021 at 23:16, Ben Bolker <bbolker at gmail.com> wrote:
#
Something like:

   lmod$reTrms$Ztlist <- list(Matrix(t(W)), Z2, Z3, Z4, ...)

where the additional `Z` components are the random-effects models for 
the additional terms you want (you could for example pull these from an 
`lFormula()` call using a formula that included those components in the 
random effects), and

   lmod$reTrms$Zt <- do.call(rbind, lmod$reTrms$Ztlist)

(I think)
On 12/20/21 12:43 PM, Mike Lawson wrote:

  
    
#
Thanks for the quick response - that did the trick.

All the best,
Mike
On Mon, 20 Dec 2021 at 18:10, Ben Bolker <bbolker at gmail.com> wrote: