OPTIONS NOCENTER formchar = "|----|+|---+="; TITLE1 'analysis of riesby data - empirical bayes estimates'; DATA one; INFILE 'C:\mixdemo\riesby.dat'; INPUT id hamd intcpt week endog endweek ; PROC FORMAT; VALUE endog 0='NonEndog' 1='Endog'; VALUE week 0='week 0' 1='week 1' 2='week 2' 3='week 3' 4='week 4' 5='week 5'; PROC MIXED METHOD=ML; CLASS id; MODEL hamd = week /SOLUTION; RANDOM INTERCEPT week /SUB=id TYPE=UN G S; ODS LISTING EXCLUDE SOLUTIONR; ODS OUTPUT SOLUTIONR=randest; TITLE2 'random trend model'; /* print out the estimated random effects dataset */ PROC PRINT DATA=randest; /* get a printout of the data in multivariate form */ PROC SORT DATA=one; BY id; DATA t0;SET one; IF week=0; hamd_0 = hamd; DATA t1;SET one; IF week=1; hamd_1 = hamd; DATA t2;SET one; IF week=2; hamd_2 = hamd; DATA t3;SET one; IF week=3; hamd_3 = hamd; DATA t4;SET one; IF week=4; hamd_4 = hamd; DATA t5;SET one; IF week=5; hamd_5 = hamd; DATA comp (KEEP=id hamd_0-hamd_5); MERGE t0 t1 t2 t3 t4 t5; BY id; PROC PRINT DATA=comp; VAR id hamd_0-hamd_5; /* extract the intercepts and slopes for each person */ /* and compute the estimated hamd values across time */ PROC SORT DATA=randest; BY id; DATA randest2 (KEEP=id intdev slopedev int slope hdest_0-hdest_5); ARRAY y(2) intdev slopedev; DO par = 1 TO 2; SET randest; BY id; y(par) = ESTIMATE; IF par = 2 THEN DO; int = 23.5769 + intdev; slope = -2.3771 + slopedev; hdest_0 = int; hdest_1 = int + slope; hdest_2 = int + 2*slope; hdest_3 = int + 3*slope; hdest_4 = int + 4*slope; hdest_5 = int + 5*slope; END; IF LAST.id THEN RETURN; END; PROC PRINT DATA=randest2; VAR id hdest_0-hdest_5; PROC PLOT DATA=randest2; PLOT intdev * slopedev; PLOT int * slope; TITLE2 'plot of individual intercepts versus slopes'; RUN; --------------- OUTPUT --------------- analysis of riesby data - empirical bayes estimates random trend model The Mixed Procedure Model Information Data Set WORK.ONE Dependent Variable hamd Covariance Structure Unstructured Subject Effect id Estimation Method ML Residual Variance Method Profile Fixed Effects SE Method Model-Based Degrees of Freedom Method Containment Class Level Information Class Levels Values id 66 101 103 104 105 106 107 108 113 114 115 117 118 120 121 123 302 303 304 305 308 309 310 311 312 313 315 316 318 319 322 327 328 331 333 334 335 337 338 339 344 345 346 347 348 349 350 351 352 353 354 355 357 360 361 501 502 504 505 507 603 604 606 607 608 609 610 Dimensions Covariance Parameters 4 Columns in X 2 Columns in Z Per Subject 2 Subjects 66 Max Obs Per Subject 6 Observations Used 375 Observations Not Used 21 Total Observations 396 Iteration History Iteration Evaluations -2 Log Like Criterion 0 1 2399.71226762 1 2 2219.30726751 0.00031526 2 1 2219.04369935 0.00000794 3 1 2219.03751634 0.00000001 Convergence criteria met. Estimated G Matrix Row Effect id Col1 Col2 1 Intercept 101 12.6280 -1.4197 2 week 101 -1.4197 2.0779 Covariance Parameter Estimates Cov Parm Subject Estimate UN(1,1) id 12.6280 UN(2,1) id -1.4197 UN(2,2) id 2.0779 Residual 12.2177 Fit Statistics -2 Log Likelihood 2219.0 AIC (smaller is better) 2231.0 AICC (smaller is better) 2231.3 BIC (smaller is better) 2244.2 Null Model Likelihood Ratio Test DF Chi-Square Pr > ChiSq 3 180.67 <.0001 Solution for Fixed Effects Standard Effect Estimate Error DF t Value Pr > |t| Intercept 23.5769 0.5455 65 43.22 <.0001 week -2.3771 0.2086 65 -11.39 <.0001 Type 3 Tests of Fixed Effects Num Den Effect DF DF F Value Pr > F week 1 65 129.84 <.0001 analysis of riesby data - empirical bayes estimates random trend model StdErr Obs Effect id Estimate Pred DF tValue Probt 1 Intercept 101 1.0290 2.0432 243 0.50 0.6150 2 week 101 -2.1035 0.6995 243 -3.01 0.0029 3 Intercept 103 3.6392 2.0432 243 1.78 0.0761 4 week 103 -0.4743 0.6995 243 -0.68 0.4983 5 Intercept 104 2.6386 2.0432 243 1.29 0.1978 6 week 104 -1.4891 0.6995 243 -2.13 0.0343 7 Intercept 105 -3.0167 2.0432 243 -1.48 0.1411 8 week 105 0.2199 0.6995 243 0.31 0.7535 9 Intercept 106 0.3253 2.0868 243 0.16 0.8763 10 week 106 1.0189 0.8492 243 1.20 0.2314 11 Intercept 107 -0.6145 2.0435 243 -0.30 0.7639 12 week 107 -0.4285 0.7495 243 -0.57 0.5680 13 Intercept 108 -2.0124 2.0432 243 -0.98 0.3257 14 week 108 -0.8032 0.6995 243 -1.15 0.2520 15 Intercept 113 -0.7157 2.0868 243 -0.34 0.7319 16 week 113 1.7931 0.8492 243 2.11 0.0358 17 Intercept 114 -3.0895 2.4736 243 -1.25 0.2129 18 week 114 -0.5436 0.7853 243 -0.69 0.4894 19 Intercept 115 -2.5709 2.4736 243 -1.04 0.2997 20 week 115 0.5294 0.7853 243 0.67 0.5008 21 Intercept 117 -3.4887 2.0432 243 -1.71 0.0890 22 week 117 -0.5228 0.6995 243 -0.75 0.4555 23 Intercept 118 1.8412 2.4736 243 0.74 0.4574 24 week 118 -0.4050 0.7853 243 -0.52 0.6065 25 Intercept 120 -2.4074 2.0432 243 -1.18 0.2399 26 week 120 1.1556 0.6995 243 1.65 0.0998 27 Intercept 121 -0.9594 2.0432 243 -0.47 0.6391 28 week 121 0.4426 0.6995 243 0.63 0.5275 29 Intercept 123 -4.5496 2.0432 243 -2.23 0.0269 30 week 123 -0.3652 0.6995 243 -0.52 0.6020 31 Intercept 302 -2.7384 2.0432 243 -1.34 0.1814 32 week 302 -0.09580 0.6995 243 -0.14 0.8912 33 Intercept 303 -1.3750 2.0432 243 -0.67 0.5016 34 week 303 -0.7708 0.6995 243 -1.10 0.2715 35 Intercept 304 1.4712 2.0635 243 0.71 0.4766 36 week 304 1.1594 0.7081 243 1.64 0.1029 37 Intercept 305 -2.5167 2.0432 243 -1.23 0.2192 38 week 305 -1.2769 0.6995 243 -1.83 0.0691 39 Intercept 308 -0.5802 2.0432 243 -0.28 0.7767 40 week 308 -0.04557 0.6995 243 -0.07 0.9481 41 Intercept 309 -0.5681 2.0432 243 -0.28 0.7812 42 week 309 0.5216 0.6995 243 0.75 0.4565 43 Intercept 310 -1.3827 2.0868 243 -0.66 0.5082 44 week 310 -1.7499 0.8492 243 -2.06 0.0404 45 Intercept 311 -2.3887 2.0435 243 -1.17 0.2436 46 week 311 0.9995 0.7495 243 1.33 0.1836 47 Intercept 312 -2.2477 2.2520 243 -1.00 0.3192 48 week 312 0.2710 0.7222 243 0.38 0.7078 49 Intercept 313 -2.8675 2.0432 243 -1.40 0.1618 50 week 313 -0.3560 0.6995 243 -0.51 0.6112 51 Intercept 315 1.2984 2.0868 243 0.62 0.5344 52 week 315 -1.7699 0.8492 243 -2.08 0.0382 53 Intercept 316 4.1598 2.0432 243 2.04 0.0428 54 week 316 1.2011 0.6995 243 1.72 0.0872 55 Intercept 318 -2.5446 2.0432 243 -1.25 0.2142 56 week 318 0.9626 0.6995 243 1.38 0.1700 57 Intercept 319 -2.2785 2.0432 243 -1.12 0.2659 58 week 319 0.07973 0.6995 243 0.11 0.9093 59 Intercept 322 1.7522 2.0868 243 0.84 0.4019 60 week 322 3.2931 0.8492 243 3.88 0.0001 61 Intercept 327 -4.7591 2.0432 243 -2.33 0.0207 62 week 327 1.3831 0.6995 243 1.98 0.0491 63 Intercept 328 0.6626 2.0432 243 0.32 0.7460 64 week 328 2.9603 0.6995 243 4.23 <.0001 65 Intercept 331 -1.5725 2.0432 243 -0.77 0.4423 66 week 331 0.2086 0.6995 243 0.30 0.7658 67 Intercept 333 -0.1565 2.0432 243 -0.08 0.9390 68 week 333 1.1006 0.6995 243 1.57 0.1169 69 Intercept 334 2.7139 2.1296 243 1.27 0.2037 70 week 334 -1.5600 0.7002 243 -2.23 0.0268 71 Intercept 335 -0.9715 2.0432 243 -0.48 0.6349 72 week 335 -0.1246 0.6995 243 -0.18 0.8588 73 Intercept 337 2.2475 2.0432 243 1.10 0.2724 74 week 337 -0.2320 0.6995 243 -0.33 0.7404 75 Intercept 338 -0.4268 2.0432 243 -0.21 0.8347 76 week 338 1.3491 0.6995 243 1.93 0.0549 77 Intercept 339 -0.1573 2.2520 243 -0.07 0.9444 78 week 339 -0.5202 0.7222 243 -0.72 0.4721 79 Intercept 344 -2.9747 2.4736 243 -1.20 0.2303 80 week 344 0.8121 0.7853 243 1.03 0.3021 81 Intercept 345 3.8532 2.0432 243 1.89 0.0605 82 week 345 1.0841 0.6995 243 1.55 0.1225 83 Intercept 346 0.8277 2.0432 243 0.41 0.6858 84 week 346 0.9138 0.6995 243 1.31 0.1927 85 Intercept 347 -4.0114 2.0868 243 -1.92 0.0557 86 week 347 -0.4529 0.8492 243 -0.53 0.5943 87 Intercept 348 -0.6368 2.0432 243 -0.31 0.7556 88 week 348 -0.9110 0.6995 243 -1.30 0.1940 89 Intercept 349 -3.7548 2.0432 243 -1.84 0.0673 90 week 349 0.3600 0.6995 243 0.51 0.6072 91 Intercept 350 -1.0885 2.0432 243 -0.53 0.5947 92 week 350 0.1824 0.6995 243 0.26 0.7945 93 Intercept 351 4.5790 2.0432 243 2.24 0.0259 94 week 351 -0.9594 0.6995 243 -1.37 0.1714 95 Intercept 352 -2.3469 2.0432 243 -1.15 0.2518 96 week 352 1.3194 0.6995 243 1.89 0.0605 97 Intercept 353 2.3927 2.0432 243 1.17 0.2427 98 week 353 -0.1062 0.6995 243 -0.15 0.8794 99 Intercept 354 3.9392 2.0868 243 1.89 0.0603 100 week 354 1.2189 0.8492 243 1.44 0.1525 101 Intercept 355 1.0534 2.0432 243 0.52 0.6066 102 week 355 -0.9691 0.6995 243 -1.39 0.1672 103 Intercept 357 2.1024 2.0432 243 1.03 0.3045 104 week 357 0.9784 0.6995 243 1.40 0.1632 105 Intercept 360 1.0136 2.0432 243 0.50 0.6203 106 week 360 3.3756 0.6995 243 4.83 <.0001 107 Intercept 361 -0.2092 2.0432 243 -0.10 0.9185 108 week 361 -0.4665 0.6995 243 -0.67 0.5055 109 Intercept 501 4.3614 2.0432 243 2.13 0.0338 110 week 501 0.8561 0.6995 243 1.22 0.2221 111 Intercept 502 -0.9234 2.0432 243 -0.45 0.6517 112 week 502 -1.8642 0.6995 243 -2.67 0.0082 113 Intercept 504 -3.2103 2.0432 243 -1.57 0.1174 114 week 504 0.4976 0.6995 243 0.71 0.4775 115 Intercept 505 -3.9286 2.0432 243 -1.92 0.0557 116 week 505 -1.5346 0.6995 243 -2.19 0.0292 117 Intercept 507 3.3691 2.0432 243 1.65 0.1005 118 week 507 1.1103 0.6995 243 1.59 0.1137 119 Intercept 603 1.7029 2.0432 243 0.83 0.4054 120 week 603 -0.3695 0.6995 243 -0.53 0.5978 121 Intercept 604 1.7494 2.0868 243 0.84 0.4027 122 week 604 -2.3978 0.8492 243 -2.82 0.0051 123 Intercept 606 1.0290 2.0432 243 0.50 0.6150 124 week 606 -2.1035 0.6995 243 -3.01 0.0029 125 Intercept 607 9.7826 2.0432 243 4.79 <.0001 126 week 607 -1.5750 0.6995 243 -2.25 0.0252 127 Intercept 608 -0.7176 2.0432 243 -0.35 0.7257 128 week 608 -1.5747 0.6995 243 -2.25 0.0253 129 Intercept 609 3.2153 2.4736 243 1.30 0.1949 130 week 609 -1.5064 0.7853 243 -1.92 0.0562 131 Intercept 610 8.0090 2.2524 243 3.56 0.0005 132 week 610 -0.9300 0.7663 243 -1.21 0.2260 analysis of riesby data - empirical bayes estimates random trend model Obs id hamd_0 hamd_1 hamd_2 hamd_3 hamd_4 hamd_5 1 101 26 22 18 7 4 3 2 103 33 24 15 24 15 13 3 104 29 22 18 13 19 0 4 105 22 12 16 16 13 9 5 106 21 25 23 18 20 . 6 107 21 21 16 19 . 6 7 108 21 22 11 9 9 7 8 113 21 23 19 23 23 . 9 114 . 17 11 13 7 7 10 115 . 16 16 16 16 11 11 117 19 16 13 12 7 6 12 118 . 26 18 18 14 11 13 120 20 19 17 18 16 17 14 121 20 22 19 19 12 14 15 123 15 15 15 13 5 5 16 302 18 22 16 8 9 12 17 303 21 21 13 14 10 5 18 304 21 27 29 . 12 24 19 305 19 17 15 11 5 1 20 308 22 21 18 17 12 11 21 309 22 22 16 19 20 11 22 310 24 19 11 7 6 . 23 311 20 16 21 17 . 15 24 312 17 . 18 17 17 6 25 313 21 19 10 11 11 8 26 315 27 21 17 13 5 . 27 316 32 26 23 26 23 24 28 318 17 18 19 21 17 11 29 319 24 18 10 14 13 12 30 322 28 21 25 32 34 . 31 327 17 18 15 8 19 17 32 328 22 24 28 26 28 29 33 331 19 21 18 16 14 10 34 333 23 20 21 20 24 14 35 334 31 25 . 7 8 11 36 335 21 21 18 15 12 10 37 337 27 22 23 21 12 13 38 338 22 20 22 23 19 18 39 339 27 . 14 12 11 12 40 344 . 21 12 13 13 18 41 345 29 27 27 22 22 23 42 346 25 24 19 23 14 21 43 347 18 15 14 10 8 . 44 348 24 21 12 13 12 5 45 349 17 19 15 12 9 13 46 350 22 25 12 16 10 16 47 351 30 27 23 20 12 11 48 352 21 19 18 15 18 19 49 353 27 21 24 22 16 11 50 354 28 27 27 26 23 . 51 355 22 26 20 13 10 7 52 357 27 22 24 25 19 19 53 360 21 28 27 29 28 33 54 361 30 22 11 8 7 19 55 501 29 30 26 22 19 24 56 502 21 22 13 11 2 1 57 504 19 17 15 16 12 12 58 505 21 11 18 0 0 4 59 507 27 26 26 25 24 19 60 603 28 22 18 20 11 13 61 604 27 27 13 5 7 . 62 606 19 33 12 12 3 1 63 607 30 39 30 27 20 4 64 608 24 19 14 12 3 4 65 609 . 25 22 14 15 2 66 610 34 . 33 23 . 11 analysis of riesby data - empirical bayes estimates random trend model Obs id hdest_0 hdest_1 hdest_2 hdest_3 hdest_4 hdest_5 1 101 24.6059 20.1253 15.6448 11.1642 6.6837 2.2031 2 103 27.2161 24.3646 21.5132 18.6618 15.8104 12.9590 3 104 26.2155 22.3493 18.4831 14.6169 10.7508 6.8846 4 105 20.5602 18.4030 16.2458 14.0886 11.9314 9.7742 5 106 23.9022 22.5440 21.1858 19.8276 18.4694 17.1113 6 107 22.9624 20.1568 17.3512 14.5456 11.7399 8.9343 7 108 21.5645 18.3843 15.2040 12.0238 8.8435 5.6632 8 113 22.8612 22.2772 21.6931 21.1091 20.5251 19.9410 9 114 20.4874 17.5667 14.6460 11.7253 8.8046 5.8838 10 115 21.0060 19.1583 17.3106 15.4629 13.6152 11.7675 11 117 20.0882 17.1882 14.2883 11.3883 8.4884 5.5884 12 118 25.4181 22.6361 19.8540 17.0719 14.2899 11.5078 13 120 21.1695 19.9480 18.7265 17.5051 16.2836 15.0621 14 121 22.6175 20.6830 18.7485 16.8140 14.8795 12.9450 15 123 19.0273 16.2849 13.5426 10.8003 8.0580 5.3156 16 302 20.8385 18.3656 15.8927 13.4198 10.9469 8.4740 17 303 22.2019 19.0539 15.9060 12.7581 9.6101 6.4622 18 304 25.0481 23.8303 22.6126 21.3948 20.1771 18.9594 19 305 21.0602 17.4062 13.7522 10.0982 6.4441 2.7901 20 308 22.9967 20.5740 18.1513 15.7287 13.3060 10.8833 21 309 23.0088 21.1534 19.2979 17.4424 15.5870 13.7315 22 310 22.1942 18.0672 13.9403 9.8133 5.6864 1.5594 23 311 21.1882 19.8106 18.4330 17.0553 15.6777 14.3001 24 312 21.3292 19.2231 17.1170 15.0110 12.9049 10.7988 25 313 20.7094 17.9763 15.2431 12.5100 9.7768 7.0437 26 315 24.8753 20.7283 16.5812 12.4342 8.2871 4.1401 27 316 27.7367 26.5606 25.3846 24.2086 23.0326 21.8566 28 318 21.0323 19.6178 18.2034 16.7889 15.3744 13.9599 29 319 21.2984 19.0011 16.7037 14.4063 12.1090 9.8116 30 322 25.3291 26.2451 27.1611 28.0770 28.9930 29.9090 31 327 18.8178 17.8238 16.8298 15.8358 14.8418 13.8477 32 328 24.2395 24.8227 25.4059 25.9891 26.5723 27.1555 33 331 22.0044 19.8358 17.6673 15.4987 13.3302 11.1616 34 333 23.4204 22.1439 20.8674 19.5910 18.3145 17.0380 35 334 26.2908 22.3537 18.4167 14.4796 10.5425 6.6055 36 335 22.6054 20.1037 17.6020 15.1003 12.5985 10.0968 37 337 25.8244 23.2153 20.6062 17.9971 15.3880 12.7789 38 338 23.1501 22.1221 21.0941 20.0661 19.0381 18.0100 39 339 23.4196 20.5224 17.6251 14.7279 11.8306 8.9334 40 344 20.6022 19.0372 17.4721 15.9071 14.3420 12.7770 41 345 27.4301 26.1370 24.8440 23.5510 22.2579 20.9649 42 346 24.4046 22.9413 21.4779 20.0146 18.5512 17.0879 43 347 19.5655 16.7355 13.9055 11.0755 8.2455 5.4155 44 348 22.9401 19.6520 16.3639 13.0758 9.7877 6.4996 45 349 19.8221 17.8050 15.7879 13.7709 11.7538 9.7368 46 350 22.4884 20.2937 18.0989 15.9042 13.7095 11.5147 47 351 28.1559 24.8194 21.4828 18.1463 14.8098 11.4733 48 352 21.2300 20.1723 19.1145 18.0568 16.9991 15.9414 49 353 25.9696 23.4863 21.0030 18.5196 16.0363 13.5529 50 354 27.5161 26.3579 25.1997 24.0415 22.8833 21.7251 51 355 24.6303 21.2841 17.9379 14.5918 11.2456 7.8995 52 357 25.6793 24.2806 22.8819 21.4832 20.0845 18.6858 53 360 24.5905 25.5890 26.5874 27.5859 28.5844 29.5828 54 361 23.3677 20.5241 17.6805 14.8370 11.9934 9.1498 55 501 27.9383 26.4173 24.8964 23.3754 21.8545 20.3335 56 502 22.6535 18.4122 14.1709 9.9296 5.6883 1.4470 57 504 20.3666 18.4871 16.6076 14.7281 12.8486 10.9691 58 505 19.6483 15.7367 11.8250 7.9134 4.0017 0.0901 59 507 26.9460 25.6792 24.4123 23.1455 21.8787 20.6118 60 603 25.2798 22.5332 19.7865 17.0399 14.2932 11.5466 61 604 25.3263 20.5514 15.7766 11.0017 6.2269 1.4520 62 606 24.6059 20.1253 15.6448 11.1642 6.6837 2.2031 63 607 33.3595 29.4074 25.4552 21.5031 17.5509 13.5988 64 608 22.8593 18.9075 14.9557 11.0039 7.0521 3.1003 65 609 26.7922 22.9087 19.0252 15.1417 11.2581 7.3746 66 610 31.5859 28.2787 24.9716 21.6644 18.3573 15.0501 intdev | Plot of intdev*slopedev. Legend: A = 1 obs, B = 2 obs, etc. | 10 + | A | | | 8 + A | | | | 6 + | | | | A A 4 + AAA | A | A A | AA | A A 2 + A A | A A A A | B A A A | A A | A 0 + A A | A A A A | A A A A A A A | A A A | A -2 + A | A A A A B A A | A A A | A A A | A A -4 + A A | A | A | | -6 + | --+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-- -3 -2 -1 0 1 2 3 4 slopedev int | Plot of int*slope. Legend: A = 1 obs, B = 2 obs, etc. | 34 + | | A | | 32 + | A | | | 30 + | | | | 28 + A A | A B | A | A A | AA 26 + A A | A A | A A A A | B A A | A A A 24 + A | A A | A A A | A A A A A A A A | A A 22 + A A | A | A A A A B A A | A A A | A A A 20 + A A | A A | A | A | 18 + | ---+------------+------------+------------+------------+------------+------------+-- -5 -4 -3 -2 -1 0 1 slope