Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • mixed - repeated measures analysis

    Dear All,
    I have some problems with a mixed – repeated measures analysis.
    I have 42 animals, with repeated measures of sleep, averaged by month, for 6 months.
    As a first step, I would like a mixed model with simple fixed effects such as season, sex, age, BMI. Random effects are enclosure and id.

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input str6 id str12 TAG float(sex_num age2019 sqrage) str2 Enclosure float(BMI season mdate mo_t_NREM)
    "10E"   "57-36-88" 0 29.535934 872.3714 "E1" 39.01508 1 703     252.7
    "10E"   "57-36-88" 0 29.535934 872.3714 "E1" 39.01508 1 704  243.1739
    "10E"   "57-36-88" 0 29.535934 872.3714 "E1" 39.01508 2 705 189.22223
    "10E"   "57-36-88" 0 29.535934 872.3714 "E1" 39.01508 2 706   224.375
    "10E"   "57-36-88" 0 29.535934 872.3714 "E1" 39.01508 3 707 142.47368
    "10E"   "57-36-88" 0 29.535934 872.3714 "E1" 39.01508 3 708  183.5652
    "10F10" "66-36-73" 0  11.46338 131.4091 "E1" 41.77965 1 703  98.54546
    "10F10" "66-36-73" 0  11.46338 131.4091 "E1" 41.77965 1 704   96.1875
    "10F10" "66-36-73" 0  11.46338 131.4091 "E1" 41.77965 2 705  352.5909
    "10F10" "66-36-73" 0  11.46338 131.4091 "E1" 41.77965 2 706  670.8333
    "10F10" "66-36-73" 0  11.46338 131.4091 "E1" 41.77965 3 707  717.9048
    "10F10" "66-36-73" 0  11.46338 131.4091 "E1" 41.77965 3 708  722.7667
    end
    format %tm mdate
    My first attempt:
    Code:
     
        mixed mo_t_NREM season age2019 sex_num BMI, || Enclosure: || id:, vce(robust)

    My questions are:
    • Should the month (mdate) be added in the randon effects?
    • How can I specify that the within-subject covariance structure is autoregressive?
    • What is the best variance specification?
    Many thanks in advance for your feedback.

  • #2
    Should the month (mdate) be added in the randon effects?
    No. It might make sense to include i.mdate or c.mdate to the fixed part of the model if you expect monthly shocks or a linear time trend. But if you put it in the random effects, because mdate effectively identifies individual observations within id, the random effect for mdate at the residual level becomes a second expression for the residual. Consequently the model would be unidentified. You would either get misleading results or, more likely, a non-convergent estimation.

    How can I specify that the within-subject covariance structure is autoregressive?
    Add the -residuals (ar #)- option to the command, replacing # by the order of autoregression you want to model.

    What is the best variance specification?
    Like any question of the "what is the best model specification" genre, there is no generic answer. The "best" variance specification is one which matches that of the real world data generating process, which, of course, we usually do not know. If you view your data as coming from a repeated measures study, then exchangeable variance would be the natural choice.

    On the other hand, many people are fond of using unstructured variance. Its advantage is that it imposes no assumptions on the model and lets the data "speak for themselves." But it has some drawbacks: it is expensive both from the perspective of computation and memory, and often leads to convergence problems. Also, as with any other model, throwing in more parameters runs the risk of overfitting noise in the data.

    Independent variance structure is clean, quick to compute, and easy to understand, but there aren't many real world situations where independent variance is realistic. But if you do have one of those situations, it is the way to go.

    Comment

    Working...
    X