Nothing
rf.time <- function(times, failures, group=NULL, cov.quanti=NULL, cov.quali=NULL,
data, nodesize, mtry,
ntree){
.outcome <- paste("Surv(", times, ",", failures, ")")
if(!(is.null(group))){
if(is.null(cov.quanti)==F & is.null(cov.quali)==F){
.f <- as.formula( paste(.outcome, "~", group, "+", paste( cov.quanti, collapse = " + "), " + ", paste(cov.quali, collapse = " + "),
collapse = " ") )
}
if(is.null(cov.quanti)==F & is.null(cov.quali)==T){
.f <- as.formula( paste(.outcome, "~", group, "+", paste( cov.quanti, collapse = " + "),collapse = " ") )
}
if(is.null(cov.quanti)==T & is.null(cov.quali)==F){
.f <- as.formula( paste(.outcome, "~", group, "+",paste(cov.quali, collapse = " + "),collapse = " ") )
}
if(is.null(cov.quanti)==T & is.null(cov.quali)==T){
.f <- as.formula( paste(.outcome, "~", group) )
}
}
else{
if(is.null(cov.quanti)==F & is.null(cov.quali)==F){
.f <- as.formula( paste(.outcome, "~", paste( cov.quanti, collapse = " + "), " + ", paste(cov.quali, collapse = " + "),
collapse = " ") )
}
if(is.null(cov.quanti)==F & is.null(cov.quali)==T){
.f <- as.formula( paste(.outcome, "~", paste( cov.quanti, collapse = " + "),collapse = " ") )
}
if(is.null(cov.quanti)==T & is.null(cov.quali)==F){
.f <- as.formula( paste(.outcome, "~", paste(cov.quali, collapse = " + "),collapse = " ") )
}
}
options(rf.cores=1, mc.cores=1)
.rf <- rfsrc(.f, data = data, nodesize = nodesize, mtry = mtry, ntree = ntree, splitrule="logrank")
#options(rf.cores=1, mc.cores=0)
#.rf <- rfsrc.fast(.f, data = data, nodesize = nodesize, mtry = mtry, ntree = ntree, splitrule="logrank", forest=TRUE)
.time <- sort(unique(data[,times]))
.pred.rf <- predict(.rf)
.survival <- cbind(rep(1, dim(.pred.rf$survival.oob)[1]), .pred.rf$survival.oob)
.time.interest <- c(0, .pred.rf$time.interest)
# CS : changement pour les predictions
idx=findInterval(.time,.time.interest)
.pred=.survival[,pmax(1,idx)]
.obj <- list(model=.rf, group=group, cov.quanti=cov.quanti, cov.quali=cov.quali,
data=data.frame(times=data[,times], failures=data[,failures], data[, !(dimnames(data)[[2]] %in% c(times, failures))]),
times=.time, predictions=.pred)
class(.obj) <- "rf.time"
return(.obj)
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.