[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
Joseph Coveney <[email protected]> |

To |
Statalist <[email protected]> |

Subject |
Re: st: signrank only gives asymptotic p-value? |

Date |
Fri, 29 Jul 2005 15:52:05 +0900 |

Jacob Wegelin wrote: The command signrank junk where junk is a variable with the following seven values: -0.5 1 2 3 4 4.3 4.4 yields a p-value of 0.0280. (This is Stata/SE 9.0 for Windows.) This appears to be the *asymptotic* p-value, i.e., based on computing an approximate z statistic of 2.197. This is not the p-value one gets by comparing the signed rank statistic (which is 1, i.e., the number one) with the distribution of the signed rank statistic. That p-value is 0.03125, when computed by R software (www.r-project.org). My reference for the wilcoxon is van Belle et al., Biostatistics: A Methodology for the Health Sciences. 2 ed. Hoboken, New Jersey: John Wiley & Sons, Inc.; 2004, pages 258ff. The Stata manual (Release 8, 2003, Reference S-Z, page 64-66) supports my belief that only the asymptotic p-value is returned by Stata, because the passage on signrank ends with the formula for the z statistic. Is there a way to get the actual wilcoxon signed-rank p-value, i.e., not the asymptotic p-value, out of Stata? -------------------------------------------------------------------------------- You can get there using -permute-. It's illustrated below with syntax for Release 9. You can increase the number of replications to increase precision as desired. (The run illustrated below gives 9,391 / 300,000, or P = 0.0313.) I think that there is C source code floating around on the Web for the Wilcoxon signed ranks permutation distribution that you can fashion into a plug-in that would be quicker, but not so quick as reaching over to the bookshelf. Joseph Coveney clear set more off input float junk -0.5 1 2 3 4 4.3 4.4 end generate float reference = 0 rename junk junk0 generate float junk1 = -junk0 generate byte row = _n reshape long junk, i(row) j(flip) * program define longranksum, rclass signrank junk = reference if flip return scalar z = r(z) end * set seed `=date("2005-07-29", "ymd")' permute flip Z = r(z), reps(300000) strata(row) /// nodots nowarn: longranksum exit * * 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/

- Prev by Date:
**st: signrank only gives asymptotic p-value?** - Next by Date:
**Re: st: RE: how to prevent omission of zeroes in frequency tab** - Previous by thread:
**st: signrank only gives asymptotic p-value?** - Index(es):

© Copyright 1996–2024 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |