[R] (no subject)

Adaikalavan Ramasamy ramasamy at cancer.org.uk
Thu Nov 4 00:50:28 CET 2004


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
>




More information about the R-help mailing list