[R] Function call error in cph/survest (package Design)
Dieter Menne
dieter.menne at menne-biomed.de
Wed Apr 15 09:08:13 CEST 2009
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.
More information about the R-help
mailing list