Nothing
LIB_AFTgamma <- function(times, failures, group=NULL, cov.quanti=NULL,cov.quali=NULL, data){
.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 = " ") )
}
}
.flex<-flexsurvreg(.f, data = data,
dist = "gamma",
hessian=FALSE, method="Nelder-Mead")
.flex.cum=summary(.flex, type="cumhaz", ci=FALSE)[[1]]
.H0 <- data.frame(value = .flex.cum$est, time = .flex.cum$time)
.predlist<-summary(.flex, type = "survival", newdata=data, ci = F, se=F )
.time.temp=.predlist[[1]]$time
.pred=matrix(nrow=length(.predlist), ncol=length(.predlist[[1]]$time))
for (i in 1:length(.predlist)){
.pred[i,]=.predlist[[i]]$est
}
.obj <- list(model=.flex,
library="LIB_AFTgamma",
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.temp, hazard=.H0$value, predictions=.pred)
class(.obj) <- "libsl"
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.