Description Usage Arguments Value Examples
View source: R/simulate_survival_cox.R
This function allows you to simulate stratified survival data.
1 2 3 4 5 6 |
true_beta |
Contains true parameter values to simulate from. |
base_hazard |
Baseline hazard distribution. Default is set to exponential, "weibull" is also available. |
base_hazard_scale |
Scale parameter used if baseline hazard distribution is weibull. |
base_hazard_shape |
Shape parameter used if baseline hazard distribution is weibull. |
num_strata |
Number of strata to simulate, default is 10. |
input_strata_size |
Average sample size of each stratum, default is 50. |
z_matrix |
Covariate matrix. Default is NULL, will be simulated as multivariate normal if not provided. |
cov_structure |
Covariance structure. Default is "diag" could also be "ar" for AR1 or "cs" for compound symmetry. |
block_size |
Block size used for covariance structure. Default value is 1. |
rho |
Correlation parameter used for "ar" or "cs" covariance structure. |
censor_dist |
Censoring distribution, default is "unif" for uniform distribution. Exponential distribution is used if set to "exp" |
censor_const |
Parameter used to specify the censoring distribution. Default value is 5. |
tau |
Positive scalar used to represent possible follow up time. Default is Inf. |
normalized |
Logical parameter representing whether or not the covariate matrix should be normalized. Default is FALSE. |
a matrix with survival time (time), event indicator (delta), stratification variable (strata_idx), a vector for each variable specified by the true_beta.
1 2 3 4 5 6 | toyData <- simulate_survival_cox(true_beta=c(1,1,1,1,1,0,0,0,0,0),
base_hazard="weibull", base_hazard_scale=rep(1,5), base_hazard_shape=rep(2,5),
num_strata=5, input_strata_size=100, cov_structure="diag", block_size=2,
rho=0.3, censor_dist="unif", censor_const=5, tau=Inf, normalized=FALSE)
any(duplicated(toyData$time))
z <- as.matrix(toyData[,-c(1,2,3)])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.