Data Simulation Function
Usage
sim_SCR_data(
data_size,
ncol_gene_mat,
feat_m,
feat_d,
mu_cen,
cov,
lam_m = 1/15,
lam_d = 1/20,
norm_vcov = c(1, 0.5, 0.5, 1)
)
Arguments
- data_size
an integer giving the simulated sample size
N
- ncol_gene_mat
an integer giving the simulated number of genomic covariates
P
- feat_m
a function that transforms the genomic features into the signal for the metastasis process. This function should a matrix of dimensions
N X P
as its only argument.- feat_d
a function that transforms the genomic features into the signal for the death process. This function should a matrix of dimensions
N X P
as its only argument.- mu_cen
mean of the exponential censoring process
- cov
the correlation between the genomic covariates
- lam_m
baseline hazard constant for metastasis process. Default is
1/15
.- lam_d
baseline hazard constant for death process. Default is
1/20
.- norm_vcov
vector of length 4 of correlation between errors between the two processes on the normal scale before being complementary-log-log-transformed. Default is
c(1,.5,.5,1)
.
Value
a data.frame
with columns:
XR
:time to recurrence / death / censoring
XD
:time to death / censoring
DeltaR
:Indicator of censoring (0), recurrence (1), or death (2) for this earliest time
XR
DeltaD
:Indicator of censoring (0) or death (1)
XPFS
:time to recurrence / death / censoring (=
XR
)DeltaPFS
:Indicator of censoring (0) or recurrence or death, whichever came first (1)
Z_1,...,Z_P
:genomic variables
Examples
feat_m_fun <- function(X){
sin(X[,1]+X[,2]^2)-1
}
feat_d_fun <- function(X){
(X[,4]-X[,5])^2/8
}
mydata <- sim_SCR_data(data_size = 400, ncol_gene_mat = 20, feat_m = feat_m_fun,
feat_d = feat_d_fun, mu_cen = 30, cov=0.5)
head(mydata)
#> XR XD DeltaR DeltaD XPFS DeltaPFS Z1 Z2
#> 1 0.5709861 2.4814082 1 1 0.5709861 1 1.6770652 1.5743362
#> 2 1.5163527 1.5163527 2 1 1.5163527 1 -1.2338608 0.5868927
#> 3 0.1652146 0.1652146 2 1 0.1652146 1 0.5507934 2.2766250
#> 4 0.2217832 3.4893375 1 1 0.2217832 1 -1.7088872 -0.9537585
#> 5 9.0683920 9.0683920 0 0 9.0683920 0 -0.8922172 -2.7517212
#> 6 3.2246105 9.1677755 1 1 3.2246105 1 0.2947760 -0.5452931
#> Z3 Z4 Z5 Z6 Z7 Z8
#> 1 0.6266552 0.8544716 0.7227750 1.92555530 1.1569134 0.61924342
#> 2 -0.5375776 -0.4399051 -0.2058055 0.06906448 -1.6975463 0.07777580
#> 3 0.6102380 1.7535212 1.6319498 0.85224296 0.2973967 -0.02851258
#> 4 -1.5727263 -2.4843322 -0.6132310 -1.32448233 -0.2335242 -1.55701726
#> 5 -1.4866415 -1.5619629 -1.8428550 -2.16518436 -1.9271633 -2.33975721
#> 6 0.3670728 0.4162541 0.1771264 -1.40868217 -0.4391026 0.70198096
#> Z9 Z10 Z11 Z12 Z13 Z14
#> 1 0.2803083 -0.08408994 1.5539434 1.82080564 0.45177478 0.07200551
#> 2 -0.5754064 1.97568142 1.0432724 -0.03277913 0.09001714 -0.33355545
#> 3 0.1124842 0.40535076 0.6198172 1.63618018 1.61638878 1.04235854
#> 4 -0.2614641 -1.16118224 -1.1061088 -0.99850346 -0.49357495 -0.32581411
#> 5 -0.4264133 -1.20871035 -1.8618217 -1.14293186 -1.50403067 -2.37417735
#> 6 0.9690748 -0.81080633 -0.4232620 -1.20023125 0.94697504 0.15197085
#> Z15 Z16 Z17 Z18 Z19 Z20
#> 1 1.2168023 0.78918968 0.9433729 1.31135049 -0.23626618 -0.1302273
#> 2 -0.1253046 0.09027784 -0.9876235 0.01601721 -0.73692806 -1.0247439
#> 3 0.4852867 0.33546128 0.7489955 0.89570857 0.43647691 1.1516940
#> 4 0.4369060 -0.38818449 -1.1178843 -0.47653437 -1.15930012 -1.6188139
#> 5 -1.1207373 -0.76696977 -2.5409119 -1.76063718 -1.72002916 -0.6382582
#> 6 0.8285057 -0.26599286 0.4243545 0.39563953 -0.05744887 0.7798729
## how many experience both events
mean(mydata[,"DeltaR"]==1 & mydata[,"DeltaD"]==1)
#> [1] 0.4175
## how many only recur
mean(mydata[,"DeltaR"]==1 & mydata[,"DeltaD"]==0)
#> [1] 0.255
## how many only die
mean(mydata[,"DeltaR"]==2 & mydata[,"DeltaD"]==1)
#> [1] 0.175
## how many are censored
mean(mydata[,"DeltaR"]==0 & mydata[,"DeltaD"]==0)
#> [1] 0.1525