Dear Stata users,
I used -nptrend- to perform a nonparametric test for
trend across ordered groups. I assumed that because it
was non-parametric the way that the groups were coded
was not important. I coded a severity of illness
variable as follows:
0 not severe
1 mildly severe
2 severe
3 most severe
I run the -nptrend- an obtained:
. nptr died, by(severe)
severe score obs sum of ranks
0 0 129 19828
1 1 88 13737
2 2 66 11148
3 3 39 7290
z = 2.75, chi-squared(1) = 7.57
P>|z| = 0.0059
When I recoded the severity variable as:
0 not severe
.5 mildly severe
.7 severe
1 most severe
but maintaining the order, to my surprise I obtained:
. nptr died, by(severe)
severe score obs sum of ranks
0 0 129 19828
.5 .5 88 13737
.7 .7 66 11148
1 1 39 7290
z = 2.52, chi-squared(1) = 6.35
P>|z| = 0.0117
I though that this nonparametric test would be
invariant to the scale and only affected by the
relative ordering of the categories.
Is there a test for trend that is not affected by the
magnitude of the class variable values?
Yes. My own -somersd- package, downloadable from SSC, calculates confidence
intervals for Somers' D and Kendall's tau-a, both of which are ordinal
trend measures unaffected by the magnitude of the class variable values. A
general review of these parameters behind "nonparametric" statistics is my
Stata Journal article (Newson, 2002). A pre-publication draft of this can
be downloaded from my website at