google-code-export / rcaller

Automatically exported from code.google.com/p/rcaller
Other
1 stars 0 forks source link

p-value does not show up in Java (calling R) output -- Java code is attached #5

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Calling survdiff returns p-value (p= 0.0653 -- see below).
But calling the same function with the same values does not return p-value:
What steps will reproduce the problem?
> library("survival")
> aml
   time status             x
1     9      1    Maintained
2    13      1    Maintained
3    13      0    Maintained
4    18      1    Maintained
5    23      1    Maintained
6    28      0    Maintained
7    31      1    Maintained
8    34      1    Maintained
9    45      0    Maintained
10   48      1    Maintained
11  161      0    Maintained
12    5      1 Nonmaintained
13    5      1 Nonmaintained
14    8      1 Nonmaintained
15    8      1 Nonmaintained
16   12      1 Nonmaintained
17   16      0 Nonmaintained
18   23      1 Nonmaintained
19   27      1 Nonmaintained
20   30      1 Nonmaintained
21   33      1 Nonmaintained
22   43      1 Nonmaintained
23   45      1 Nonmaintained
> survdiff(Surv(time,status) ~ x, data=aml, rho=0)
Call:
survdiff(formula = Surv(time, status) ~ x, data = aml, rho = 0)

                 N Observed Expected (O-E)^2/E (O-E)^2/V
x=Maintained    11        7    10.69      1.27       3.4
x=Nonmaintained 12       11     7.31      1.86       3.4

 Chisq= 3.4  on 1 degrees of freedom, p= 0.0653 

Now Java call:

mahmoud@joe-lt:~/dev/workspace/core/mapreduce/clinical/biomarker/z_LogRankTest# 
java Rcall
Available results from parser object:
[obs, exp, var, chisq, call]
<?xml version="1.0"?>
<root>
<variable name="obs" type="numeric">
    <value>7</value>
    <value>11</value>
</variable>
<variable name="exp" type="numeric">
    <value>10.6893359923007</value>
    <value>7.31066400769928</value>
</variable>
<variable name="var" type="numeric">
    <value>4.00755074593873</value>
    <value>-4.00755074593873</value>
    <value>-4.00755074593873</value>
    <value>4.00755074593873</value>
</variable>
<variable name="chisq" type="numeric">
    <value>3.3963886989776</value>
</variable>
<variable name="call" type="character">
    <value>survdiff, Surv(time, status) ~ x, 0</value>
 </variable>
</root>

What is the expected output? What do you see instead?
p= 0.0653 does not apear anywhere in Java output

What version of the product are you using? On what operating system?
Mac-OS

Original issue reported on code.google.com by mpars...@gmail.com on 20 Oct 2012 at 7:09

Attachments:

GoogleCodeExporter commented 9 years ago
OK, I found a solution,

1-pchisq(3.3963886989776,1)

will return
[1] 0.06533932

which what I was expecting (it looks pValue is a derived value).

Original comment by mpars...@gmail.com on 20 Oct 2012 at 11:13