I'm trying to build a table using the new table command. I want the first column of the table to contain the variable range, e.g, "1-4" or "1-7". This needs to the theoretical maximum, so even if the highest actual score is 6.8, it should be 1-7. I call this Step 1.
I want the intermediate columns to be the count mean and sd by gender. I've got this working perfectly (Step 2).
And then at the end of the table I need the effect size and p values pertain to the difference between male and female levels. I'm doing this manually as well (Steps 3 and 4). Is there a way to use table so that steps 1, 3 and 4 are done by the command?
Thanks.
I want the intermediate columns to be the count mean and sd by gender. I've got this working perfectly (Step 2).
And then at the end of the table I need the effect size and p values pertain to the difference between male and female levels. I'm doing this manually as well (Steps 3 and 4). Is there a way to use table so that steps 1, 3 and 4 are done by the command?
Code:
* 1. manually get ranges and put in first column
* 2. get count mean sd
table (var) (female), ///
statistic(count a b c) ///
statistic (mean a b c) ///
statistic(sd a b c) ///
nformat(%4.0f count) nformat(%4.2f mean sd) nototals
collect levelsof result
collect style header result row stack, level(hide)
collect layout (var) (female[0 1]#result)
*3. get effect sizes as eta squared
*get eta squares
foreach var in a b c{
quietly anova `var' female
qui estat esize
di e(r2)
}
*4. get p values
foreach var in a b c{
quietly anova `var' female
local pModel = Ftail(e(df_m),e(df_r),e(F))
display `pModel'
}

Comment