Skip to content
Prev 18601 / 20628 Next

lme4 - Mixed Model question

?? I *think* that if you simply set the values of the covariates you 
want to disregard for each group to 0 for that group, you'll get what 
you want.? I don't think there's a way to do that in the formula 
specification; you can obviously write code to do it, but doing it 
elegantly could be tricky.? If I were doing it I might try something 
*approximately* along the lines of

 ?? vars <- list(g1=c("x1","x2"), g2=c("x2","x3"))

 ?? all_vars <- unique(unlist(vars))

 ?? for (i in seq_along(models)) {

 ????? my_data[group==names(models)[i], setdiff(all_vars, vars[[i]])] <- 0

 ?? }
On 7/13/20 12:06 PM, Axel Urbiz wrote: