Dieter Menne
2009-Apr-14 16:06 UTC
[R] Function call error in cph/survest (package Design)
Dear UseR, I do not know if this a problem with me, my data or cph/survest in package design. The example below works with a standard data set, but not with my data, but I cannot locate the problem. Note that I am using an older package of survival to avoid a problem with the newly renamed function in survival meeting Design. Dieter # First, check standard example to make sure library(Design) data(ovarian) dd = datadist(ovarian) options(datadist="dd") ovarian$rx = as.factor(ovarian$rx) cp = cph(Surv(futime,fustat)~rx,data=ovarian,surv=TRUE,x=TRUE,y=TRUE) summary(cp) # works ok survest(cp,levels(ovarian$rx),times=500) # Small data set, 223 rows, 3650 bytes cc = read.table("http://www.menne-biomed.de/uni/cc.csv",header=TRUE) #cc = read.table("cc.csv",header=TRUE) dd = datadist(cc) cp = cph(Surv(DaysToEvent,event)~ITTGroup,data=cc,surv=TRUE,x=TRUE,y=TRUE) survest(cp,levels(cc$ITTGroup),times=100) #Error in survfit.cph(list(coefficients = c(0.435291247251185, -0.143015493753166 : # NA/NaN/Inf in foreign function call (arg 13) #In addition: Warning message: #NAs introduced by coercion #------------------- summary(cc) DaysToEvent event ITTGroup Min. : 3.0 Mode :logical Anti:76 1st Qu.: 22.0 FALSE:89 Con :76 Median : 70.0 TRUE :134 Pla :71 Mean :108.3 NA's :0 3rd Qu.:224.0 Max. :261.0 #-------------------------------- > sessionInfo() R version 2.9.0 Under development (unstable) (2009-03-13 r48127) i386-pc-mingw32 locale: LC_COLLATE=German_Germany.1252;LC_CTYPE=German_Germany.1252;LC_MONETARY=Germ an_Germany.1252;LC_NUMERIC=C;LC_TIME=German_Germany.1252 attached base packages: [1] splines stats graphics grDevices datasets utils methods base other attached packages: (Note: older version of survival to avoid problems with Design) [1] Design_2.1-2 survival_2.34 Hmisc_3.5-2 loaded via a namespace (and not attached): [1] cluster_1.11.12 grid_2.9.0 lattice_0.17-20 tools_2.9.0>
Dieter Menne
2009-Apr-15 07:08 UTC
[R] Function call error in cph/survest (package Design)
Dieter Menne wrote:> > I do not know if this a problem with me, my data or cph/survest in package > design. The example below works with a standard data set, but not with my > data, but I cannot locate the problem. >Dieter Menne found out after hours, that in one case and explicit cast is required, but none in the other, and has no idea why. #--------------------------------------- library(Design) data(ovarian) dd = datadist(ovarian) options(datadist="dd") ovarian$rx = as.factor(ovarian$rx) cp = cph(Surv(futime,fustat)~rx,data=ovarian,surv=TRUE,x=TRUE,y=TRUE) summary(cp) survplot(cp,rx=NA) # works ok, without casting to a data frame survest(cp,newdata=levels(ovarian$rx),what="survival",times=500) # Small data set, 223 rows, 3650 bytes cc = read.table("http://www.menne-biomed.de/uni/cc.csv",header=TRUE) #cc = read.table("cc.csv",header=TRUE) dd = datadist(cc) cp = cph(Surv(DaysToEvent,event)~ITTGroup,data=cc,surv=TRUE,x=TRUE,y=TRUE) survplot(cp,ITTGroup=NA) summary(cp) survest(cp,newdata=levels(cc$ITTGroup),times=200) #Error in survfit.cph(list(coefficients = c(0.435291247251185, -0.143015493753166 : # NA/NaN/Inf in foreign function call (arg 13) #In addition: Warning message: #NAs introduced by coercion # Works when explicitly converted to a data frame survest(cp,newdata=data.frame(ITTGroup=levels(cc$ITTGroup)),times=200) -- View this message in context: http://www.nabble.com/Function-call-error-in-cph-survest-%28package-Design%29-tp23044736p23053729.html Sent from the R help mailing list archive at Nabble.com.
Possibly Parallel Threads
- How do i compute predicted failure time from a cox model?
- survest() for cph() in Design package
- R 2.8.1 and 2.9 alpha crash when running survest of Design package
- survest and survfit.coxph returned different confidence intervals on estimation of survival probability at 5 year
- Problem with plotting survival predictions from cph model