# Mixed effects logistic regression formula with one random effect

In our thesis, we have used a mixed-effects logistic regression and now we want to present it as a formula, however, we are not sure how to present a mixed-effects logistic regression?

Our binary outcome is if the calf of a specific age group is sick (yes/no) and we have two explanatory variables. The first one is a continuous variable (Cq-values) made to a dichotomous one (true/false under a certain Cq cut-off). The second explanatory variable is a categorical one called age group with four levels = 1, 3, 5, and 7. We also have a random effect that is a combination between herd number (from where a calf is from) and age group (where the calf belongs to) called GroupID.

We have tried to make a formula but it does not seem right when we compare it to others. It is as follows:

logit⁡(p_ij )=intercept+A_ij+slope*x_ij+G_kij where p_ij = is the probability for a calf j in an age group i, being scored as sick given the explanatory variables A_ij is the fixed effect, age group, i = 1, 3, 5, 7 for calf j x_ij is the fixed effect, Cq values being ≤ cutoff, i = true, false for calf j G_kij is the random effect, herd number, k =1…36, in combination with age group, i = 1, 3, 5, 7 for calf j

$$\left \{ \begin{array}{l} \log\frac{\Pr(\texttt{sick}_{ij} = 1)}{1 - \Pr(\texttt{sick}_{ij} = 1)} = (\beta_0 + b_{i0})+ (\beta_1 + b_{i1})\texttt{Age}_{ij}^{(3)} + \\ \quad\quad\quad\quad (\beta_2 + b_{i2})\texttt{Age}_{ij}^{(5)} + (\beta_3 + b_{i3})\texttt{Age}_{ij}^{(7)} + \beta_4\texttt{Cq}_{ij},\\\\ b_i = (b_{i0}, \ldots, b_{i3}) \sim \mathcal N(0, D) \end{array} \right.$$