[R] (no subject)-about the waring/errors in ks.test

Adaikalavan Ramasamy ramasamy at cancer.org.uk
Thu Nov 4 13:27:07 CET 2004


[In future, please press reply all as there might be others in the
mailing list who can help you]

Without a (short) reproducible example, it would be difficult to say.

BTW, I think you have mistyped the error/warning message. Does it
actually say "cannot compute _correct_ p-value" or "cannot compute
_exact_ p-value". See example below.

> wilcox.test( 1:3, 1:10 )

        Wilcoxon rank sum test with continuity correction

data:  1:3 and 1:10
W = 4.5, p-value = 0.08964
alternative hypothesis: true mu is not equal to 0

Warning message:
Cannot compute exact p-value with ties in: wilcox.test.default(1:3,
1:10)


On Thu, 2004-11-04 at 00:31, fang lai wrote:
> Dear Adaikalavan,
>  Many thanks for your suggestions. The message 
> "cannot compute correct p-values with ties in"
> sometimes shows up as an error (in most cases I have
> small group for the test), and sometimes shows up as
> waring when I typed warning() (in most cases the group
> I am testing is relatively large). But all the data
> are from the same data set. 
>  So what is the distinction between these two?
> Many thanks,
> 
> Fang
> 
> 
> --- Adaikalavan Ramasamy <ramasamy at cancer.org.uk>
> wrote:
> 
> > Reading the posting guide will tell you (among other
> > things) to :
> >  a) use a sensible subject line
> >  b) give a reproducible example when possible
> > 
> > See other comments below.
> > 
> > On Wed, 2004-11-03 at 19:04, fang lai wrote:
> > > Hi there,
> > >  When I ran the wilcox.exact test, it always shows
> > > "number of items to replace is not a multiple of
> > > replacement length"
> > >  However, according to the help it seems to be
> > able to
> > > handle sample of different size.
> > 
> > I think the error refers to incorrect lengths during
> > assignment. See
> > example below. 
> > 
> > > aaa <- matrix( 1:4, nr=2 )
> > > aaa
> >      [,1] [,2]
> > [1,]    1    3
> > [2,]    2    4
> > > aaa[1, ]
> > [1] 1 3
> > 
> > > aaa[1, ] <- 1:3
> > Error in "[<-"(`*tmp*`, 1, , value = 1:3) :
> >     number of items to replace is not a multiple of
> > replacement length
> > 
> > Or you might be trying something like 
> > 
> > > aaa <- matrix( 1:4, nr=2 )
> > > aaa[1, ] <- wilcox.test( 1:3, 1:10 )
> > Error in "[<-"(`*tmp*`, 1, , value =
> > wilcox.test(1:3, 1:10)) :
> >     number of items to replace is not a multiple of
> > replacement length
> > 
> > 
> > Wilcoxon and all other two-group test statistics
> > (when pairing is not
> > involved) can handle groups of different size. 
> > Try wilcox.test( 1:3, 1:10 ). 
> > To extract p-value only, do wilcox.test( 1:3, 1:10
> > )$p.value
> > 
> > > What does this message indicate, and will it cause
> > a
> > > problem of the resulting p-value?
> > 
> > Not directly. You could be expecting p-values to be
> > in, say the 5th
> > column, but it might be stored elsewhere. But in
> > your case I think the
> > results will not be stored anyway.
> > 
> > >  Also, when I run the ks.test(), it shows
> > sometimes
> > > that 
> > > cannot compute correct p-values with ties in:
> > > ks.test(income.perm[(data[, 3] == 59) & (data[, 2]
> > ==
> > > 1)], income.perm[(data[,   ...
> > 
> > Is this a warning or an error ? There is a
> > distinction.
> > 
> > > And sometime it shows results and sometimes it
> > just
> > > return NULL. When it shows the results, does it
> > mean
> > > that it had some kind of continuity correction or
> > > other adjustment so that I could believe the
> > results? 
> > > Many thanks,
> > > 
> > > Fang 
> > > 
> > > 
> > > =====
> > > Lai, Fang
> > > 
> > > PhD candidate
> > > University of California, Berkeley
> > > Department of Agricultural and Resource Economics
> > > 314 Giannini Hall, Berkeley, CA 94720-3310
> > > tel: (510) 643 - 5421(O)
> > >      (510) 847 - 9811(Cell)
> > > fax: (510) 643 - 8911
> > > email: lai at are.berkeley.edu
> > > http://www.are.berkeley.edu/jobmarket/fang.html
> > > 
> > > ______________________________________________
> > > 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
> > > 
> > 
> > 
> 
> 
> =====
> Lai, Fang
> 
> PhD candidate
> University of California, Berkeley
> Department of Agricultural and Resource Economics
> 314 Giannini Hall, Berkeley, CA 94720-3310
> tel: (510) 643 - 5421(O)
>      (510) 847 - 9811(Cell)
> fax: (510) 643 - 8911
> email: lai at are.berkeley.edu
> http://www.are.berkeley.edu/jobmarket/fang.html
> 
> __________________________________________________




More information about the R-help mailing list