I am testing the effect of psychological sleep treatment in an RCT using repeated measures. For some outcomes we have daily observations (0-77 days) for others we have weekly (0-10) (example data ot bottom). Due to traditions in the field and comparability of results we would like to model time as weeks.
When I run a mixed command (mixed tst_2 c.week##p1_random_group|| pilot_id: week, robust) I get different results based on whether I use the non-aggregated data or aggregated, collapsed by week.
On non-aggregated data, I get:

On aggregated data I get:

I am trying to understand exactly what stata 'does' when I specify time as weeks - my supervisor said they thought this aggregated the data by weeks, but that can't be the case based on this? I have always been tought to avoid aggregating data if possible (maintain power, not throw out data), so I would like to use the non-collapsed data, but I am not ure howexcalty data is being handled "within" weeks.
Hope someone can offer some insight? Thank you in advance.
Dataexample, non-collapsed data:
When I run a mixed command (mixed tst_2 c.week##p1_random_group|| pilot_id: week, robust) I get different results based on whether I use the non-aggregated data or aggregated, collapsed by week.
On non-aggregated data, I get:
On aggregated data I get:
I am trying to understand exactly what stata 'does' when I specify time as weeks - my supervisor said they thought this aggregated the data by weeks, but that can't be the case based on this? I have always been tought to avoid aggregating data if possible (maintain power, not throw out data), so I would like to use the non-collapsed data, but I am not ure howexcalty data is being handled "within" weeks.
Hope someone can offer some insight? Thank you in advance.
Dataexample, non-collapsed data:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input double mcheck_createddate float(tst_2 days week) . . . . 1978315739066 369.375 -7 0 1978405251349 369.375 -6 0 1978498510312 369.375 -5 0 1978575898339 369.375 -4 0 1978663788416 369.375 -3 0 1978747364817 369.375 -2 0 1978840544624 369.375 -1 0 1978925071258 369.375 0 0 1979024778656 240 1 1 1979095997623 330 2 1 1979179983159 335 3 1 1979267216912 350 4 1 1979352306162 335 5 1 1979439088111 350 6 1 1979526446878 350 7 1 1979615407760 355 8 2 1979700680626 365 9 2 1979784602360 340 10 2 1979871130571 350 11 2 1979957402274 355 12 2 1980043428649 360 13 2 1980130349177 375 14 2 1980216625602 355 15 3 1980302798494 375 16 3 1980389083716 360 17 3 1980475874286 385 18 3 1980562055200 365 19 3 1980648223571 380 20 3 1980735724410 370 21 3 1980822012311 385 22 4 1980908709304 410 23 4 1980994641875 390 24 4 1981080942377 355 25 4 1981166909551 380 26 4 1981253724934 430 27 4 1981342052900 380 28 4 1981425936804 405 29 5 1981515734374 420 30 5 1981602644128 415 31 5 1981685169023 370 32 5 1981773360755 440 33 5 1981859849078 440 34 5 1981944884990 420 35 5 1982033391559 315 36 6 1982123504570 445 37 6 1982203675021 430 38 6 1982344359936 435 39 6 1982376661288 340 40 6 1982462679238 450 41 6 1982551426227 410 42 6 1982636154103 360 43 7 1982728564567 385 44 7 1982813462160 400 45 7 1982897900584 400 46 7 1982983872659 365 47 7 1983070492631 410 48 7 1983155773759 390 49 7 1983242492230 400 50 8 1983330658828 415 51 8 1983416538837 415 52 8 1983502873103 420 53 8 1983587366273 395 54 8 1983674851456 410 55 8 1983765060598 415 56 8 1983850894594 410 57 9 1983933940172 385 58 9 1984020324185 415 59 9 1984106612648 400 60 9 1984193689256 405 61 9 1984279792169 410 62 9 1984365849592 390 63 9 1984455670432 400 64 10 1984543752970 410 65 10 1984629055424 385 66 10 1984714748351 390 67 10 1984798563111 395 68 10 1984894907098 365 69 10 . . . . . . . . 1979015931298 317.7778 -8 0 1979105233995 317.7778 -7 0 1979190440615 317.7778 -6 0 1979272777118 317.7778 -5 0 1979358986840 317.7778 -4 0 1979498188163 317.7778 -3 0 1979562555041 317.7778 -2 0 1979612420459 317.7778 -1 0 1979722662617 317.7778 0 0 1979793676529 375 1 1 1979901718677 360 2 1 1979985089800 385 3 1 1980082500718 505 4 1 1980175377866 385 5 1 1980220858384 430 6 1 1980310326760 490 7 1 1980424426590 490 8 2 1980524009890 500 9 2 1980564061026 390 10 2 1980669349324 385 11 2 end format %tc mcheck_createddate
Comment