In a mixed effects regression model, it seems pretty standard that not all data has to be available at the same level. For example, some variables may be available at both country and province levels, while others are only available at the country level.
For example, suppose we have a model where the response variable $Y$ is predicted by $X_1$, $X_2$, and $X_3$. Here, $X_1$ and $X_2$ are available at both country and province levels, but $X_3$ is only available at the country level.
We should be able to write the model like this:
$$ Y_{ijk} = \beta_0 + \beta_1X_{1ijk} + \beta_2X_{2ijk} + \beta_3X_{3k} + u_{0k} + u_{1k}X_{1ijk} + u_{2k}X_{2ijk} + v_{0jk} + \epsilon_{ijk} $$
Where:
- $Y_{ijk}$ represents the response for observation $i$ in province $j$ of country $k$
- $\beta_0$ is the overall intercept
- $\beta_1$, $\beta_2$, and $\beta_3$ are the fixed effects coefficients
- $X_{1ijk}$ and $X_{2ijk}$ are predictors available at both country and province levels
- $X_{3k}$ is a predictor only available at the country level
- $u_{0k}$, $u_{1k}$, and $u_{2k}$ are random effects for the intercept and slopes at the country level
- $v_{0jk}$ is the random effect for the intercept at the province level
- $\epsilon_{ijk}$ is the residual error
If we use the general practice to write random effects based on the normal distribution:
$$ \begin{pmatrix} u_{0k} \\ u_{1k} \\ u_{2k} \end{pmatrix} \sim N\left(\begin{pmatrix} 0 \\ 0 \\ 0 \end{pmatrix}, \begin{pmatrix} \sigma_{u0}^2 & \sigma_{u01} & \sigma_{u02} \\ \sigma_{u01} & \sigma_{u1}^2 & \sigma_{u12} \\ \sigma_{u02} & \sigma_{u12} & \sigma_{u2}^2 \end{pmatrix}\right) $$
$$ v_{0jk} \sim N(0, \sigma_{v0}^2) $$
$$ \epsilon_{ijk} \sim N(0, \sigma_{\epsilon}^2) $$
In the end, it seems this model has no problem with some variables ($X_1$ and $X_2$) are measured at both country and province levels, while others ($X_3$) are only available at the country level. The random effects $u_{0k}$, $u_{1k}$, and $u_{2k}$ capture country-level variations, while $v_{0jk}$ accounts for province-level variations within countries.
I am wondering - can the same logic be extended to Longitudinal Regression Models?
A longitudinal model and a mixed effects model are modelled very similarly. Just as a mixed effects model can allow for some variables to be collected on only higher level vs on both higher/lower levels, does this mean that a longitudinal model can still work if some of the variables are collected monthly and some of the variables are collected weekly? Or does this analogy not apply here?
For example, suppose I have longitudinal data:
- $i$ = index for individual subjects
- $t$ = index for time points (weeks)
- $m$ = index for months
I wrote the model:
$$ Y_{it} = \beta_0 + \beta_1X_{it} + \beta_2Z_{m(t)} + \beta_3t + u_i + v_{m(t)} + \epsilon_{it} $$
Where:
$Y_{it}$ is the outcome variable for subject $i$ at week $t$
$X_{it}$ is a time-varying predictor measured weekly
$Z_{m(t)}$ is a time-varying predictor measured monthly
$t$ is the time variable (in weeks)
$\beta_0, \beta_1, \beta_2, \beta_3$ are fixed effects coefficients
$u_i$ is the random effect for subject $i$
$v_{m(t)}$ is the random effect for month $m$ corresponding to week $t$
$\epsilon_{it}$ is the residual error term
Random effects: $ u_i \sim N(0, \sigma_u^2) $, $ v_{m(t)} \sim N(0, \sigma_v^2) $, $ \epsilon_{it} \sim N(0, \sigma_\epsilon^2) $
In this kind of situation, (first option) I would have usually just aggregated all data at the less frequent time scale (i.e. monthly level in this case). (second option) The only other thing I could do is to leave the data at the weekly scale and paste the same monthly data across all weeks in the same month, e.g. subject 1 (month 1 = 6, week 1= 2.1), subject 1 (month 1 = 6, week 2= 5.3), subject 1 (month 1 = 6, week 3= 6.8), subject 1 (month 1 = 6, week 4= 0.3). However, I am not sure if the second option is appropriate, as it might perhaps violate some statistical assumptions or create excessive multicollinearity.
Is this OK?