This function let's user validate an OncoCast model generated in a new cohort which has it's own survival data.

validate(
  OC_object,
  Results,
  in.data,
  formula,
  out.ties = FALSE,
  limit = NULL,
  plot.cuts = TRUE,
  ...
)

Arguments

OC_object

Output of the OncoCast function.

Results

A getResults_OC object that you wish to validate

in.data

New data set containing the information of the incoming patients. Should be a dataframe with patients as rows and features as columns.

formula

the formula to be used for validation

out.ties

phcpe argument to calculate the concordance index. If out.ties is set to FALSE, pairs of observations tied on covariates will be used to calculate the CPE. Otherwise, they will not be used.

limit

Optional numerical argument to set a time limit on the KM plot

plot.cuts

Boolean specifying if lines should be added to risk histogram to indicate where the cuts were performed

...

futher arguments applicable in ggsurvplot

Value

data.out : The data frame inputted in the function with an additional column giving the predicted risk score of the incoming patients.

RiskHist : A histogram of the distribution of the risk scores of patients in the given dataset.

Examples

library(OncoCast) test <- OncoCast(data=survData,formula = Surv(time,status)~., method = "LASSO",runs = 30, save = FALSE,nonPenCol = NULL,cores =1)
#> Warning: We do not recommend using a number of cross-validation/bootstraps lower than 50.
#> [1] "Data check performed, ready for analysis." #> [1] "LASSO SELECTED"
results <- getResults_OC(OC_object=test$LASSO,data=survData, cuts=c(0.2,0.4,0.6,0.8), geneList=NULL,mut.data=TRUE)
#> Warning: Vectorized input to `element_text()` is not officially supported. #> Results may be unexpected or may change in future versions of ggplot2.
#> Using Risk as id variables
new.data <- as.data.frame(matrix(rbinom(5*20,1,0.5),nrow=20,ncol = 5)) colnames(new.data) <- c("ImpCov1","ImpCov2","ImpCov3","ImpCov4","Cov7") rownames(new.data) <- paste0("Incoming",1:20) # add time component coefs <- c(1.2,1.3,-1.5,-1,-1,rep(0,ncol(new.data)-5)) mu <- as.vector(coefs %*% t(new.data)) n = nrow(row(new.data)) time <- rexp(n,exp(mu))*12 c <- runif(n,0,as.numeric(quantile(time,0.8))) status <- ifelse(time < c , 1,0) time <-pmin(time,c) new.data$time <- time new.data$status <- status validation <- validate(OC_object=test$LASSO,Results=results, in.data=new.data, formula=Surv(time,status)~.)
#> Warning: Loglik converged before variable 2,3,4 ; coefficient may be infinite.
#> Warning: Vectorized input to `element_text()` is not officially supported. #> Results may be unexpected or may change in future versions of ggplot2.
#> Warning: Loglik converged before variable 2,3,4 ; coefficient may be infinite.