validate: validate

Description Usage Arguments Value Examples

View source: R/validate_OC.R

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
library(OncoCast)
test <- OncoCast(data=survData,formula = Surv(time,status)~.,
method = "LASSO",runs = 30,
save = FALSE,nonPenCol = NULL,cores =1)
results <- getResults_OC(OC_object=test$LASSO,data=survData,
cuts=c(0.2,0.4,0.6,0.8),
geneList=NULL,mut.data=TRUE)
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)~.)

AxelitoMartin/OncoCast documentation built on Dec. 13, 2020, 6:46 a.m.