I haven't done anova in Stata since the advent of great 'xt/mixed'. But for particular reason, I will have to now and it appears Stata's daunting anova' literature requires me to invest a good amount of time to understand defining error terms properly which I am lacking at the moment. Therefore looking for a quick advice. The study has each person (id) measured 4 times (visit), two treatment (trt) and a baseline variable (v1). when i run only with the treatmentXtime interaction the model runs fine:
Code:
anova y trt / id|trt visit visit#trt, repeated(visit) Number of obs = 1,155 R-squared = 0.7359 Root MSE = 4.54209 Adj R-squared = 0.6411 Source | Partial SS df MS F Prob>F -----------+---------------------------------------------------- Model | 48813.929 305 160.04567 7.76 0.0000 | trt | 11.46467 1 11.46467 0.12 0.7340 id|trt | 29525.081 298 99.077452 -----------+---------------------------------------------------- visit | 18395.491 3 6131.8302 297.22 0.0000 visit#trt | 40.231611 3 13.410537 0.65 0.5831 | Residual | 17515.35 849 20.630565 -----------+---------------------------------------------------- Total | 66329.279 1,154 57.477711
Code:
anova y trt / id|trt visit visit#trt v1 / id|trt, repeated(visit)
Below the data example and any advice is appreciated. I guess I am not defining the error term properly:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int id float(trt v1 visit y) 10001 0 0 0 17 10001 0 0 1 6 10001 0 0 2 7 10001 0 0 3 6 10006 0 0 0 22 10006 0 0 1 22 10006 0 0 2 20 10006 0 0 3 19 10009 0 0 0 16 10009 0 0 1 11 10009 0 0 2 6 10009 0 0 3 4 10011 0 0 0 15 10011 0 0 1 2 10011 0 0 2 1 10011 0 0 3 1 10012 0 1 0 16 10012 0 1 1 13 10012 0 1 2 12 10012 0 1 3 8 10013 0 0 0 21 10013 0 0 1 19 10013 0 0 2 . 10013 0 0 3 . 10015 0 0 0 18 10015 0 0 1 18 10015 0 0 2 17 10015 0 0 3 14 10016 0 0 0 14 10016 0 0 1 15 10016 0 0 2 5 10016 0 0 3 3 10019 0 1 0 15 10019 0 1 1 9 10019 0 1 2 2 10019 0 1 3 1 10040 0 1 0 25 10040 0 1 1 18 10040 0 1 2 22 10040 0 1 3 6 10042 0 0 0 11 10042 0 0 1 13 10042 0 0 2 16 10042 0 0 3 5 10071 0 0 0 20 10071 0 0 1 2 10071 0 0 2 3 10071 0 0 3 14 10080 0 1 0 24 10080 0 1 1 4 10080 0 1 2 3 10080 0 1 3 11 10089 0 0 0 10 10089 0 0 1 2 10089 0 0 2 15 10089 0 0 3 10 10091 0 0 0 18 10091 0 0 1 3 10091 0 0 2 2 10091 0 0 3 2 10095 0 0 0 21 10095 0 0 1 12 10095 0 0 2 8 10095 0 0 3 10 10108 0 1 0 9 10108 0 1 1 4 10108 0 1 2 7 10108 0 1 3 4 10112 0 1 0 11 10112 0 1 1 3 10112 0 1 2 7 10112 0 1 3 14 10125 0 0 0 18 10125 0 0 1 6 10125 0 0 2 3 10125 0 0 3 9 10126 0 0 0 24 10126 0 0 1 18 10126 0 0 2 19 10126 0 0 3 . 10127 0 0 0 11 10127 0 0 1 12 10127 0 0 2 11 10127 0 0 3 13 10129 0 1 0 26 10129 0 1 1 14 10129 0 1 2 7 10129 0 1 3 12 10138 0 0 0 20 10138 0 0 1 21 10138 0 0 2 18 10138 0 0 3 20 10145 0 1 0 19 10145 0 1 1 7 10145 0 1 2 7 10145 0 1 3 3 10151 0 1 0 17 10151 0 1 1 5 10151 0 1 2 7 10151 0 1 3 . end
0 Response to Anova problem
Post a Comment