// How to use npStochin // 1. install moremata package ssc install moremata // 2. set working directory global wd="/Users/nataliashestakova/Google Drive/1 - research/2015-10 Karl's tests" // 3. install npStochin program do "$wd/npStochin_0905.do" // 4. load data from excel import excel using "$wd/npstatscoursedata.xlsx", sheet(law) firstrow clear // test when data is stored as two variables // 1. default settings: alternative=twosided, d=0, alpha=0.05, max_iter=100000 npStochin Civil=Common // 2. change alternative to "greater" or "less" npStochin Civil=Common, greater npStochin Civil=Common, less // specifying "twosided" is identical to not specifying anything npStochin Civil=Common, twosided // specifying more than one alternative causes an error npStochin Civil=Common, greater less // 3. change d npStochin Civil=Common, d(0.5) // 4. change alpha npStochin Civil=Common, alpha(0.01) // the order in which options are specified does not matter npStochin Civil=Common, alpha(0.01) less d(0.5) npStochin Civil=Common, d(0.5) less alpha(0.01) // to be fixed // npStochin Civil=Common, d(0.7) // test when data is stored as variable and group dummy // transform data to long format rename Civil var1 rename Common var2 gen obs=_n reshape long var, i(obs) j(group) drop obs drop if var==. // 1. default settings: alternative=twosided, d=0, alpha=0.05, max_iter=100000 npStochin var, by(group) // 2. change alternative to "greater" or "less" npStochin var, by(group) greater npStochin var, by(group) less // specifying "twosided" is identical to not specifying anything npStochin var, by(group) twosided // specifying more than one alternative causes an error npStochin var, by(group) greater less // 3. change d npStochin var, by(group) d(0.5) // 4. change alpha npStochin var, by(group) alpha(0.01) // the order in which options are specified does not matter npStochin var, by(group) alpha(0.01) less d(0.5) npStochin var, by(group) d(0.5) less alpha(0.01)