Hi,
I am looking for help with repeated measures ancova syntax. First, can a categorical covariate be included in RM Ancova in stata? Second, I've pasted my code and dataex below, but I"m not sure its correct. I keep getting a stata error to include bse and bseunit, but even when I try, I keep getting the same error. I've tried reviewing other similar posts, and implementing corrections, but I"m just not confident I"m following correctly.
Study Design: PHQ9 was assessed at two timepoints ("time"- pre/post treatment). Participants were assigned to two groups ("group"). I want to control for two covariates: "age" and "riskcategory" (categorical, levels 1, 2, 3). My data is in long format.
anova PHQ9 group c.age i.riskcategory / StudyID|group time group#time c.age#time i.riskcategory#time, repeated(time)
dataex StudyID PHQ9 Age riskcategory time group
----------------------- copy starting from the next line -----------------------
[CODE]
* Example generated by -dataex-. To install: ssc install dataex
clear
input long StudyID byte(PHQ9 age) float riskcategory double time byte group
36 4 52 2 1 2
36 . 52 2 2 2
45 4 86 1 1 2
45 3 86 1 2 2
91 13 56 3 1 2
91 1 56 3 2 2
697 7 68 2 1 2
697 4 68 2 2 2
1877 9 64 1 1 2
1877 4 64 1 2 2
1901 0 78 1 1 1
1901 1 78 1 2 1
2342 2 29 2 1 2
2342 5 29 2 2 2
3065 2 68 2 1 2
3065 . 68 2 2 2
7318 6 74 2 1 2
7318 3 74 2 2 2
9081 0 75 2 1 2
9081 0 75 2 2 2
9969 2 52 2 1 2
9969 . 52 2 2 2
11266 10 71 2 1 2
11266 5 71 2 2 2
12792 8 74 2 1 2
12792 7 74 2 2 2
12813 10 67 2 1 2
12813 3 67 2 2 2
13057 5 79 2 1 2
13057 3 79 2 2 2
13151 5 70 2 1 1
13151 . 70 2 2 1
14260 3 78 1 1 2
14260 1 78 1 2 2
14315 2 77 2 1 2
14315 2 77 2 2 2
15330 6 83 1 1 2
15330 6 83 1 2 2
21083 6 69 2 1 2
21083 2 69 2 2 2
21116 7 57 1 1 2
21116 . 57 1 2 2
22195 0 61 2 1 1
22195 . 61 2 2 1
25661 0 75 1 1 2
25661 . 75 1 2 2
27006 4 70 2 1 2
27006 0 70 2 2 2
28027 2 70 2 1 2
28027 1 70 2 2 2
28031 7 56 2 1 2
28031 6 56 2 2 2
28040 0 52 2 1 1
28040 0 52 2 2 1
28053 11 45 2 1 2
28053 . 45 2 2 2
28056 7 54 1 1 2
28056 13 54 1 2 2
28071 1 58 2 1 1
28071 3 58 2 2 1
28080 2 83 1 1 1
28080 . 83 1 2 1
28089 3 67 2 1 1
28089 0 67 2 2 1
28090 4 72 2 1 2
28090 . 72 2 2 2
28091 6 61 1 1 2
28091 1 61 1 2 2
28094 0 79 1 1 1
28094 0 79 1 2 1
28109 2 46 1 1 2
28109 2 46 1 2 2
29124 6 65 3 1 2
29124 1 65 3 2 2
29126 17 50 1 1 1
29126 . 50 1 2 1
29134 1 48 1 1 2
29134 . 48 1 2 2
29141 3 81 2 1 1
29141 0 81 2 2 1
29144 8 49 1 1 2
29144 7 49 1 2 2
29149 5 53 2 1 2
29149 1 53 2 2 2
29151 3 73 2 1 2
29151 2 73 2 2 2
29159 10 53 2 1 2
29159 . 53 2 2 2
29161 15 53 1 1 1
29161 . 53 1 2 1
29177 21 59 2 1 2
29177 5 59 2 2 2
29187 1 71 3 1 2
29187 0 71 3 2 2
29196 5 67 2 1 2
29196 . 67 2 2 2
29206 1 58 2 1 2
29206 1 58 2 2 2
29212 4 70 2 1 2
29212 . 70 2 2 2
I am looking for help with repeated measures ancova syntax. First, can a categorical covariate be included in RM Ancova in stata? Second, I've pasted my code and dataex below, but I"m not sure its correct. I keep getting a stata error to include bse and bseunit, but even when I try, I keep getting the same error. I've tried reviewing other similar posts, and implementing corrections, but I"m just not confident I"m following correctly.
Study Design: PHQ9 was assessed at two timepoints ("time"- pre/post treatment). Participants were assigned to two groups ("group"). I want to control for two covariates: "age" and "riskcategory" (categorical, levels 1, 2, 3). My data is in long format.
anova PHQ9 group c.age i.riskcategory / StudyID|group time group#time c.age#time i.riskcategory#time, repeated(time)
dataex StudyID PHQ9 Age riskcategory time group
----------------------- copy starting from the next line -----------------------
[CODE]
* Example generated by -dataex-. To install: ssc install dataex
clear
input long StudyID byte(PHQ9 age) float riskcategory double time byte group
36 4 52 2 1 2
36 . 52 2 2 2
45 4 86 1 1 2
45 3 86 1 2 2
91 13 56 3 1 2
91 1 56 3 2 2
697 7 68 2 1 2
697 4 68 2 2 2
1877 9 64 1 1 2
1877 4 64 1 2 2
1901 0 78 1 1 1
1901 1 78 1 2 1
2342 2 29 2 1 2
2342 5 29 2 2 2
3065 2 68 2 1 2
3065 . 68 2 2 2
7318 6 74 2 1 2
7318 3 74 2 2 2
9081 0 75 2 1 2
9081 0 75 2 2 2
9969 2 52 2 1 2
9969 . 52 2 2 2
11266 10 71 2 1 2
11266 5 71 2 2 2
12792 8 74 2 1 2
12792 7 74 2 2 2
12813 10 67 2 1 2
12813 3 67 2 2 2
13057 5 79 2 1 2
13057 3 79 2 2 2
13151 5 70 2 1 1
13151 . 70 2 2 1
14260 3 78 1 1 2
14260 1 78 1 2 2
14315 2 77 2 1 2
14315 2 77 2 2 2
15330 6 83 1 1 2
15330 6 83 1 2 2
21083 6 69 2 1 2
21083 2 69 2 2 2
21116 7 57 1 1 2
21116 . 57 1 2 2
22195 0 61 2 1 1
22195 . 61 2 2 1
25661 0 75 1 1 2
25661 . 75 1 2 2
27006 4 70 2 1 2
27006 0 70 2 2 2
28027 2 70 2 1 2
28027 1 70 2 2 2
28031 7 56 2 1 2
28031 6 56 2 2 2
28040 0 52 2 1 1
28040 0 52 2 2 1
28053 11 45 2 1 2
28053 . 45 2 2 2
28056 7 54 1 1 2
28056 13 54 1 2 2
28071 1 58 2 1 1
28071 3 58 2 2 1
28080 2 83 1 1 1
28080 . 83 1 2 1
28089 3 67 2 1 1
28089 0 67 2 2 1
28090 4 72 2 1 2
28090 . 72 2 2 2
28091 6 61 1 1 2
28091 1 61 1 2 2
28094 0 79 1 1 1
28094 0 79 1 2 1
28109 2 46 1 1 2
28109 2 46 1 2 2
29124 6 65 3 1 2
29124 1 65 3 2 2
29126 17 50 1 1 1
29126 . 50 1 2 1
29134 1 48 1 1 2
29134 . 48 1 2 2
29141 3 81 2 1 1
29141 0 81 2 2 1
29144 8 49 1 1 2
29144 7 49 1 2 2
29149 5 53 2 1 2
29149 1 53 2 2 2
29151 3 73 2 1 2
29151 2 73 2 2 2
29159 10 53 2 1 2
29159 . 53 2 2 2
29161 15 53 1 1 1
29161 . 53 1 2 1
29177 21 59 2 1 2
29177 5 59 2 2 2
29187 1 71 3 1 2
29187 0 71 3 2 2
29196 5 67 2 1 2
29196 . 67 2 2 2
29206 1 58 2 1 2
29206 1 58 2 2 2
29212 4 70 2 1 2
29212 . 70 2 2 2
Comment