boost-R / mboost

Boosting algorithms for fitting generalized linear, additive and interaction models to potentially high-dimensional data. The current relase version can be found on CRAN (http://cran.r-project.org/package=mboost).
73 stars 27 forks source link

small problem with IPCweights... #54

Closed mayrandy closed 8 years ago

mayrandy commented 8 years ago

Following code (similar to the one we use to generate survival data for mboost checks) breaks:

x1 <- rnorm(100)
x2 <- x1 + rnorm(100)
X <- cbind(x1, x2)
beta <- c(1, 0.5)
survtime <- exp(X%*%beta)
event <- rep(c(TRUE, FALSE), 50)
IPCweights(Surv(survtime, event))

Error in [.default`(x, , "time") : subscript out of bounds

The reason seems to be, that the object Surv(survtime, event) does not include the appropriate names:

 x <- Surv(survtime, event)
 dimnames(x)[[2]]
[1]  ""       "status"

and therefore

 x[, "time"]

Error in [.default`(x, , "time") : subscript out of bounds

as we do inside IPCweights() gives the error .