Simulate data as in Fong and Gilbert (2014).
sim.fong (n, family=c("PH","PO","P2"), beta,
random.censoring=c("0%","20%","60%"), prevalence=0.1, non.adherence.ratio=0,
design=c("FULL","CC"), auxiliary=c("weak","good","excellent","none"),
seed=NULL, var.S=1, var.W=1)
integer. Sample size
string. Link functions in the semiparametric transformation model
numerical vector. Coefficients of the linear model
string. Random censoring in addition to administrative censoring
numerical. Proportion of cases among z==0 when there is no random censoring and non-adherence ratio is 0
string. Full cohort or case-cohort (finite population sampling)
string.
integer. Random generator seed
numeric. Variance of the phase II covariate s
numeric. Variance of the baseline covariate w
ratio of non-adherent
If design is FULL, returns a data frame of:
failure time
censoring time
smaller of the ft and C
event indicator
baseline covariate z
phase II covariate s
If design is CC, returns a data frame of:
failure time
censoring time
smaller of the ft and C
event indicator
baseline covariate z
phase II covariate s
baseline auxiliary covariate w
The number of rows is the size of the full cohort. Adherence ratio works as a Bernoulli variable. Prevalence is used to compute baseline hazard function based on some empirical evidence.
# NOT RUN {
dat = sim.fong(n=10000, family="PH", beta=c(log(.5), log(.7), log(1.2)), design="CC",
auxiliary="weak", seed=1, prevalence=0.1, non.adherence.ratio=0, random.censoring="0")
mean(dat$d[dat$z==0])
dat = sim.fong(n=10000, family="PH", beta=c(log(.5), log(.7), log(1.2)), design="CC",
auxiliary="weak", seed=1, prevalence=0.1, non.adherence.ratio=0.15, random.censoring="0")
sum(dat$d & !is.na(dat$s))
sum(!dat$d & !is.na(dat$s)) / sum(dat$d & !is.na(dat$s))
dat = sim.fong(n=10000, family="PH", beta=c(log(.5), log(.7), log(1.2)), design="CC",
auxiliary="weak", seed=1, prevalence=0.1, non.adherence.ratio=0.15, random.censoring="20")
sum(dat$d & !is.na(dat$s))
sum(!dat$d & !is.na(dat$s)) / sum(dat$d & !is.na(dat$s))
# }
Run the code above in your browser using DataLab