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

Re: st: Kruskal-Wallis equivalent for survey data with pweight

From   Steven Samuels <>
Subject   Re: st: Kruskal-Wallis equivalent for survey data with pweight
Date   Sat, 1 Nov 2008 11:27:22 -0400

See Stata's Survival Analysis manual, p. 93. The log-rank test, also known as the exponential scores test or Savage test, is the likelihood score test in a Cox regression model with indicator variables for groups. It tests the hypothesis that all coefficients are zero. For -stcox-, Stata reports instead the generalized Wald statistic (F test), which tests the same hypothesis. The results are usually quite close.

**************************CODE BEGINS**************************
sysuse auto,clear
svyset _n
stset mpg
sts test foreign, logrank
svy: stcox foreign
***************************CODE ENDS***************************



You have not given us a good reason for preferring the K-W test. It is the most widely known rank test for comparing >2 groups, but there are many others. The test from -stcox- is appropriate for any positive random variable, censored or not. It has power to detect group differences even if the proportional-hazards assumption is false. You report the p-value from the test statistic, but you need not report estimated coefficients-these depend on the truth of the proportional-hazards assumption. Instead, plot the weighted survival or distribution curves.

However, a k-sample test is rarely enough by itself, even if "significant". The real questions are: which groups differ from one another? how do they differ? are the differences explained or moderated by other factors?

Good luck!


On Nov 1, 2008, at 7:12 AM, Aca N.T. wrote:

Thanks Maarten & Steven, I have to change the analyses for LOS.
However, I've picked a wrong example here since I have some other
skewed variables for which KW test remains appropriate I think (eg.
triglyceride level). Can you suggest how to perform the analysis using

Thanks in advance.

On Fri, Oct 31, 2008 at 4:24 PM, Maarten buis <> wrote:
--- "Aca N.T." <> wrote:
I have a simple question about testing length of stay (LOS)
differences among 5 groups. The response variable (LOS) has a skewed
distribution. I have previously transformed the LOS (log
transformation) and tried parametric statistic (ANOVA using
svy:regress), but not happy when performing back-transformation for
SD/SE. I rarely used non-parametric statistics before even for
non-survey data, so really this issue is a hassle for me. I believe,
however, that Stata has a test equivalent to Kruskal-Wallis for
survey data.

The conventional way of analysing length of stay data is using survival
analysis. So I would -stset- the data, and than use -sts test- to do
the test. You can specify weights in the -stset- command. See:
-help stset- and -help -sts test-.

Hope this helps,

Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room N515

+31 20 5986715

*   For searches and help try:

*   For searches and help try:

*   For searches and help try:

*   For searches and help try:

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