Dear All,
In the first permutation test below Stata reports P=0.045, while in
the second permutation test Stata reports P=0.063. I am of the
opinion that the two permutation tests are equivalent. Can anyone
explain why the P-values are different?
clear
capture program drop diff //this drops any previous program called diff//
program diff, rclass //this is the beginning of the program//
summarize count if treated //here we generated the sum if treated//
local sumt = r(sum) //and store it//
summarize count if treated == 0 //here is the sum if not treated//
local sum0 = r(sum) //and stored//
return scalar diff = `sumt' - `sum0' //here we calculate the diff//
end
//now we input the data//
input count treated
121 1
118 1
110 1
90 1
95 0
34 0
22 0
12 0
end
//here we tell it to use the program diff and then use it in -permute-//
diff
set seed 12345
permute count diff=r(diff), reps(1000) nowarn nodots: diff
set seed 12345
permute count "diff" diff=r(diff), reps(1000) nowarn
Raphael
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/