Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: non-parametric oneway group median display, test, and graph


From   "George M Hoffman MD" <ghoffman@mcw.edu>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: non-parametric oneway group median display, test, and graph
Date   Fri, 11 Feb 2005 10:07:27 -0600

I have made a brief program to do what I had been looking for, combining
tabstat, kwallis, and a box plot.

it is pasted below if anyone is interested.

nponeway.ado
--------------------
*! version 1.0.1 George M Hoffman 10Feb2005 /GMH
*! displays nonparametric stats by group, krusskal-wallis test, and optional 
box plot
*! sytax nponeway Y
program nponeway, sortpreserve rclass
 version 8.1
 syntax varlist(numeric) [if] [in] [, BY(varname) plot]

 local nvars : word count `varlist'

 if `nvars' > 1 {
  di as err "only one variable"
  exit 498
  }

 marksample touse
 markout `touse' `xvar'
   tokenize "`varlist'"
   preserve
   quietly keep if `touse'

 tabstat `1' , stat(n p50 iqr range p5 p95) by(`by')
 kwallis `1' , by(`by')

 if "`plot'" == "plot" {
  gr box `1', over(`by') noout
  }
 end


*
*   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/



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