Announcement

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

  • How to set a Residual structure (in the lowest level) in a multilevel multivariate model with repeated measurements?

    Hi Guys! I was wondering how to create a residual structure using the mixed command in a multivariate (I have 3 outcome variables, a time variable, and one time-variant covariate) three-level model. In a univariate model i simply right the description: residuals(ar 1, t(res)). The problem is how to create the variable res in t() when i have already a long format datastructure, in order stata to be able to estimate the multivariate model. In my case, I have three outcome variables with 17 obs per variable. I create the res var, as a counter var going until 17 and then staring over again, but when i try to estimate the model, stata writes "repeated time values within lowest-level panels". Then I created the same counter variable to go until 51 (17X3 outcome variables), and it estimated the model, but I am afraid this is not correct. since there is no time autocorrelation when i jump to the first observation of the second var and so on for the third outcome var. I dont know if i explain it clearly, if anyone knows pls send a replay, Thanks!

  • #2
    The is a dataset from the work of Baldwin, S. A., Imel, Z. E., Braithwaite, S. R., & Atkins, D. C. (2014). Analyzing multiple outcomes in clinical research using multivariate multilevel models. Journal of Consulting and Clinical Psychology, 82(5), 920–930. https://doi.org/10.1037/a0035628
    Click image for larger version

Name:	_2024-02-06_153456508.png
Views:	1
Size:	25.5 KB
ID:	1742272

    Last edited by Thomas ALexopoulos; 06 Feb 2024, 08:30.

    Comment


    • #3
      and they use the following xtmixed syntax specification to obtain a covariance matrix for the lowest-level residuals

      xtmixed y var1 var2 timev1 timev2 txv1 txv2 timetxv1 timetxv2, nocons || pid: var1 timev1 var2 timev2, nocons cov(un) || time: , nocons var residuals(un, t(var))




      I have three levels : country -> firms -> repeated measurements, and my dataset looks like this:

      Click image for larger version

Name:	image_33691.png
Views:	1
Size:	80.1 KB
ID:	1742285



      if I try to use dall, which is my all-in-one dummy variable, for my three different outcomes, just like the previous dataset, I get the error message of repeated time values...

      I suspect it has to do with the fact that i have three levels and Stata is confused by this.

      Last edited by Thomas ALexopoulos; 06 Feb 2024, 08:40.

      Comment


      • #4
        i use this syntax:
        xtmixed ytot2 d1 d2 d3 d1time d2time d3time d1time_sq d2time_sq d3time_sq d1all d2all d3all d1timeall d2timeall d3timeall ,nocons || country: d1 d2 d3 d1time d2time d3time , nocons covariance(unstructured)|| firm: d1 d2 d3 d1time d2time d3time, nocons covariance(identity) reml residuals(ar 1, t(dall)) toleranc(1e-5) difficult technique(nr) nonrtolerance
        I can't figure out how dall should look like in order to get a covariance residuals matrix for my lowest level, that is, time

        Comment

        Working...
        X