[R] stratified Wilcoxon available?
Thomas Lumley
tlumley at u.washington.edu
Mon Aug 29 04:02:59 CEST 2005
On Sun, 28 Aug 2005, Heinz Tuechler wrote:
> Thanks to Peter Dalgaard and Frank Harrell for your answers. Fortunately I
> don't have an urgent need for this test, but it may be in the future.
> Still I would be grateful if someone could comment on my opinion that using
> survdiff and regarding all the measures as events would lead to an
> equivalent test.
In the absence of ties, yes. In the presence of ties I think survdiff()
does something slightly different from what would be usual for the
Wilcoxon test. This would matter only with many tied observations.
-thomas
>
> Thanks,
>
> Heinz Tüchler
>
> At 15:18 28.08.2005 -0500, Frank E Harrell Jr wrote:
>> Peter Dalgaard wrote:
>>> Heinz Tuechler <tuechler at gmx.at> writes:
>>>
>>>
>>>> Dear All,
>>>>
>>>> is there a stratified version of the Wilcoxon test (also known as van
>>>> Elteren test) available in R?
>>>> I could find it in the survdiff function of the survival package for
>>>> censored data. I think, it should be possible to use this function creating
>>>> a dummy censoring indicator and setting it to not censored, but may be
>>>> there is a better way to perform the test.
>>>
>>>
>>> Not easily, I think. I played with the stratified Kruskal Wallis test
>>> (which is the same thing for larger values of 2...) with a grad
>>> student some years ago, but we never got it integrated as an "official"
>>> R function.
>>>
>>> It was not massively hard to code, as I recall it. Basically, you
>>> convert observations to within-stratum ranks, scaled so that the
>>> scores have similar variance (this is crucial: just adding the
>>> per-stratum rank sums won't work). You can then get the relevant SSD
>>> from lm(), by comparing the models "r ~ group + strata" and "r ~
>>> strata". This SSD can be looked up as a chi-square statistic, possibly
>>> after applying a scale factor which I have forgotten.... (I.e. do your
>>> own math, don't trust me!)
>>>
>>
>> You might think of such a stratified test as part of a proportional odds
>> model with adjustment for strata as main effects. The Wilcoxon tests is
>> a special case of the PO model. You can fit it with polr or lrm.
>>
>> --
>> Frank E Harrell Jr Professor and Chair School of Medicine
>> Department of Biostatistics Vanderbilt University
>>
>>
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
Thomas Lumley Assoc. Professor, Biostatistics
tlumley at u.washington.edu University of Washington, Seattle
More information about the R-help
mailing list