Hi, I am running repeated-measures ANOVA, and MARGINS command after ANOVA produces slightly different means from the means by using SUM command. I am trying to figure out why.
Here is the data. There are two-time points (time=0/1) and two groups (Z and E).
The interaction between time and group is my primary interest. Here is the code for ANOVA-MARGINS and SUM.
But when I use the code below, I get identical numbers. As far as I understand, I need to use the code above to use the correct error terms for tests, so I am trying to figure out how to explain the differences and why I get different results.
Below is my primary interest just in case.
I would really appreciate any of your comments.
Thank you.
Here is the data. There are two-time points (time=0/1) and two groups (Z and E).
Code:
* Example generated by -dataex-. For more info, type help dataex clear input byte id float(time group) double outcome 1 0 1 5 14 0 1 5.5 11 0 0 7.5 16 0 1 4 9 0 1 3 8 0 1 2.5 5 0 0 4 4 0 1 6 7 0 0 4 10 0 0 6 2 0 1 5 6 0 0 6 13 0 1 5.5 3 0 0 6.5 12 0 0 4 15 0 1 5 17 0 0 7 7 1 0 4 12 1 0 5 11 1 0 7.66 6 1 0 8.5 10 1 0 7 14 1 1 6.5 17 1 0 8 8 1 1 4 4 1 1 6.5 16 1 1 5 5 1 0 7.5 2 1 1 4.5 1 1 1 . 9 1 1 8 13 1 1 5 3 1 0 . 15 1 1 7.5 end label values group group_l label def group_l 0 "Z", modify label def group_l 1 "E", modify
The interaction between time and group is my primary interest. Here is the code for ANOVA-MARGINS and SUM.
Code:
anova outcome group /id|group time group##time, repeated(time) margins group#time, noestimcheck by group, sort: tabstat sd_tst_t, by(time2) statistics(n mean sd min max)
But when I use the code below, I get identical numbers. As far as I understand, I need to use the code above to use the correct error terms for tests, so I am trying to figure out how to explain the differences and why I get different results.
Code:
anova sd_tst_t group group##time margins group#time by group, sort: tabstat sd_tst_t, by(time2) statistics(n mean sd min max)
Below is my primary interest just in case.
Code:
contrast rb0.time2@group, effect level(95) contrast rb0.time2#r.group, effect level(95)
I would really appreciate any of your comments.
Thank you.
Comment