[R-sig-ME] Multilevel equation

Thierry Onkelinx th|erry@onke||nx @end|ng |rom |nbo@be
Mon Jul 19 19:34:03 CEST 2021


Dear Brian,

I'd write it as follows. In the case of a Gaussian model, you only have to
write $Y_{ijk} \sim \mathcal{N}(\eta_{ijk}, \sigma^2)$ and drop the link
function. (And you could replace \eta with \mu). Basically, Y depends on a
distribution defined by some parameters. And these parameters might need
some further definition.

$i$: state index
$j$: year index
$k$: observation index
$X_m$: state_mnthyr_pred
$X_y$: state_year_pred
$X_s$: state_pred
$$Y_{ijk} \sim Binom(\pi_{ijk})$$
$$\eta_{ijk} = \frac{\pi_{ijk}}{1- \pi_{ijk}}$$
$$\eta_{ijk} = \beta_0 + \beta_1X_m + \beta_2 X_y + \beta_3 X_s + b_i +
b_{ij}$$
$$b_i\sim \mathcal{N}(0, \sigma_s^2)$$
$$b_{ij}\sim \mathcal{N}(0, \sigma_{y}^2)$$

Best regards,


ir. Thierry Onkelinx
Statisticus / Statistician

Vlaamse Overheid / Government of Flanders
INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND
FOREST
Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance
thierry.onkelinx using inbo.be
Havenlaan 88 bus 73, 1000 Brussel
www.inbo.be

///////////////////////////////////////////////////////////////////////////////////////////
To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to say
what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey
///////////////////////////////////////////////////////////////////////////////////////////

<https://www.inbo.be>


Op ma 19 jul. 2021 om 17:44 schreef Brian Hudson <bhudson.gsu using gmail.com>:

> Hello,
>
> 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:
>
> https://quicklatex.com/cache3/e9/ql_038eeb4e4e1b0af94d3ef69fe4ff7be9_l3.png
> And the LaTeX code:
>
> $$
> \begin{aligned}
>     \mu &=\alpha_{j[i],k[i]} +
> \beta_{0}(\operatorname{state\_mnthyr\_pred})\ \\
>     \alpha_{j}  &\sim N \left(\gamma_{0}^{\alpha} +
> \gamma_{1}^{\alpha}(\operatorname{\textrm{state\_year\_pred}}),
> \sigma^2_{\alpha_{j}} \right)
>     \text{, for \textrm{State-Year} j = 1,} \dots \text{, J} \\
>     \alpha_{k}  &\sim N \left(\gamma_{0}^{\alpha} +
> \gamma_{1}^{\alpha}(\operatorname{\textrm{state\_pred}}),
> \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)\\
> \end{aligned}
> $$
>
> I really appreciate any help. Thank you.
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>

	[[alternative HTML version deleted]]



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