[R-sig-ME] Multilevel equation

Brian Hudson bhud@on@g@u @end|ng |rom gm@||@com
Mon Jul 19 17:42:39 CEST 2021


I am fitting a multilevel model in `lme4` and am having trouble writing the
equation for it. I very much appreciate any help. The formula and code is
below, but I am not sure if the equation represents the error correctly -
do I need to include error terms or is that captured by the distributions?
I am also not sure if I am representing the logit function correctly with
the indexing or functional form.

The data are comprised of US-state months nested within US-state-years and
US-states. I include predictors at each level and a varying intercept for
both state-years and states.

The formula looks like this in R:

as.formula(outcome ~ state_mnthyr_pred + state_year_pred + state_pred +
                         (1 | state) + (1 | state_year))
Where the outcome is dichotomous. The state months (e.g. jan-2010, feb-2010
... jan-2013) are nested with state years and within states.

The formula I am using can be seen here:

And the LaTeX code:

    \mu &=\alpha_{j[i],k[i]} +
\beta_{0}(\operatorname{state\_mnthyr\_pred})\ \\
    \alpha_{j}  &\sim N \left(\gamma_{0}^{\alpha} +
\sigma^2_{\alpha_{j}} \right)
    \text{, for \textrm{State-Year} j = 1,} \dots \text{, J} \\
    \alpha_{k}  &\sim N \left(\gamma_{0}^{\alpha} +
\sigma^2_{\alpha_{k}} \right)
    \text{, for State k = 1,} \dots \text{, K}\\
\pi_{i} &=\frac{e_{i}^{\mu}}{1+e_{i}^{\mu}}\\
y_{i j k} \sim & \operatorname{Binom}\left(1, \pi_{i}\right)\\

I really appreciate any help. Thank you.

	[[alternative HTML version deleted]]

More information about the R-sig-mixed-models mailing list