Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Re: signranktest for groups


From   "Joseph Coveney" <jcoveney@bigplanet.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: signranktest for groups
Date   Sat, 21 Jul 2012 12:24:49 +0900

Maren Kandulla wrote:

I try to test wether two groups (with and without treatment) differ in terms 
of change of types (4 types,ordinal scale). I have two measuring times (pre 
and post). Every child belongs to one type in the beginning and an other 
type (or the same) in the end (after (non) treatment).The types can be 
arranged as an ordinal cale.
Is there any possibility to do a signrank test for groups (with two 
measuring times)? Or any other nonparametric test for matched data and 
group-testing?

--------------------------------------------------------------------------------

The do-file below shows a couple of ways.  A user-written command called -emh- 
is used for them.  This command can be downloaded and installed from SSC.  

To install, at the command prompt in Stata, type:

    ssc install emh

The do-file illustrates the nonparametric / rank-based methods using a fake 
dataset that should resemble yours, based upon your description.

A caveat with Koch's rank ANCOVA is that the pretreatment type scores should be
similar between groups, as you would expect in a randomized controlled trial.  
I'm not sure whether that fits your circumstances.

There are a couple of other ways, too, for example, a permutation test using
-permute- with -anova- or -regress-; and parametric methods for 
ordered-categorical data, such as -ologit- (official Stata) and -gologit2- 
(user-written, also available from SSC).  The dataset would be "wide", that
is, one observation per child, just like it is in the illustration below, and
you would use the pretreatment type as a covariate, again, like below.

Joseph Coveney


*
* Create fake dataset for use in illustration
*
clear *
set more off
set seed `=date("2012-07-21", "YMD")'
quietly set obs 100
generate byte treatment = _n > _N / 2
generate byte child = _n
generate byte type0 = 1 + floor(4 * runiform()) // *
generate byte type1 = 1 + floor(4 * runiform())
preserve

*
* Stratified on baseline type (ANCOVA analogue)
*
contract treatment type?, freq(count)
emh type1 treatment [fweight=count], anova ///
    strata(type0) trans(modridit)
restore

*
* Koch's Rank ANCOVA
*
egen double type0_rank = rank(type0)
egen double type1_rank = rank(type1)
quietly regress type1_rank type0_rank
predict double residual, residual
emh residual treatment, anova trans(table)

exit

*http://blog.stata.com/2012/07/18/using-statas-random-number-generators-part-1/


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


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