I am just learning about multilevel growth models and am still a bit confused about the random part in the model. I am used to Stata's xtreg command and find it a bit tricky to change to mixed. I am using Stata 16
My research topic: I want to compare wealth trajectories in years after divorce (0=first year after divorce, 1 = 2nd year after divorce etc). My treatment group includes first-time divorced men and women. My control groups includes a group of continuously married men and women. This group is assigned an artificial divorce date. Thus the treated group has an actual time since divorce and the control group has an artificial time since divorce.
In the growth curve model I would now like to compare wealth trajectories between the men and women in the control group to men and women in the treatment group. Additionally, I am interested in differences within the groups, so between treated men and treated women. I would expect that the four types of sample respondents (treated men, treated women, control men, control women) have different trajectories. I think it would thus make sense to allow for random intercepts and random slopes for each groups average trajectory. As I have a range of interactions (to define the groups), I am now unsure if I should add each interaction also as a random part or if it is enough to define the interactions only in the level-1 part of the model.
For simplicity I first run gender-specific models (at this point without the addition of control variables):
Code:
. mixed wealth_ind_ihsa c.divduration##i.treat || id: divduration treat if female ==1, var > iance mle Performing EM optimization: Performing gradient-based optimization: Iteration 0: log likelihood = -13577.383 Iteration 1: log likelihood = -13540.188 (not concave) Iteration 2: log likelihood = -13521.659 Iteration 3: log likelihood = -13504.702 Iteration 4: log likelihood = -13504.485 Iteration 5: log likelihood = -13504.484 Computing standard errors: Mixed-effects ML regression Number of obs = 4,156 Group variable: id Number of groups = 2,011 Obs per group: min = 1 avg = 2.1 max = 4 Wald chi2(3) = 116.75 Log likelihood = -13504.484 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------------- wealth_ind_ihsa | Coef. Std. Err. z P>|z| [95% Conf. Interval] --------------------+---------------------------------------------------------------- divduration | .0752317 .0175084 4.30 0.000 .0409159 .1095475 | treat | 1. yes | -3.050076 .3936666 -7.75 0.000 -3.821649 -2.278504 | treat#c.divduration | 1. yes | .0273809 .036976 0.74 0.459 -.0450908 .0998527 | _cons | 7.816075 .1991426 39.25 0.000 7.425762 8.206387 ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ id: Independent | var(divdu~on) | 1.83e-14 1.84e-14 2.54e-15 1.31e-13 var(treat) | 14.18267 3.054096 9.299513 21.62996 var(_cons) | 19.10214 1.336654 16.65405 21.91008 -----------------------------+------------------------------------------------ var(Residual) | 23.55464 .7344161 22.15831 25.03896 ------------------------------------------------------------------------------ LR test vs. linear model: chi2(3) = 611.09 Prob > chi2 = 0.0000 Note: LR test is conservative and provided only for reference. . mixed wealth_ind_ihsa c.divduration##i.treat || id: divduration treat if female ==0, var > iance mle Performing EM optimization: Performing gradient-based optimization: Iteration 0: log likelihood = -10978.336 Iteration 1: log likelihood = -10946.347 Iteration 2: log likelihood = -10923.592 Iteration 3: log likelihood = -10923.509 Iteration 4: log likelihood = -10923.509 Computing standard errors: Mixed-effects ML regression Number of obs = 3,374 Group variable: id Number of groups = 1,578 Obs per group: min = 1 avg = 2.1 max = 4 Wald chi2(3) = 95.10 Log likelihood = -10923.509 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------------- wealth_ind_ihsa | Coef. Std. Err. z P>|z| [95% Conf. Interval] --------------------+---------------------------------------------------------------- divduration | .0985778 .0190893 5.16 0.000 .0611634 .1359921 | treat | 1. yes | -2.580338 .4644723 -5.56 0.000 -3.490687 -1.669989 | treat#c.divduration | 1. yes | -.078105 .0392166 -1.99 0.046 -.1549681 -.001242 | _cons | 8.526016 .220508 38.67 0.000 8.093828 8.958204 ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ id: Independent | var(divdu~on) | 2.71e-17 3.31e-17 2.49e-18 2.96e-16 var(treat) | 24.9481 3.96691 18.268 34.07094 var(_cons) | 18.98301 1.459009 16.32837 22.06924 -----------------------------+------------------------------------------------ var(Residual) | 22.06696 .7535283 20.63841 23.5944 ------------------------------------------------------------------------------ LR test vs. linear model: chi2(3) = 703.34 Prob > chi2 = 0.0000 Note: LR test is conservative and provided only for reference.
Code:
. gen divdurtreat = divduration*treat . mixed wealth_ind_ihsa c.divduration i.treat c.divdurtreat || id: divduration treat divdurtreat if female ==1, variance mle Performing EM optimization: Performing gradient-based optimization: Iteration 0: log likelihood = -13644.7 Iteration 1: log likelihood = -13634.069 (not concave) Iteration 2: log likelihood = -13538.835 Iteration 3: log likelihood = -13502.249 Iteration 4: log likelihood = -13500.88 Iteration 5: log likelihood = -13500.872 Iteration 6: log likelihood = -13500.872 Computing standard errors: Mixed-effects ML regression Number of obs = 4,156 Group variable: id Number of groups = 2,011 Obs per group: min = 1 avg = 2.1 max = 4 Wald chi2(3) = 118.16 Log likelihood = -13500.872 Prob > chi2 = 0.0000 --------------------------------------------------------------------------------- wealth_ind_ihsa | Coef. Std. Err. z P>|z| [95% Conf. Interval] ----------------+---------------------------------------------------------------- divduration | .0746747 .01738 4.30 0.000 .0406106 .1087389 | treat | 1. yes | -3.080063 .3923129 -7.85 0.000 -3.848982 -2.311144 divdurtreat | .0366243 .0399644 0.92 0.359 -.0417044 .114953 _cons | 7.816756 .1984965 39.38 0.000 7.42771 8.205802 --------------------------------------------------------------------------------- ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ id: Independent | var(divdur~n) | 2.21e-18 2.37e-15 0 . var(treat) | 13.06161 3.11551 8.18398 20.84629 var(divdur~t) | .0438225 .0199468 .0179578 .1069403 var(_cons) | 19.43964 1.345206 16.97406 22.26335 -----------------------------+------------------------------------------------ var(Residual) | 23.02648 .7503928 21.60173 24.54521 ------------------------------------------------------------------------------ LR test vs. linear model: chi2(4) = 618.32 Prob > chi2 = 0.0000 Note: LR test is conservative and provided only for reference. . mixed wealth_ind_ihsa c.divduration i.treat c.divdurtreat || id: divduration treat divdurtreat if female ==0, variance mle Performing EM optimization: Performing gradient-based optimization: Iteration 0: log likelihood = -11012.846 Iteration 1: log likelihood = -10925.717 (not concave) Iteration 2: log likelihood = -10920.256 Iteration 3: log likelihood = -10917.022 Iteration 4: log likelihood = -10917.008 Iteration 5: log likelihood = -10917.008 Computing standard errors: Mixed-effects ML regression Number of obs = 3,374 Group variable: id Number of groups = 1,578 Obs per group: min = 1 avg = 2.1 max = 4 Wald chi2(3) = 95.03 Log likelihood = -10917.008 Prob > chi2 = 0.0000 --------------------------------------------------------------------------------- wealth_ind_ihsa | Coef. Std. Err. z P>|z| [95% Conf. Interval] ----------------+---------------------------------------------------------------- divduration | .0972924 .0188135 5.17 0.000 .0604187 .1341662 | treat | 1. yes | -2.556076 .4609884 -5.54 0.000 -3.459596 -1.652555 divdurtreat | -.0880446 .0443864 -1.98 0.047 -.1750404 -.0010488 _cons | 8.530427 .2191675 38.92 0.000 8.100867 8.959987 --------------------------------------------------------------------------------- ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ id: Independent | var(divdur~n) | 9.30e-25 1.04e-24 1.04e-25 8.33e-24 var(treat) | 22.8626 4.072005 16.12576 32.4139 var(divdur~t) | .0824965 .030153 .040301 .1688711 var(_cons) | 19.62524 1.474194 16.93851 22.73814 -----------------------------+------------------------------------------------ var(Residual) | 21.09708 .7737775 19.63373 22.6695 ------------------------------------------------------------------------------ LR test vs. linear model: chi2(4) = 716.34 Prob > chi2 = 0.0000 Note: LR test is conservative and provided only for reference.
To compare between men and women in one models, I will have to add another interaction, which should look like this:
Code:
. mixed wealth_ind_ihsa c.divduration##i.treat##i.female || id: divduration treat, variance mle Performing EM optimization: Performing gradient-based optimization: Iteration 0: log likelihood = -24557.921 Iteration 1: log likelihood = -24487.306 Iteration 2: log likelihood = -24463.858 Iteration 3: log likelihood = -24432.148 Iteration 4: log likelihood = -24431.428 Iteration 5: log likelihood = -24431.428 Computing standard errors: Mixed-effects ML regression Number of obs = 7,530 Group variable: id Number of groups = 3,589 Obs per group: min = 1 avg = 2.1 max = 4 Wald chi2(7) = 229.81 Log likelihood = -24431.428 Prob > chi2 = 0.0000 -------------------------------------------------------------------------------------------- wealth_ind_ihsa | Coef. Std. Err. z P>|z| [95% Conf. Interval] ---------------------------+---------------------------------------------------------------- divduration | .0990835 .0193693 5.12 0.000 .0611204 .1370467 | treat | 1. yes | -2.589135 .4540284 -5.70 0.000 -3.479014 -1.699256 | treat#c.divduration | 1. yes | -.0755784 .0394343 -1.92 0.055 -.1528681 .0017114 | female | 1. yes | -.7077551 .2977783 -2.38 0.017 -1.29139 -.1241204 | female#c.divduration | 1. yes | -.0242395 .0259686 -0.93 0.351 -.075137 .026658 | treat#female | 1. yes#1. yes | -.4562929 .6060581 -0.75 0.452 -1.644145 .7315592 | treat#female#c.divduration | 1. yes#1. yes | .101074 .0540222 1.87 0.061 -.0048076 .2069555 | _cons | 8.524302 .2230329 38.22 0.000 8.087165 8.961438 -------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ id: Independent | var(divdur~n) | 4.20e-15 2.93e-15 1.07e-15 1.65e-14 var(treat) | 19.06961 2.437581 14.84351 24.49893 var(_cons) | 19.06747 .985757 17.23008 21.1008 -----------------------------+------------------------------------------------ var(Residual) | 22.86307 .5261591 21.85473 23.91794 ------------------------------------------------------------------------------ LR test vs. linear model: chi2(3) = 1308.89 Prob > chi2 = 0.0000 Note: LR test is conservative and provided only for reference. . margins, at(divduration=(0(1)25) treat ==(0 1) female ==(0 1)) atmeans
If I now also add all gender interactions into the random part, the random part can no longer be properly estimated:
Code:
. gen treatwomen = treat*female . gen divdurwomen = divduration*female . gen divdurtreat = divduration*treat . gen divdurtreatwomen = divdurtreat*female . mixed wealth_ind_ihsa i.treat i.treatwomen c.divduration c.divdurwomen c.divdurtreat c.di > vdurtreatwomen || id: treat treatwomen divduration divdurwomen divdurtreat divdurtreatwom > en, variance mle Performing EM optimization: Performing gradient-based optimization: Iteration 0: log likelihood = -25048.998 (not concave) Iteration 1: log likelihood = -24621.51 Iteration 2: log likelihood = -24430.961 (not concave) Iteration 3: log likelihood = -24430.921 (backed up) Iteration 4: log likelihood = -24425.776 Iteration 5: log likelihood = -24424.608 Iteration 6: log likelihood = -24424.577 Iteration 7: log likelihood = -24424.577 Computing standard errors: Mixed-effects ML regression Number of obs = 7,530 Group variable: id Number of groups = 3,589 Obs per group: min = 1 avg = 2.1 max = 4 Wald chi2(6) = 225.87 Log likelihood = -24424.577 Prob > chi2 = 0.0000 ---------------------------------------------------------------------------------- wealth_ind_ihsa | Coef. Std. Err. z P>|z| [95% Conf. Interval] -----------------+---------------------------------------------------------------- treat | 1. yes | -2.168293 .4199046 -5.16 0.000 -2.99129 -1.345295 1.treatwomen | -1.223729 .5250301 -2.33 0.020 -2.252769 -.1946884 divduration | .1204012 .0167822 7.17 0.000 .0875086 .1532938 divdurwomen | -.0637083 .0196832 -3.24 0.001 -.1022866 -.0251299 divdurtreat | -.1063216 .0424442 -2.50 0.012 -.1895107 -.0231326 divdurtreatwomen | .1603849 .0572352 2.80 0.005 .048206 .2725637 _cons | 8.129163 .1472028 55.22 0.000 7.84065 8.417675 ---------------------------------------------------------------------------------- ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ id: Independent | var(treat) | 17.49735 . . . var(treatw~n) | 2.15e-10 . . . var(divdu~on) | 6.16e-19 . . . var(d~rwomen) | 7.94e-21 . . . var(divdur~t) | .059631 . . . var(d~twomen) | 4.09e-16 . . . var(_cons) | 19.55695 . . . -----------------------------+------------------------------------------------ var(Residual) | 22.16909 . . . ------------------------------------------------------------------------------ LR test vs. linear model: chi2(7) = 1327.03 Prob > chi2 = 0.0000 Note: LR test is conservative and provided only for reference.
Thank,
Nicole
0 Response to Growth model (random slope & intercept) with group interaction - model specification
Post a Comment