Skip to content

Converting lme4 model syntax into corresponding regression equation

3 messages · Simon Harmel, Ben Bolker, Pierre de Villemereuil

#
Hello all,

I was wondering if there is any way (e.g., from an existing R package or
function) to obtain the combined regression equation from an R formula used
to fit an lme4::lmer() model?

For example, if I used `lmer(math ~ ses*sector + (ses | sch.id), data =
data)`, then the expected output in R expression would be:

ex <- expression(math == gamma[00] + gamma[01]*sector + gamma[10]*ses +
gamma[11]*(sector *ses)+U[0]+U1*ses+e)

plot(1, main = ex, cex.main = .7)
#
Assuming this is also you:

https://stackoverflow.com/questions/64189964/converting-a-mixed-model-r-syntax-into-its-corresponding-mathematical-equation

  If you're going to cross-post, **please** indicate that fact by 
providing a link in one or both directions!  (The info page for the 
mailing list does say: "Please refrain from cross-posting to related 
venues (e.g. StackExchange sites and other R mailing lists.)")

   The reason for this request is that cross-posting can lead to a lot 
of confusion and duplicated effort.

   cheers
    Ben Bolker
On 10/3/20 8:43 PM, Simon Harmel wrote:
#
Hi,

I've recently seen the "equatiomatic" package being advertised for this:
https://github.com/datalorax/equatiomatic/

It doesn't claim to support lmer(), but the author seems to be working toward it:
https://github.com/datalorax/equatiomatic/pull/104

Hope this helps,
Pierre

Le dimanche 4 octobre 2020, 02:43:41 CEST Simon Harmel a ?crit :