<>
See Maarten`s http://www.stata-journal.com/article.html?article=st0137
*******
webuse fuel2, clear
ranksum mpg, by(treat)
di 2*normal(-abs(r(z)))
*******
HTH
Martin
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Eduardo Nunez
Sent: Montag, 11. Januar 2010 21:09
To: [email protected]
Subject: st: programing question
Dear statalisters,
I need to calculate the p-value for continuous variables comparison
among two levels of the exposure variable, using non-parametric method
(ranksum).
I adapted a program I got from Martin Weiss:
----------------------------------------------------------------------------
-----------------------------------
tempname hdle
capt erase info.dta
postfile `hdle' str30 var noCMV_50p noCMV_25p noCMV_75p /*
*/ CMV_50p CMV_25p CMV_75p pval /*
*/ using info
foreach var of varlist los edad fc_ingreso tas_ingreso_i tad_i hb hto
leucos neutrofilos linfocitos monocitos cr gfr acurico_i au_gfr
colesteroli ldli hdl_i tgai na pcri fn_i tni ca125i ntprobnpi fe_i
dtdvii dtsvii septoi pp_i lvmass_i ai_i anchoqrs charlson_index
cpies_dnaml_max hsp60_maxi hsp60_maxi hsp60_total_maxi il1_beta_maxi
il_6_maxi il_10_mini tnf_a_maxi leucos1 linfos1 neutrofilos1
monocitos1 linfporc linfporc1 linfporc_min {
sum `var' if !dnacmv, d
loc noCMV_50p=r(p50)
loc noCMV_25p=r(p25)
loc noCMV_75p=r(p75)
sum `var' if dnacmv, d
loc CMV_50p=r(p50)
loc CMV_25p=r(p25)
loc CMV_75p=r(p75)
ranksum `var', by(dnacmv)
local pval=r(?????)
sum `var', d
post `hdle' ("`var'") (`noCMV_50p') (`noCMV_25p') (`noCMV_75p') /*
*/ (`CMV_50p') (`CMV_25p') (`CMV_75p') (`pval')
}
postclose `hdle'
use info, clear
l, abbrev(30) noobs sep(0)
----------------------------------------------------------------------------
------------------------------
However, ranksum doesn't reurn r(p) but r(z). How can I get the
p-value for each comparison using "z"?
Thank you in advance,
Eduardo, MD, MPH
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/