Hello All,

Thanks a lot for the helpful suggestions.  I wonder how ties are handled
for the rank sum test by wilcox_test and wilcox.exact?  For instance, other
software such as Minitab correct for ties by adjusting the variance of the
test statistic, and actually provide the p values before and after
adjustment for ties.  IIf neither wilcox_test nor wilcox.exact expressly
corrects for ties in the Wilcoxon rank sum test, then perhaps one should
just use the conventional wilcox.test which is the simplest of them all?
Thanks again

Janh


On Sat, Jun 1, 2013 at 8:41 AM, Henric Winell <nilsson.hen...@gmail.com>wrote:

> Janh,
>
> Janh Anni skrev 2013-06-01 04:27:
>
>> Hello peter,
>>
>>
>> Thanks for the comment.  wilcox.exact is simpler as you pointed out but
>> the
>> fact that it is no longer being developed is somewhat concerning.
>>
>
> Admittedly, 'coin' is being actively developed and has a lot more bells
> and whistles.  But for something as simple as this, that wouldn't bother me
> at all.  In any case, the 'exactRankTests' package still gets bug fixes and
> the algorithm used in the Wilcoxon case is exactly the same for both
> packages.
>
> However, if you want to stay with 'coin' you can just wrap up Greg's
> proposal in a function:
>
> wilcox_test.default <- function(x, y, ...) {
>     data <-
>         data.frame(values = c(x, y),
>                    group = rep(c("x", "y"), c(length(x), length(y))))
>     wilcox_test(values ~ group, data = data, ...)
> }
>
> Assuming that both 'coin' and 'exactRankTests are loaded, we can now check
> that it works:
>
> > set.seed(123)
> > x <- rpois(10, 3)
> > y <- rpois(11, 3.1)
> >
> > wilcox_test(x, y, alternative = "less", distribution = "exact")
>
>         Exact Wilcoxon-Mann-Whitney Test
>
> data:  values by group (x, y)
> Z = -0.0715, p-value = 0.4844
> alternative hypothesis: true mu is less than 0
>
> > wilcox.exact(x, y, alternative = "less")
>
>         Exact Wilcoxon rank sum test
>
> data:  x and y
> W = 54, p-value = 0.4844
> alternative hypothesis: true mu is less than 0
>
>
> HTH,
> Henric
>
>
>
>
>> Regards
>> Janh
>>
>>
>> On Fri, May 31, 2013 at 6:50 PM, Peter Ehlers <ehl...@ucalgary.ca> wrote:
>>
>>  On 2013-05-30 20:20, Janh Anni wrote:
>>>
>>>  Hello Greg,
>>>>
>>>> Thank you so much for your kind assistance.  It looks like there's no
>>>> way
>>>> around using the formula format.  I longed in vain for a simpler script
>>>> more like the wilcox.test format.  Thanks again.
>>>>
>>>> Janh
>>>>
>>>>
>>> I don't see why the formula syntax would be a problem, but to avoid it
>>> you could use exactRankTests::wilcox.exact() which, I believe, was
>>> written by the same author. It uses the same syntax as wilcox.test().
>>> Note, though, that the package is no longer
>>> being developed.
>>>
>>> Peter Ehlers
>>>
>>>
>>>
>>>
>>>> On Thu, May 30, 2013 at 6:21 PM, Greg Snow <538...@gmail.com> wrote:
>>>>
>>>>   Ok, it looks like the function mainly works through the formula
>>>> syntax.
>>>>
>>>>>    It still would have been nice to have a reproducible example of what
>>>>> your
>>>>> data may look like, but I can show an example with simulated x and y:
>>>>>
>>>>>   x <- rpois(10, 3)
>>>>>
>>>>>> y <- rpois(11, 3.1)
>>>>>> mydf <- data.frame( vals = c(x,y),
>>>>>>
>>>>>>  +   group=rep( c('x','y'), c( length(x), length(y) ) ) )
>>>>>
>>>>>  wilcox_test( vals ~ group, data=mydf )
>>>>>>
>>>>>>
>>>>>           Asymptotic Wilcoxon-Mann-Whitney Test
>>>>>
>>>>> data:  vals by group (x, y)
>>>>> Z = -1.3718, p-value = 0.1701
>>>>> alternative hypothesis: true mu is not equal to 0
>>>>>
>>>>> Does that help?  (maybe I am the heedlessness theorist after all)
>>>>>
>>>>>
>>>>>
>>>>> On Thu, May 30, 2013 at 4:14 PM, Janh Anni <annij...@gmail.com> wrote:
>>>>>
>>>>>   I thought (hoped) wilcox_test(x,y) would do it but it doesn't and the
>>>>>
>>>>>> package maintainer says the data have to be rearranged but does not
>>>>>> specify
>>>>>> how.  Thanks
>>>>>>
>>>>>> Janh
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Thu, May 30, 2013 at 6:05 PM, Greg Snow <538...@gmail.com> wrote:
>>>>>>
>>>>>>   What have you tried so far?  Have you read the help page? have you
>>>>>> run
>>>>>>
>>>>>>> the examples on that page?
>>>>>>>
>>>>>>> I would expect that it is something as simple as
>>>>>>>
>>>>>>> library(coin)
>>>>>>> wilcox_test(x,y)
>>>>>>>
>>>>>>> or
>>>>>>>
>>>>>>> wilcox_test( y ~ group )
>>>>>>>
>>>>>>> But you should trust the help page more than the expectations of
>>>>>>> someone
>>>>>>> who has not read it recently (see fortune(14)).
>>>>>>>
>>>>>>> If that does not answer your question then give us more detail on
>>>>>>> what
>>>>>>> you tried, what you expected the results to be, what the results
>>>>>>> actually
>>>>>>> were, and how they differed.  Without that information we have to
>>>>>>> resort to
>>>>>>> mind reading and the current implementation of the esp package is
>>>>>>> still
>>>>>>> very pre-alpha, it suggests that the answer to your question is:
>>>>>>>
>>>>>>>   esp()
>>>>>>>
>>>>>>>>
>>>>>>>>  [1] "selflessly vigilantly pigeon theorist heedlessness"
>>>>>>>
>>>>>>> Which is either much to profound for the likes of me to understand or
>>>>>>> is
>>>>>>> complete gibberish (which is only slightly less helpful than an
>>>>>>> overly
>>>>>>> general question without a reproducible example).
>>>>>>>
>>>>>>>
>>>>>>> On Thu, May 30, 2013 at 2:07 PM, Janh Anni <annij...@gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>   Dear All,
>>>>>>>
>>>>>>>>
>>>>>>>> I have two simple data samples (no groups or factors, etc.) and
>>>>>>>> would
>>>>>>>> just
>>>>>>>> like to compute the two-sample Wilcoxon Rank Sum test using the
>>>>>>>> wilcox_test
>>>>>>>> function contained in the coin package, which is reportedly better
>>>>>>>> than
>>>>>>>> the
>>>>>>>> regular wilcox.test function because it performs some adjustment for
>>>>>>>> ties.
>>>>>>>> Would anyone know how to craft a script to perform this task?  Much
>>>>>>>> appreciated.
>>>>>>>>
>>>>>>>> Janh
>>>>>>>>
>>>>>>>>           [[alternative HTML version deleted]]
>>>>>>>>
>>>>>>>> ______________________________****________________
>>>>>>>> R-help@r-project.org mailing list
>>>>>>>> https://stat.ethz.ch/mailman/****listinfo/r-help<https://stat.ethz.ch/mailman/**listinfo/r-help>
>>>>>>>> <https://stat.**ethz.ch/mailman/listinfo/r-**help<https://stat.ethz.ch/mailman/listinfo/r-help>
>>>>>>>> >
>>>>>>>>
>>>>>>>> PLEASE do read the posting guide
>>>>>>>> http://www.R-project.org/****posting-guide.html<http://www.R-project.org/**posting-guide.html>
>>>>>>>> <http://www.**R-project.org/posting-guide.**html<http://www.R-project.org/posting-guide.html>
>>>>>>>> >
>>>>>>>>
>>>>>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Gregory (Greg) L. Snow Ph.D.
>>>>>>> 538...@gmail.com
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>> --
>>>>> Gregory (Greg) L. Snow Ph.D.
>>>>> 538...@gmail.com
>>>>>
>>>>>
>>>>>           [[alternative HTML version deleted]]
>>>>
>>>> ______________________________****________________
>>>> R-help@r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/****listinfo/r-help<https://stat.ethz.ch/mailman/**listinfo/r-help>
>>>> <https://stat.**ethz.ch/mailman/listinfo/r-**help<https://stat.ethz.ch/mailman/listinfo/r-help>
>>>> >
>>>> PLEASE do read the posting guide http://www.R-project.org/**
>>>> posting-guide.html 
>>>> <http://www.R-project.org/**posting-guide.html<http://www.R-project.org/posting-guide.html>
>>>> >
>>>>
>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>
>>>>
>>>>
>>>
>>>
>>         [[alternative HTML version deleted]]
>>
>> ______________________________**________________
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
>> PLEASE do read the posting guide http://www.R-project.org/**
>> posting-guide.html <http://www.R-project.org/posting-guide.html>
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to