___ ____ ____ ____ ____ (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 kwmclognorm.do . // Log-normal . twoway (function y=lnnormalden(x,0,1), range(0 4)) /// > (function y=lnnormalden(x,0.5,1), range(0 4)) /// > (function y=lnnormalden(x,1,1), range(0 4)), title("LogNormal, d = 0. > 5") . . postfile kwpower test d T dfm dfr using kwpowermcln.dta, replace (note: file kwpowermcln.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 kwpowermcln.dta, clear . . generate sig = Ftail(dfm, dfr, T)<0.05 if test==1 (27,500 missing values generated) . replace sig = chi2tail(dfm, T)<0.05 if test==2 (27,500 real changes made) . *tabulate test sig, row . bysort test: tabulate d sig, row ------------------------------------------------------------------------------- -> test = 1 +----------------+ | Key | |----------------| | frequency | | row percentage | +----------------+ | sig d | 0 1 | Total -----------+----------------------+---------- 0 | 2,415 85 | 2,500 | 96.60 3.40 | 100.00 -----------+----------------------+---------- .1 | 2,367 133 | 2,500 | 94.68 5.32 | 100.00 -----------+----------------------+---------- .2 | 2,216 284 | 2,500 | 88.64 11.36 | 100.00 -----------+----------------------+---------- .3 | 1,962 538 | 2,500 | 78.48 21.52 | 100.00 -----------+----------------------+---------- .4 | 1,557 943 | 2,500 | 62.28 37.72 | 100.00 -----------+----------------------+---------- .5 | 1,104 1,396 | 2,500 | 44.16 55.84 | 100.00 -----------+----------------------+---------- .6 | 674 1,826 | 2,500 | 26.96 73.04 | 100.00 -----------+----------------------+---------- .7 | 435 2,065 | 2,500 | 17.40 82.60 | 100.00 -----------+----------------------+---------- .8 | 242 2,258 | 2,500 | 9.68 90.32 | 100.00 -----------+----------------------+---------- .9 | 124 2,376 | 2,500 | 4.96 95.04 | 100.00 -----------+----------------------+---------- 1 | 103 2,397 | 2,500 | 4.12 95.88 | 100.00 -----------+----------------------+---------- Total | 13,199 14,301 | 27,500 | 48.00 52.00 | 100.00 ------------------------------------------------------------------------------- -> test = 2 +----------------+ | Key | |----------------| | frequency | | row percentage | +----------------+ | sig d | 0 1 | Total -----------+----------------------+---------- 0 | 2,367 133 | 2,500 | 94.68 5.32 | 100.00 -----------+----------------------+---------- .1 | 2,322 178 | 2,500 | 92.88 7.12 | 100.00 -----------+----------------------+---------- .2 | 2,037 463 | 2,500 | 81.48 18.52 | 100.00 -----------+----------------------+---------- .3 | 1,701 799 | 2,500 | 68.04 31.96 | 100.00 -----------+----------------------+---------- .4 | 1,108 1,392 | 2,500 | 44.32 55.68 | 100.00 -----------+----------------------+---------- .5 | 634 1,866 | 2,500 | 25.36 74.64 | 100.00 -----------+----------------------+---------- .6 | 227 2,273 | 2,500 | 9.08 90.92 | 100.00 -----------+----------------------+---------- .7 | 75 2,425 | 2,500 | 3.00 97.00 | 100.00 -----------+----------------------+---------- .8 | 18 2,482 | 2,500 | 0.72 99.28 | 100.00 -----------+----------------------+---------- .9 | 0 2,500 | 2,500 | 0.00 100.00 | 100.00 -----------+----------------------+---------- 1 | 0 2,500 | 2,500 | 0.00 100.00 | 100.00 -----------+----------------------+---------- Total | 10,489 17,011 | 27,500 | 38.14 61.86 | 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 kwpowermclntable.dta, replace (note: file kwpowermclntable.dta not found) file kwpowermclntable.dta saved . line sig1 sig2 d, title("Log-Normal, by MC") ytitle("Power") /// > xtitle("group differences") . . // Log-normal arithmetic parameterization? Not! what van Hecke used. . twoway (function y=lnnormalden(x,ln(0.1)-0.5*ln(1/.1^2+1),sqrt(ln(1/.1^2+1))) > , range(0 4)) /// > (function y=lnnormalden(x,ln(0.5)-0.5*ln(1/.5^2+1),sqrt(ln(1/.5^2+1)) > ), range(0 4)) /// > (function y=lnnormalden(x,ln(1)-0.5*ln(1/1^2+1),sqrt(ln(1/1^2+1))), r > ange(0 4)), title("LogNormal, d ~= 0.5") . . postfile kwpower test d T dfm dfr using kwpowermcln2.dta, replace (note: file kwpowermcln2.dta not found) . quietly forvalues d=0.1(0.05)0.5 { difference .1 difference .15 difference .2 difference .25 difference .3 difference .35 difference .4 difference .45 difference .5 . postclose kwpower . . use kwpowermcln2.dta, clear . . generate sig = Ftail(dfm, dfr, T)<0.05 if test==1 (22,500 missing values generated) . replace sig = chi2tail(dfm, T)<0.05 if test==2 (22,500 real changes made) . *tabulate test sig, row . bysort test: tabulate d sig, row ------------------------------------------------------------------------------- -> test = 1 +----------------+ | Key | |----------------| | frequency | | row percentage | +----------------+ | sig d | 0 1 | Total -----------+----------------------+---------- .1 | 1,977 523 | 2,500 | 79.08 20.92 | 100.00 -----------+----------------------+---------- .15 | 1,644 856 | 2,500 | 65.76 34.24 | 100.00 -----------+----------------------+---------- .2 | 1,413 1,087 | 2,500 | 56.52 43.48 | 100.00 -----------+----------------------+---------- .25 | 1,201 1,299 | 2,500 | 48.04 51.96 | 100.00 -----------+----------------------+---------- .3 | 969 1,531 | 2,500 | 38.76 61.24 | 100.00 -----------+----------------------+---------- .35 | 741 1,759 | 2,500 | 29.64 70.36 | 100.00 -----------+----------------------+---------- .4 | 655 1,845 | 2,500 | 26.20 73.80 | 100.00 -----------+----------------------+---------- .45 | 505 1,995 | 2,500 | 20.20 79.80 | 100.00 -----------+----------------------+---------- .5 | 378 2,122 | 2,500 | 15.12 84.88 | 100.00 -----------+----------------------+---------- Total | 9,483 13,017 | 22,500 | 42.15 57.85 | 100.00 ------------------------------------------------------------------------------- -> test = 2 +----------------+ | Key | |----------------| | frequency | | row percentage | +----------------+ | sig d | 0 1 | Total -----------+----------------------+---------- .1 | 286 2,214 | 2,500 | 11.44 88.56 | 100.00 -----------+----------------------+---------- .15 | 174 2,326 | 2,500 | 6.96 93.04 | 100.00 -----------+----------------------+---------- .2 | 107 2,393 | 2,500 | 4.28 95.72 | 100.00 -----------+----------------------+---------- .25 | 53 2,447 | 2,500 | 2.12 97.88 | 100.00 -----------+----------------------+---------- .3 | 36 2,464 | 2,500 | 1.44 98.56 | 100.00 -----------+----------------------+---------- .35 | 27 2,473 | 2,500 | 1.08 98.92 | 100.00 -----------+----------------------+---------- .4 | 14 2,486 | 2,500 | 0.56 99.44 | 100.00 -----------+----------------------+---------- .45 | 10 2,490 | 2,500 | 0.40 99.60 | 100.00 -----------+----------------------+---------- .5 | 9 2,491 | 2,500 | 0.36 99.64 | 100.00 -----------+----------------------+---------- Total | 716 21,784 | 22,500 | 3.18 96.82 | 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 kwpowermcln2table.dta, replace (note: file kwpowermcln2table.dta not found) file kwpowermcln2table.dta saved . line sig1 sig2 d, title("Log-Normal, by MC") ytitle("Power") /// > xtitle("group differences") . end of do-file