Hi everyone -- I've searched around, and I'm still having trouble understanding whether what I want to do is: a) possible, and b) statisically viable/worthy it.
Before, I begin: dataex to the rescue! (FYI -- data are long.)
Now, let's start with what I WANT a table to look like, which is more or less what dtable would produce, except I want a third variable in the cells, like this:
Here's the code I used to produce the above table:
Now, I know I can do something similar to this using tabulate, summarize(), but a) I don't have any control over the statistics reported with that, and b) I can't do a test of association with tab 2x2 table.
So, what is missing is a test of association, much like you'd find in dtable. (Obviously, not on the composite result, but on the median only.) However, in this case it obviously won't be a chi square -- though with this particular variable (ie. total_score), it could be, as it's a percentage multiplied by 100 to get an integer in each cell.
Back to my two questions:
1) Is it possible to do this for an entire table (e.g. Table 1) while including a test of significant for each row variable?
2) Is there a better way of showing these higher order associations pre vs post? I plan on creating an adjusted model using xtreg, but I'd love to be able to show the investigator the unadjusted total score differences with some unadjusted association testing too.
Thanks!
Before, I begin: dataex to the rescue! (FYI -- data are long.)
Code:
* Example generated by -dataex-. For more info, type help dataex clear input int studyid byte(timepoint gender total_score) 117 1 1 75 116 2 1 60 117 2 1 90 216 1 1 80 115 2 1 60 230 2 1 65 136 2 1 80 115 1 1 70 116 1 1 70 152 2 1 65 106 2 1 85 152 1 1 50 230 1 1 55 216 2 1 90 136 1 1 80 106 1 1 85 109 1 2 70 255 1 2 50 226 1 2 50 140 2 2 85 114 2 2 95 129 1 2 55 144 1 2 55 138 2 2 70 113 1 2 70 207 2 2 70 210 1 2 90 142 2 2 80 119 2 2 55 139 2 2 90 132 1 2 40 248 2 2 80 134 1 2 95 217 2 2 85 111 2 2 90 119 1 2 30 238 1 2 85 120 2 2 65 101 1 2 65 156 1 2 80 105 2 2 95 130 1 2 75 107 1 2 50 123 2 2 95 104 1 2 75 228 2 2 80 125 2 2 95 245 2 2 80 238 2 2 90 208 2 2 80 219 2 2 55 241 2 2 85 164 1 2 65 232 1 2 90 209 1 2 80 253 2 2 70 231 1 2 80 207 1 2 70 110 1 2 80 250 1 2 70 147 1 2 60 112 1 2 55 147 2 2 75 137 1 2 75 143 1 2 60 211 2 2 85 127 1 2 85 139 1 2 90 154 1 2 75 160 1 2 35 134 2 2 95 253 1 2 55 222 1 2 40 146 2 2 85 163 1 2 30 237 1 2 65 130 2 2 85 209 2 2 80 252 2 2 70 105 1 2 80 146 1 2 70 110 2 2 85 118 2 2 100 148 2 2 85 104 2 2 90 135 1 2 65 122 1 2 85 131 1 2 70 208 1 2 70 252 1 2 60 222 2 2 60 150 1 2 80 165 2 2 90 145 1 2 95 143 2 2 85 133 2 2 95 124 1 2 90 223 1 2 75 163 2 2 65 127 2 2 95 end label values timepoint la_survey label def la_survey 1 "Pre", modify label def la_survey 2 "Post", modify label values gender la_gender label def la_gender 1 "Male", modify label def la_gender 2 "Female", modify
Code:
----------------------------------------------------
| Timepoint
| Pre Post
----------------+-----------------------------------
Gender (Female) |
Male | 72.5 [62.5-80] 72.5 [62.5-87.5]
Female | 70 [55-80] 85 [75-90]
----------------------------------------------------
Code:
table gender timepoint, statistic(p50 total_score) statistic(p25 total_score) statistic(p75 total_score) collect composite define inter = p25 p75, delimiter("-") trim collect style cell result[inter], sformat("[%s]") collect composite define med_inter = p50 inter , delimiter(" ") trim collect layout (gender[1 2]) (timepoint[1 2]#result[med_inter]) collect style header result[med_inter], level(hide) collect preview
So, what is missing is a test of association, much like you'd find in dtable. (Obviously, not on the composite result, but on the median only.) However, in this case it obviously won't be a chi square -- though with this particular variable (ie. total_score), it could be, as it's a percentage multiplied by 100 to get an integer in each cell.
Back to my two questions:
1) Is it possible to do this for an entire table (e.g. Table 1) while including a test of significant for each row variable?
2) Is there a better way of showing these higher order associations pre vs post? I plan on creating an adjusted model using xtreg, but I'd love to be able to show the investigator the unadjusted total score differences with some unadjusted association testing too.
Thanks!
Comment