Suppose I can observe $Y_{ijt}$, $i = 1,2,..., n$ , $j = 1,2,3$ and $t = $ 3 weeks, 1 months, half a year and one year.

I am interested in whether

  1. $E(Y|j=1,k) = E(Y|j = 2,k)= E(Y|j=3,k)$
  2. $E(Y|j, k) = \alpha_j + \beta_j k $

At first, I thought it was a simple question that I can simply use ANOVA for different periods of time in the first case, and for the second I can run simple linear regression at given $j = 1,2,3$. Yet I realized that for each individual $i$ at given time period $t = k$, $Y_{i1k}$, $Y_{i2k}$ , $Y_{i3k}$ are likely correlated, which render ANOVA ineffective. I am what kind of model should I build to tackle these two questions that I want to tackle?


1 Answer 1


You can account for the covariance between time periods by using multilevel modeling. Marginal models directly model the population mean, so they may be most useful for you in this question of interest.

You could fit a marginal model such as this one (I'm assuming you meant t when typing k) and conduct the appropriate tests on coefficients.

$E(Y) = \beta_1 + \beta_2 I(j = 2) + \beta_3 I(j = 3) + \beta_4 t + \beta_5 I(j = 2) t + \beta_6 I(j = 3)t$

Marginal models can be fit using the nlme package (or gee for non-identity link functions) in R or PROC MIXED (PROC GENMOD for non-identity link functions) in SAS.

  • $\begingroup$ Hi, thx for the suggestion. The covariance not only exists between different time periods but also exists between different levels... for each individuals will have three different $y_{ij}$ corresponding to $j=1,2,3$, I don't think this model will be able to taken into account this unless I was mistaken something? $\endgroup$
    – JoZ
    May 5, 2022 at 2:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.