Hi Stata Forum
I have been playing with random effects modelling with interactions with time, as helped by members of this forum. My data now looks like this
I get a sigificant main effect of time 4, but not any of the interactions (just) - see output at the end of this message. I did a naive analysis of means to try to understand what was going on:
Am I right in thinking that the "main effect" of time 4 should be interpreted as the effects of being in exposure group 4 and time 1?
Many thanks
Rena
I have been playing with random effects modelling with interactions with time, as helped by members of this forum. My data now looks like this
Code:
. list if id<5 +----------------------------------------------+ | id time exposure outcome outcome_bl | |----------------------------------------------| 1. | 1 1 2 34.14907 33.98133 | 2. | 1 2 2 36.89132 33.98133 | 3. | 1 3 2 37.09322 33.98133 | 4. | 2 1 2 24.22013 21.2088 | 5. | 2 2 2 25.23487 21.2088 | |----------------------------------------------| 6. | 3 1 1 31.93662 32.69796 | 7. | 3 2 1 37.16611 32.69796 | 8. | 3 3 1 33.71714 32.69796 | 9. | 4 1 2 25.69123 25.6259 | 10. | 4 2 2 25.60167 25.6259 | |----------------------------------------------| 11. | 4 3 2 22.32802 25.6259 | +----------------------------------------------+
Code:
. gen diff=outcome-outcome_bl . table exposure time, c(mean diff) ------------------------------------------- | time exposure | 1 2 3 ----------+-------------------------------- 1 | -.0730373 .1984727 .0705481 2 | -.4656163 .1813771 .1950545 3 | -.5124291 -1.245556 .6545261 4 | -1.534946 -.0874589 .847056 -------------------------------------------
Many thanks
Rena
Code:
. xtmixed outcome i.exposure##time outcome_bl || id: Performing EM optimization: Performing gradient-based optimization: Iteration 0: log likelihood = -3527.7256 Iteration 1: log likelihood = -3527.7182 Iteration 2: log likelihood = -3527.7182 Computing standard errors: Mixed-effects ML regression Number of obs = 1405 Group variable: id Number of groups = 688 Obs per group: min = 1 avg = 2.0 max = 3 Wald chi2(12) = 2885.85 Log likelihood = -3527.7182 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------- outcome | Coef. Std. Err. z P>|z| [95% Conf. Interval] --------------+---------------------------------------------------------------- exposure | 2 | -.3427129 .3312138 -1.03 0.301 -.99188 .3064542 3 | -.2236166 1.019724 -0.22 0.826 -2.222239 1.775006 4 | -1.291953 .5311281 -2.43 0.015 -2.332945 -.2509614 | time | 2 | .3840982 .3167607 1.21 0.225 -.2367413 1.004938 3 | .1534453 .3200552 0.48 0.632 -.4738513 .7807419 | exposure#time | 2 2 | .2322221 .3692434 0.63 0.529 -.4914817 .9559259 2 3 | .3565169 .3904371 0.91 0.361 -.4087257 1.12176 3 2 | -1.295537 1.049529 -1.23 0.217 -3.352576 .7615025 3 3 | .2487972 1.249102 0.20 0.842 -2.199398 2.696992 4 2 | .5126085 .6681532 0.77 0.443 -.7969478 1.822165 4 3 | 1.400178 .741296 1.89 0.059 -.0527351 2.853092 | outcome_bl | .972069 .0181939 53.43 0.000 .9364095 1.007728 _cons | .5444925 .5156786 1.06 0.291 -.466219 1.555204 ------------------------------------------------------------------------------- ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ id: Identity | sd(_cons) | 2.194716 .1090333 1.99109 2.419168 -----------------------------+------------------------------------------------ sd(Residual) | 2.335483 .0639805 2.21339 2.46431 ------------------------------------------------------------------------------ LR test vs. linear regression: chibar2(01) = 162.80 Prob >= chibar2 = 0.0000
Comment