___ ____ ____ ____ ____ (R) /__ / ____/ / ____/ ___/ / /___/ / /___/ 14.0 Copyright 1985-2015 StataCorp LP Statistics/Data Analysis StataCorp 4905 Lakeway Drive MP - Parallel Edition College Station, Texas 77845 USA 800-STATA-PC http://www.stata.com 979-696-4600 stata@stata.com 979-696-4601 (fax) 5-user 16-core Stata network license expires 23 Oct 2016: Serial number: 501409202298 Licensed to: Social Science Computing Cooperative University of Wisconsin-Madison Notes: 1. Stata is running in batch mode. 2. Unicode is supported; see help unicode_advice. 3. More than 2 billion observations are allowed; see help obs_advice. 4. Maximum number of variables is set to 5000; see help set_maxvar. . do permutationkw.do . postfile kwpower test d p using kwpowerperm.dta, replace (note: file kwpowerperm.dta not found) . quietly forvalues d=0(0.1)1 { difference 0 difference .1 difference .2 difference .3 difference .4 difference .5 difference .6 difference .7 difference .8 difference .9 difference 1 . postclose kwpower . . use kwpowerperm.dta, clear . . generate sig = p<0.05 . bysort test: tabulate d sig, row ------------------------------------------------------------------------------- -> test = 1 +----------------+ | Key | |----------------| | frequency | | row percentage | +----------------+ | sig d | 0 1 | Total -----------+----------------------+---------- 0 | 2,384 116 | 2,500 | 95.36 4.64 | 100.00 -----------+----------------------+---------- .1 | 2,297 203 | 2,500 | 91.88 8.12 | 100.00 -----------+----------------------+---------- .2 | 2,043 457 | 2,500 | 81.72 18.28 | 100.00 -----------+----------------------+---------- .3 | 1,573 927 | 2,500 | 62.92 37.08 | 100.00 -----------+----------------------+---------- .4 | 1,018 1,482 | 2,500 | 40.72 59.28 | 100.00 -----------+----------------------+---------- .5 | 497 2,003 | 2,500 | 19.88 80.12 | 100.00 -----------+----------------------+---------- .6 | 179 2,321 | 2,500 | 7.16 92.84 | 100.00 -----------+----------------------+---------- .7 | 56 2,444 | 2,500 | 2.24 97.76 | 100.00 -----------+----------------------+---------- .8 | 10 2,490 | 2,500 | 0.40 99.60 | 100.00 -----------+----------------------+---------- .9 | 5 2,495 | 2,500 | 0.20 99.80 | 100.00 -----------+----------------------+---------- 1 | 0 2,500 | 2,500 | 0.00 100.00 | 100.00 -----------+----------------------+---------- Total | 10,062 17,438 | 27,500 | 36.59 63.41 | 100.00 ------------------------------------------------------------------------------- -> test = 2 +----------------+ | Key | |----------------| | frequency | | row percentage | +----------------+ | sig d | 0 1 | Total -----------+----------------------+---------- 0 | 2,382 118 | 2,500 | 95.28 4.72 | 100.00 -----------+----------------------+---------- .1 | 2,305 195 | 2,500 | 92.20 7.80 | 100.00 -----------+----------------------+---------- .2 | 2,061 439 | 2,500 | 82.44 17.56 | 100.00 -----------+----------------------+---------- .3 | 1,610 890 | 2,500 | 64.40 35.60 | 100.00 -----------+----------------------+---------- .4 | 1,079 1,421 | 2,500 | 43.16 56.84 | 100.00 -----------+----------------------+---------- .5 | 566 1,934 | 2,500 | 22.64 77.36 | 100.00 -----------+----------------------+---------- .6 | 224 2,276 | 2,500 | 8.96 91.04 | 100.00 -----------+----------------------+---------- .7 | 66 2,434 | 2,500 | 2.64 97.36 | 100.00 -----------+----------------------+---------- .8 | 18 2,482 | 2,500 | 0.72 99.28 | 100.00 -----------+----------------------+---------- .9 | 7 2,493 | 2,500 | 0.28 99.72 | 100.00 -----------+----------------------+---------- 1 | 0 2,500 | 2,500 | 0.00 100.00 | 100.00 -----------+----------------------+---------- Total | 10,318 17,182 | 27,500 | 37.52 62.48 | 100.00 . . collapse (mean) sig, by(test d) . separate sig, by(test) storage display value variable name type format label variable label ------------------------------------------------------------------------------- sig1 float %9.0g sig, test == 1 sig2 float %9.0g sig, test == 2 . label variable sig1 "Anova" . label variable sig2 "Kruskal-Wallis" . save kwpowerpermnorm.dta, replace (note: file kwpowerpermnorm.dta not found) file kwpowerpermnorm.dta saved . line sig1 sig2 d, title("Normal, by permutation") ytitle("Power") /// > xtitle("group differences") . end of do-file