0

The Java code below reads the included R "iris" dataset, yet, although the Chi-Sq and df match, the p-value is different using Java.

In R, I'm reading the Iris table the same was as in Java, like this:

mydata <- read.table('iris.csv', sep=',', header=TRUE, stringsAsFactor=FALSE)

Running this dataset in R, the p-value is 2.2e-16, yet using the same dataset from the Java side gives me a p-value of 3.352034178317223E-20.

No idea why the p-values aren't the same given that the two other statistics are the same.

Would appreciate suggestions what might be wrong with the Java code approach below.

Thanks.


rConnection.eval("library('biotools')");

String tableRead = "read.table('iris.csv', sep=',', header=TRUE, stringsAsFactor=FALSE)";

REXP boxMResult =  rConnection.eval("boxM("+ tableRead+ "[,-5],"  + tableRead + "[, 5])");
Nisse Engström
  • 4,738
  • 23
  • 27
  • 42
Morkus
  • 517
  • 7
  • 21
  • these don't see all that different. I'm not familiar with Java, but I would guess this is a difference in how really small numbers are represented. – Benjamin Oct 20 '17 at 18:33
  • The value from R says it's "less than" the e-16. so, the number received from Java IS smaller than that. I was just wondering. Thanks for your reply. – Morkus Oct 21 '17 at 13:32

0 Answers0