user2146441
user2146441

Reputation: 228

Stata: Capture p-value from ranksum test

When I run return list, all after running a ranksum test, the count and z-score are available, but not the p-value. Is there any way of picking it up?

clear
input eventtime prefflag winner stakechange
1   1   1   10
1   2   1   5
2   1   0   50
2   2   0   31
2   1   1   51
2   2   1   20
1   1   0   10
2   2   1   10
2   1   0   5
3   2   0   8
4   2   0   8
5   2   0   8
5   2   1   8
3   1   1   8
4   1   1   8
5   1   1   8
5   1   1   8
end

bysort eventtime winner: tabstat stakechange, stat(mean median n) columns(statistics)



ranksum stakechange if inlist(eventtime, 1, 2) & inlist(winner, 0, .), by (eventtime) 
return list, all

Upvotes: 0

Views: 1290

Answers (1)

Roberto Ferrer
Roberto Ferrer

Reputation: 11102

Try computing it after ranksum:

scalar pval = 2 * normprob(-abs(r(z)))
display pval

The answer is by @NickCox: http://www.stata.com/statalist/archive/2004-12/msg00622.html

The Statalist archive is a valuable resource.

Upvotes: 4

Related Questions