Hi, I am a PhD student working on a growth curve model of cohort differences in Y over part of the life course. I have a panel data set where everyone has minimum 3 waves of data. As there is almost no relationship between Y and age in the earlier ages and a strong relationship towards the end I am using cubic splines. This fit the model better than polynomials.
Now to my question: I'm wondering whether I have to include all splines in the random effects part of the model or if I can use only the first (which is the same as age)?
If I add in the other splines, the standard errors are missing when I specify unstructured covariance. The confidence interval of the standard errors is missing if I leave it independent. The splines have very small values in the output so I don't know that they need to be left in. I don't get any error messages or convergence issues. I get the same issue as below when removing the cohort variable from the model.
Any guidance would be greatly appreciated!
Age is centered at 65.
Now to my question: I'm wondering whether I have to include all splines in the random effects part of the model or if I can use only the first (which is the same as age)?
If I add in the other splines, the standard errors are missing when I specify unstructured covariance. The confidence interval of the standard errors is missing if I leave it independent. The splines have very small values in the output so I don't know that they need to be left in. I don't get any error messages or convergence issues. I get the same issue as below when removing the cohort variable from the model.
Any guidance would be greatly appreciated!
Age is centered at 65.
Code:
mkspline2 splines=age65, nknots(4) cubic displayknots | knot1 knot2 knot3 knot4 -------------+-------------------------------------------- age65 | -22 -7 6 19 mixed Y i.cohort##c.(splines*) || id:splines1, cov(unstr) Performing EM optimization ... Performing gradient-based optimization: Iteration 0: log likelihood = -5178.2427 Iteration 1: log likelihood = -5175.358 Iteration 2: log likelihood = -5175.3567 Iteration 3: log likelihood = -5175.3567 Computing standard errors ... Mixed-effects ML regression Number of obs = 4,325 Group variable: id Number of groups = 1,026 Obs per group: min = 3 avg = 4.2 max = 6 Wald chi2(11) = 481.52 Log likelihood = -5175.3567 Prob > chi2 = 0.0000 ----------------------------------------------------------------------------------- Y | Coefficient Std. err. z P>|z| [95% conf. interval] ------------------+---------------------------------------------------------------- cohort | 1925-1934 | .5331846 .1898017 2.81 0.005 .1611801 .9051892 1935-1944 | .5475112 .1825329 3.00 0.003 .1897534 .9052691 | splines1 | -.0146993 .0094491 -1.56 0.120 -.0332192 .0038206 splines2 | .0690453 .0248748 2.78 0.006 .0202916 .1177991 splines3 | -.3160313 .0798572 -3.96 0.000 -.4725485 -.159514 | cohort#c.splines1 | 1925-1934 | .0243428 .0114487 2.13 0.033 .0019037 .0467819 1935-1944 | .0207229 .0110225 1.88 0.060 -.0008809 .0423267 | cohort#c.splines2 | 1925-1934 | -.0778835 .0309589 -2.52 0.012 -.1385618 -.0172051 1935-1944 | -.0487531 .029607 -1.65 0.100 -.1067818 .0092755 | cohort#c.splines3 | 1925-1934 | .2488677 .1009464 2.47 0.014 .0510164 .4467189 1935-1944 | .0457853 .0972702 0.47 0.638 -.1448609 .2364314 | _cons | -.2376548 .1529604 -1.55 0.120 -.5374517 .0621421 ----------------------------------------------------------------------------------- ------------------------------------------------------------------------------ Random-effects parameters | Estimate Std. err. [95% conf. interval] -----------------------------+------------------------------------------------ id: Unstructured | var(splines1) | .0002124 .0000443 .0001411 .0003197 var(_cons) | .2236183 .0155616 .1951067 .2562965 cov(splines1,_cons) | .0035948 .0005764 .002465 .0047246 -----------------------------+------------------------------------------------ var(Residual) | .473713 .013623 .447751 .5011804 ------------------------------------------------------------------------------ LR test vs. linear model: chi2(3) = 526.98 Prob > chi2 = 0.0000 Note: LR test is conservative and provided only for reference.
Code:
mixed Y i.cohort##c.(splines*) || id:splines*, cov(unstr) Performing EM optimization ... Performing gradient-based optimization: Iteration 0: log likelihood = -5174.6216 (not concave) Iteration 1: log likelihood = -5169.0887 (not concave) Iteration 2: log likelihood = -5163.8616 (not concave) Iteration 3: log likelihood = -5162.8857 (not concave) Iteration 4: log likelihood = -5162.4266 (not concave) Iteration 5: log likelihood = -5161.998 (not concave) Iteration 6: log likelihood = -5161.727 Iteration 7: log likelihood = -5161.4759 Iteration 8: log likelihood = -5160.8972 Iteration 9: log likelihood = -5160.7124 Iteration 10: log likelihood = -5160.7121 Computing standard errors ... Mixed-effects ML regression Number of obs = 4,325 Group variable: id Number of groups = 1,026 Obs per group: min = 3 avg = 4.2 max = 6 Wald chi2(11) = 395.75 Log likelihood = -5160.7121 Prob > chi2 = 0.0000 ----------------------------------------------------------------------------------- Y | Coefficient Std. err. z P>|z| [95% conf. interval] ------------------+---------------------------------------------------------------- cohort | 1925-1934 | .5383008 .1859211 2.90 0.004 .1739021 .9026994 1935-1944 | .5485608 .1789823 3.06 0.002 .197762 .8993597 | splines1 | -.0148098 .0091121 -1.63 0.104 -.0326693 .0030496 splines2 | .0689632 .0244999 2.81 0.005 .0209443 .116982 splines3 | -.3154164 .0795977 -3.96 0.000 -.4714251 -.1594078 | cohort#c.splines1 | 1925-1934 | .0246524 .0110039 2.24 0.025 .0030851 .0462198 1935-1944 | .0207464 .0106143 1.95 0.051 -.0000573 .04155 | cohort#c.splines2 | 1925-1934 | -.0782772 .0305633 -2.56 0.010 -.1381801 -.0183742 1935-1944 | -.0493529 .029266 -1.69 0.092 -.1067131 .0080074 | cohort#c.splines3 | 1925-1934 | .2488217 .1009145 2.47 0.014 .051033 .4466104 1935-1944 | .049997 .0973718 0.51 0.608 -.1408482 .2408422 | _cons | -.238303 .1496277 -1.59 0.111 -.5315678 .0549618 ----------------------------------------------------------------------------------- ------------------------------------------------------------------------------ Random-effects parameters | Estimate Std. err. [95% conf. interval] -----------------------------+------------------------------------------------ id: Unstructured | var(splines1) | .000206 . . . var(splines2) | .0054899 . . . var(splines3) | .0730532 . . . var(_cons) | .3655216 . . . cov(splines1,splines2) | -.000953 . . . cov(splines1,splines3) | .0030844 . . . cov(splines1,_cons) | .0075392 . . . cov(splines2,splines3) | -.0189982 . . . cov(splines2,_cons) | -.0251046 . . . cov(splines3,_cons) | .0727699 . . . -----------------------------+------------------------------------------------ var(Residual) | .4422374 . . . ------------------------------------------------------------------------------ LR test vs. linear model: chi2(10) = 556.27 Prob > chi2 = 0.0000 Note: LR test is conservative and provided only for reference. mixed Y i.cohort##c.(splines*) || id:splines* Performing EM optimization ... Performing gradient-based optimization: Iteration 0: log likelihood = -5197.6121 Iteration 1: log likelihood = -5172.1335 (not concave) Iteration 2: log likelihood = -5169.0236 Iteration 3: log likelihood = -5168.2809 Iteration 4: log likelihood = -5168.1086 Iteration 5: log likelihood = -5168.1075 Iteration 6: log likelihood = -5168.0711 Iteration 7: log likelihood = -5168.0711 Computing standard errors ... Mixed-effects ML regression Number of obs = 4,325 Group variable: id Number of groups = 1,026 Obs per group: min = 3 avg = 4.2 max = 6 Wald chi2(11) = 416.41 Log likelihood = -5168.0711 Prob > chi2 = 0.0000 ----------------------------------------------------------------------------------- Y | Coefficient Std. err. z P>|z| [95% conf. interval] ------------------+---------------------------------------------------------------- cohort | 1925-1934 | .5478782 .1871955 2.93 0.003 .1809817 .9147748 1935-1944 | .5553173 .1800921 3.08 0.002 .2023433 .9082913 | splines1 | -.015552 .00931 -1.67 0.095 -.0337993 .0026953 splines2 | .0713006 .0247092 2.89 0.004 .0228716 .1197297 splines3 | -.323562 .0797001 -4.06 0.000 -.4797712 -.1673527 | cohort#c.splines1 | 1925-1934 | .0252969 .0112453 2.25 0.024 .0032565 .0473373 1935-1944 | .0212774 .0108361 1.96 0.050 .000039 .0425158 | cohort#c.splines2 | 1925-1934 | -.0802425 .0307192 -2.61 0.009 -.1404511 -.020034 1935-1944 | -.0497885 .0293897 -1.69 0.090 -.1073912 .0078141 | cohort#c.splines3 | 1925-1934 | .2561349 .1005975 2.55 0.011 .0589675 .4533023 1935-1944 | .0479489 .0970066 0.49 0.621 -.1421806 .2380785 | _cons | -.250412 .1511236 -1.66 0.098 -.5466089 .0457848 ----------------------------------------------------------------------------------- ------------------------------------------------------------------------------ Random-effects parameters | Estimate Std. err. [95% conf. interval] -----------------------------+------------------------------------------------ id: Independent | var(splines1) | 1.08e-16 6.85e-14 0 . var(splines2) | .0002999 .0000431 .0002264 .0003974 var(splines3) | 6.92e-12 3.59e-09 0 . var(_cons) | .1828179 .0147903 .156011 .214231 -----------------------------+------------------------------------------------ var(Residual) | .4642764 .0126269 .4401762 .4896962 ------------------------------------------------------------------------------ LR test vs. linear model: chi2(4) = 541.55 Prob > chi2 = 0.0000 Note: LR test is conservative and provided only for reference. * Example generated by -dataex-. For more info, type help dataex clear input double id float(Y cohort spline4_1 spline4_2 spline4_3) double age 100009 -.3298419 0 -20 .004759072 0 45 100009 1.217866 0 -7 2.0077336 0 58 100009 -.3298419 0 3 9.295062 .594884 68 100009 -.3298419 0 14 26.79431 4.90006 79 100026 1.217866 2 -25 0 0 40 100026 -.3298419 2 -15 .2040452 0 50 100026 -.3298419 2 -6 2.436645 .000594884 59 100026 1.217866 2 4 10.45568 .7917906 69 100026 -.3298419 2 8 16.046858 1.9982153 73 100026 -1.8775498 2 16 30.7663 6.048186 81 100030 -.3298419 1 -14 .3045806 0 51 100030 -.3298419 1 -4 3.4693635 .016061869 61 100030 -1.8775498 1 5 11.709102 1.0279596 70 100030 -.3298419 1 15 28.76493 5.466984 80 100030 -1.8775498 1 19 36.878048 7.841761 84 100057 .4271728 2 -19 .016061869 0 46 100057 1.217866 2 -9 1.30696 0 56 100057 -1.0868567 2 10 19.373083 2.84652 75 100057 -.3298419 2 14 26.79431 4.90006 79 100059 .4608511 0 -15 .2040452 0 50 100059 -.3298419 0 -2 4.759072 .0743605 63 100059 -.3298419 0 8 16.046858 1.9982153 73 100063 -.3298419 1 -17 .0743605 0 48 100063 1.217866 1 -7 2.0077336 0 58 100063 -.3298419 1 2 8.223677 .4336704 67 100063 -1.8775498 1 13 24.862123 4.3509817 78 100063 -1.8775498 1 16 30.7663 6.048186 81 100073 -.3298419 2 -23 0 0 42 100073 -.3298419 2 6 13.058893 1.30696 71 100073 1.217866 2 10 19.373083 2.84652 75 100073 -.3298419 2 18 34.83055 7.239143 83 100079 -.3298419 2 -24 0 0 41 100079 -.3298419 2 -14 .3045806 0 51 100079 1.217866 2 -5 2.922665 .004759072 60 100079 1.217866 2 5 11.709102 1.0279596 70 100079 -.3298419 2 9 17.671532 2.404521 74 100079 1.217866 2 16 30.7663 6.048186 81 100084 -.3298419 0 -16 .12849495 0 49 100084 1.217866 0 -3 4.0803094 .03807257 62 100084 -.3298419 0 7 14.50675 1.631172 72 100084 .4608511 0 18 34.83055 7.239143 83 100086 -.3298419 0 -12 .594884 0 53 100086 -.3298419 0 1 7.237954 .3045806 66 100086 -.3298419 0 11 21.143826 3.3206425 76 100105 -1.8775498 2 -13 .4336704 0 52 100105 -1.0868567 2 -4 3.4693635 .016061869 61 100105 -1.8775498 2 6 13.058893 1.30696 71 100105 -1.0868567 2 10 19.373083 2.84652 75 100105 -1.0868567 2 18 34.83055 7.239143 83 100113 -.3298419 0 -21 .000594884 0 44 100113 -.3298419 0 -8 1.6323617 0 57 100113 1.217866 0 2 8.223677 .4336704 67 100114 -.3298419 1 -18 .03807257 0 47 100114 -.3298419 1 -8 1.6323617 0 57 100114 .4271728 1 1 7.237954 .3045806 66 100114 1.217866 1 12 22.976067 3.8233194 77 100114 -.3298419 1 15 28.76493 5.466984 80 100116 -.3298419 1 -16 .12849495 0 49 100116 -.3298419 1 -6 2.436645 .000594884 59 100116 -.3298419 1 3 9.295062 .594884 68 100139 .4608511 1 -25 0 0 40 100139 1.217866 1 -2 4.759072 .0743605 63 100139 1.217866 1 7 14.50675 1.631172 72 100139 1.217866 1 17 32.790737 6.640095 82 100139 1.217866 1 21 40.97561 9.048185 86 100142 -.3298419 0 -19 .016061869 0 46 100142 -.3298419 0 -6 2.436645 .000594884 59 100142 -.3298419 0 4 10.45568 .7917906 69 100142 -.3298419 0 15 28.76493 5.466984 80 100145 .4608511 2 -25 0 0 40 100145 -.3298419 2 -15 .2040452 0 50 100145 1.217866 2 -6 2.436645 .000594884 59 100145 .4608511 2 4 10.45568 .7917906 69 100145 .4608511 2 16 30.7663 6.048186 81 100166 -1.8775498 1 -22 0 0 43 100166 1.217866 1 -9 1.30696 0 56 100166 -.3298419 1 1 7.237954 .3045806 66 100177 .4271728 0 -20 .004759072 0 45 100177 1.217866 0 3 9.295062 .594884 68 100177 1.217866 0 14 26.79431 4.90006 79 100178 1.217866 1 -25 0 0 40 100178 1.217866 1 -12 .594884 0 53 100178 1.217866 1 -2 4.759072 .0743605 63 100193 -.3298419 0 -20 .004759072 0 45 100193 -.3298419 0 -7 2.0077336 0 58 100193 .4271728 0 3 9.295062 .594884 68 100193 -1.8775498 0 14 26.79431 4.90006 79 100196 -.3298419 2 -19 .016061869 0 46 100196 1.217866 2 -9 1.30696 0 56 100196 1.217866 2 0 6.334325 .2040452 65 100196 1.217866 2 10 19.373083 2.84652 75 100196 1.217866 2 14 26.79431 4.90006 79 100196 -.3298419 2 21 40.97561 9.048185 86 100206 -1.8775498 2 -11 .7917906 0 54 100206 -1.8775498 2 8 16.046858 1.9982153 73 100206 -1.8775498 2 12 22.976067 3.8233194 77 100214 1.217866 1 -17 .0743605 0 48 100214 1.217866 1 -7 2.0077336 0 58 100214 -.3298419 1 2 8.223677 .4336704 67 100214 .4608511 1 12 22.976067 3.8233194 77 end label values cohort cohort label def cohort 0 "1915-1924", modify label def cohort 1 "1925-1934", modify label def cohort 2 "1935-1944", modify