Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The result was big difference between R survival when no event in one group. #35

Open
sqf10000 opened this issue Mar 25, 2022 · 1 comment

Comments

@sqf10000
Copy link

sqf10000 commented Mar 25, 2022

coxph_testdata.csv

coxph result for R:

z:0.004 
Pr(>|z|):0.997
Warning message:
In fitter(X, Y, istrat, offset, init, control, weights = weights,  :
  Loglik converged before variable  1 ; coefficient may be infinite. 

coxph result for julia:

z:Inf
Pr(>|z|):<1e-99

Why is there such a big difference between the R and julia and which one should be trusted?

##################the test run code for R and julia################
R code
library(survival)
test1 <- read.csv(file = '/Users/guan.wang/Downloads/coxph_testdata.csv',sep="\t")
re<-coxph(Surv(survivalMonth, survivalEvent) ~ myclass, test1)
summary(re)
##R outputs:
Warning message:
In fitter(X, Y, istrat, offset, init, control, weights = weights,  :
  Loglik converged before variable  1 ; coefficient may be infinite. 
> summary(re)
Call:
coxph(formula = Surv(survivalMonth, survivalEvent) ~ myclass, 
    data = test1)

  n= 148, number of events= 41 

             coef exp(coef)  se(coef)     z Pr(>|z|)
myclass 1.948e+01 2.885e+08 4.568e+03 0.004    0.997

        exp(coef) exp(-coef) lower .95 upper .95
myclass 288459349  3.467e-09         0       Inf

Concordance= 0.623  (se = 0.02 )
Likelihood ratio test= 23.75  on 1 df,   p=1e-06
Wald test            = 0  on 1 df,   p=1
Score (logrank) test = 13.8  on 1 df,   p=2e-04
#########
## julia  code:
rossi = CSV.read("coxph_testdata.csv", DataFrame,header=1,delim="\t",)
rossi.event = EventTime.(rossi.survivalMonth, rossi.survivalEvent .== 1)
outcome = coxph(@formula(event ~ myclass), rossi)
outcome_coefmat = coeftable(outcome)
print(outcome_coefmat)
## julia  output:
         Estimate  Std.Error  z value  Pr(>|z|)
───────────────────────────────────────────────
myclass   35.4617        0.0      Inf    <1e-99
───────────────────────────────────────────────
@sqf10000
Copy link
Author

Or can julia coxph provide the Likelihood ratio test,Wald test ,Score (logrank) test results like R?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant