[R-SIG-Mac] Bug in calculation with survival package

John Maindonald john.maindonald at anu.edu.au
Sat Dec 26 01:22:35 CET 2009


I get the following, both under 64-bit R and under 32-bit R, but not
under Windows 2.10.1

> fitcox <- function(n=5800){
 set.seed(37)
 yr <- sample(1840:1960, n, replace=TRUE)
 left <- factor(sample(0:1, n, replace=TRUE, prob=c(.18,.82)))
 life <- sample(19:102, n, replace=TRUE)
 dead <- sample(0:1, n, replace=TRUE)
 coxph(Surv(life, dead) ~ pspline(yr,5)+left)
}
> fitcox()
Error in if (!doing.well && old$half < 2) { : 
 missing value where TRUE/FALSE needed

6: (cfun[[1]])(parmlist[[1]], iter, iterlist[[1]], pdf[1])
5: eval(expr, envir, enclos)
4: eval(calls[i])
3: coxpenal.fit(X, Y, strats, offset, init = init, control, weights = weights, 
      method = method, row.names(m), pcols, pattr, assign)
2: coxph(Surv(life, dead) ~ pspline(yr, 5) + left) at johnm.fitcox.R#8
1: fitcox()

However fitcox(n), with n <= 2625 runs fine!

---------------------------------------------------------------------------------------
> sessionInfo()
R version 2.10.1 (2009-12-14) 
i386-apple-darwin9.8.0 

locale:
[1] C

attached base packages:
[1] splines   stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
[1] survival_2.35-7
---------------------------------------------------------------------------------------

This runs fine under Windows, for all n that i have tried.  

John Maindonald             email: john.maindonald at anu.edu.au
phone : +61 2 (6125)3473    fax  : +61 2(6125)5549
Centre for Mathematics & Its Applications, Room 1194,
John Dedman Mathematical Sciences Building (Building 27)
Australian National University, Canberra ACT 0200.
http://www.maths.anu.edu.au/~johnm



More information about the R-SIG-Mac mailing list