simulate.data | R Documentation |
The data is simulated assuming that the response to treatment is influenced by a subset of K unknown covariates (the sensitive covariates) through the following model:
logit(p_i)= mu+lambda*t_i+gamma_1*t_i*x_i1+...+gamma_K*t_i*x_iK,
where p_i is the probability of response to treatment for the i-th patient; mu is the intercept; lambda is the treatment main effect that all patients experience regardless of the values of the covariates; t_i is the treatment that the i-th patient receives (t_i = 0 for the control arm and t_i=1 for the treatment arm); x_i1,...,x_iK are the values for the K unknown sensitive covariates; gamma_1,...,gamma_K are treatment-covariate interaction effects for the K covariates. The model assumes that there is a subset of patients (the sensitive group) with a higher probability of response when treated with the new treatment, compared with the control treatment.
## S3 method for class 'data'
simulate(
N = 1000,
L = 100,
K = 10,
rho1 = 0,
rho2 = 0,
rho0 = 0,
mu1 = 1,
mu2 = 0,
mu0 = 0,
sigma1 = 0.5,
sigma2 = 0.1,
sigma0 = 0.5,
perc.sp = 0.1,
rr.nsp.treat = 0.25,
rr.con = 0.25,
rr.sp.treat = 0.6,
runs = 1,
seed = NULL
)
N |
Number of patients. |
L |
Overall number of covariates. |
K |
Number of sensitive covariates. |
mu1, sigma1, rho1 |
Mean, sd and correlation for sensitive covariates in sensitive patients. |
mu2, sigma2, rho2 |
Correlation parameter for sensitive covariates in non-sensitive patients. |
mu0, sigma0, rho |
Correlation parameter for non-sensitive covariates in all patients. |
perc.sp |
Percentage of sensitive patients. |
rr.nsp.treat |
Response rate on the treatment arm in non-sensitive patients. |
rr.con |
Response rate on the control arm. |
rr.sp.treat |
Response rate on the treatment arm in sensitive patients. |
runs |
Number of replicates to simulate. |
seed |
A seed for the random number generator. |
A list of 3 data frames: patients, covar, response.
patients: a data frame with one row per patient and the following columns: FID (family ID), IID (individual ID), sens.true (true sensitivity indicator), treat (1 for treatment and 0 for control), rr (probability of response for a binary outcome)
covar: covariate data for L covariates
response: simulated binary responses, one column per simulation (number of columns = runs)
Svetlana Cherlin, James Wason
analyse.simdata
and cvrs.plot
functions; print
and plot
methods.
N = 400
L = 100
K=10
rho1 = 0
rho2 = 0
rho0 = 0
mu1 = 1
mu2 = 0
mu0 = 0
sigma1 = 0.5
sigma2 = 0.1
sigma0=0.5
perc.sp = 0.1
rr.nsp.treat = 0.25
rr.con = 0.25
rr.sp.treat = 0.98
runs = 10
seed = 123
datalist = simulate.data (N , L , K, rho1, rho2, rho0, mu1, mu2, mu0, sigma1, sigma2, sigma0, perc.sp, rr.nsp.treat, rr.con, rr.sp.treat, runs, seed)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.