Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

st: Re: signranktest for groups

From   "Maren Kandulla" <[email protected]>
To   <[email protected]>
Subject   st: Re: signranktest for groups
Date   Sun, 29 Jul 2012 19:21:27 +0200

Hallo Joseph,
Thanks for this information!
Unfortunately I do not have stata11. Is there any chance to get a version for stata 10?


Dr. Maren Kandulla

From: Joseph Coveney
Sent: Saturday, July 21, 2012 5:24 AM
To: [email protected]
Cc: 'Maren Kandulla'
Subject: st: Re: signranktest for groups

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


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())

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

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



*   For searches and help try:
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index