[R-sig-eco] data error using "npmc" package

yangwenjing yangwenjing at ibcas.ac.cn
Fri Feb 4 10:47:04 CET 2011


Dear list members:

I am using the function”npmc” (package “npmc”) to do non-parametric multiple comparison test.  But, there are always some error happened to my data. I will illustrate my problems using simulated data.

I create a data frame with four groups, and then do non-parametric pairwise comparison test among the groups.
> mydata <- data.frame( class = factor(c(rep("I", 5), rep("II", 5),rep("III",5), rep("IV", 5))),
+                     var = c(1, 1, 1, 1, 1,
+                           2, 2, 2, 2, 2,
+                           5, 5, 5, 5, 5,
+                           4, 4, 4, 4, 4))

> npmc(mydata)
Error in probval.GenzBretz(algorithm, n, df, lower, upper, infin, corr,  : 
  NAs in foreign function call (arg 2)
In addition: Warning message:
In probval.GenzBretz(algorithm, n, df, lower, upper, infin, corr,  :
  NAs introduced by coercion

But if I change one number in the third group, the error does not happen any more. 

> mydata <- data.frame( class = factor(c(rep("I", 5), rep("II", 5),rep("III",5), rep("IV", 5))),
+                     var = c(1, 1, 1, 1, 1,
+                             2, 2, 2, 2, 2,
+                             5, 5, 5, 5, 3,
+                             4, 4, 4, 4, 4))
> npmc(mydata)
$BF
  cmp gn effect   lower.cl upper.cl variance          std statistic
1 1-2 10    1.0  0.9998619 1.000138    1e-08 3.162278e-05  15811.39
2 1-3 10    1.0  0.9998619 1.000138    1e-08 3.162278e-05  15811.39
3 1-4 10    1.0  0.9998619 1.000138    1e-08 3.162278e-05  15811.39
4 2-3 10    1.0  0.9998619 1.000138    1e-08 3.162278e-05  15811.39
5 2-4 10    1.0  0.9998619 1.000138    1e-08 3.162278e-05  15811.39
6 3-4 10    0.2 -0.6732195 1.073220    4e-01 2.000000e-01     -1.50
  p.value.1s p.value.2s  zero
1  0.0000000  0.0000000  TRUE
2  0.0000000  0.0000000  TRUE
3  0.0000000  0.0000000  TRUE
4  0.0000000  0.0000000  TRUE
5  0.0000000  0.0000000  TRUE
6  0.9999252  0.6256789 FALSE

It seems hard to understand, because I only change one number in the third group. Is there anyone who can tell me the reasons?

Thanks a lot.

Regards,

Wenjing



More information about the R-sig-ecology mailing list