Description Usage Arguments Examples
View source: R/utility_functions.R
Simulate survival data given design matrix and covariates (betas).
1 2 | surv_data_simulation(lambda,gamma,x,betas=NULL, dropoutrate=0,
gammac=1,censordist='exponential',timeinterval=NULL,trt_timeinterval=NULL)
|
lambda |
lambda for event hazard function |
gamma |
gamma for event hazard function |
x |
design matrix |
betas |
coefficients for the covariates. The length of betas should be the same of number of columns of x |
dropoutrate |
Patient dropout rate with range [0,1). If dropoutrate contains only one number. The program will control the dropout rate at population level(treatment + control). If dropoutrate contains two numbers (ie. c(0.2,0.1)), the program will control the dropout rate of control and treatment arm seperately, with the first dropout rate number for control and the second number for treatment. Default value is "0" (no dropout) |
gammac |
gamma for censor hazard function. Default is 1 (exponential) |
censordist |
censor hazard distribution. Default is exponential |
timeinterval |
time intervals if the baseline hazard function is piecewise. |
trt_timeinterval |
Time windows for piecewise hazard ratios |
1 2 3 4 5 | N<-400
x<-data.frame(arm=rbinom(N,1,0.5), factor1=rbinom(N,1,0.7), factor2=rbinom(N,1,0.8))
betas<-c(arm=-0.35667,factor1=0.3,factor2=-0.1)
data<-surv_data_simulation(lambda=0.2,gamma=2,x=x,betas=betas,dropoutrate=0.2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.