Skip to content
Prev 18756 / 20628 Next

Converting lme4 model syntax into corresponding regression equation

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)