equatiomatic icon indicating copy to clipboard operation
equatiomatic copied to clipboard

Support pulling out mean structures at higher levels

Open datalorax opened this issue 4 years ago • 0 comments

Currently, you can pull out the mean structure at level 1, and if you don't specify anything it will do this automatically for any equation that has more than 3 terms at level 1. For example

m0 <- lmer(math ~ female + ses + minority + (1|sch.id), hsb)
extract_eq(m0)
Screen Shot 2020-10-10 at 8 43 39 PM

We might want to also support this at higher levels because if there are a lot of group-level predictors the equation can get quite long. This would also enable us to use wrap = TRUE. For example, instead of this

m1 <- lmer(score ~ group*treatment + (1|sid),
                       data = sim_longitudinal)
extract_eq(m1)
Screen Shot 2020-10-10 at 8 45 24 PM

It might be nice to specify something like

extract_eq(m1, mean_separate = TRUE, wrap = TRUE, terms_per_line = 2)
Screen Shot 2020-10-10 at 8 46 08 PM

I think we could drop the superscripts from the individual coefficients here too (as I've done above) because they would be implied by the \eta (i.e., there would be one \eta for each mean). I would think we'd probably want to implement this similar to the level 1 predictors, having it move to this version automatically if there are more than, say, 3 group-level predictors.

datalorax avatar Oct 11 '20 03:10 datalorax