In R, Why is the survdiff function returning the p value = 0?
1
0
Entering edit mode
4.8 years ago
Eman • 0

I want to obtain the pvalue of the three curves that are plotted. Here is the code that does a survdiff:

fitSurvDiffP <- survdiff(formula = Surv(predictI, trainD[,"Status"]) ~ cond)

predictI is the predicted time, which is just a numberic vector. trainD[,"Status"] is the status of the patient and cond is a character vector that specifies either "Low", "Med", or "High" risk.

For some reason, however, the output is p = 0. There are numbers for everything else, but I keep getting p = 0 for all 7 of my graphs.

Here's one of my outputs:

Call: survdiff(formula = Surv(predictI, trainD[, "Status"]) ~ cond)

N Observed Expected (O-E)^2/E (O-E)^2/V
cond=High 145 97 20.4 287.449 389.40

cond=Low 53 36 102.4 43.080 112.45

cond=Med 206 128 138.2 0.748 2.15

Chisq= 456 on 2 degrees of freedom, p= 0
R Survival Analysis • 2.7k views
ADD COMMENT
2
Entering edit mode
4.8 years ago

The precise answer is a bit more complicated but the way to think about it is that when using R numbers are rounded to (typically) 53 binary digits accuracy.

When your p value is very small and reaches this limit (typically smaller than 1e-16) it will be reported as zero. Hence all values less than 1e-16 will be reported as zero.

People that run into this problem end up holding two different opinions:

  • It is awesome because it takes away people's ability to sort the results by p-value.

or

  • It is much hated because it takes away people's ability to sort the results by p-value.
ADD COMMENT
1
Entering edit mode

In my experience it's a misunderstanding of what the code is trying to do. I guess goldname98 wants several different p-values, but the code is just telling him "yup, those three conditions are definitely different".

ADD REPLY
1
Entering edit mode

The issue is even more confusing since from statistical (and common sense) interpretation a value p=0 is incorrect, it cannot exist within the framework of statistics.

But that just adds to the conundrum - we have a statistical test where the result is rounded to an incorrect value...

ADD REPLY

Login before adding your answer.

Traffic: 1719 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6