View source: R/simulation_functions.R
| simdataExtract | R Documentation |
Extract data created using function gsearlySimulate.
simdataExtract (simmod, simn, tlooks,
datanames=c("id", "atime", "catime", "intervention", "outcome"),
full=FALSE)
simmod |
A simulation model created using function
|
simn |
Simulation number. |
tlooks |
A vector of ordered numeric valid (i.e. a subset of those in
|
datanames |
Names of the five required data variables; participant
identifier, time-point, standardized (continuous) time-point (see
|
full |
Either |
A list containing the following components.
model |
A list of |
data |
A data frame, if |
gsearlySimulate
# For 90 percent power (pow), a call to gsearlyModel provides a feasible design
fp <- c(0.0000,0.0010,0.0250)
tn <- c(0.2400,0.7200,0.9750)
modeldesign <- gsearlyModel(rmodel="dilin", trecruit=36, s=3, tfu=c(3,6,12),
tinterims=c(18,30), pow=0.9, contrat=c(1,2), m=2,
cmodel="uniform", sd=20, rho=0.5, theta=8, fp=fp, tn=tn)
# Simulate data from this model with raw data using full=TRUE
simdata <- gsearlySimulate(mod=modeldesign, nsim=10, full=TRUE)
# Extract raw data for a single simulation
simdat1 <- simdataExtract(simdata, simn=1, tlooks=18,
full=TRUE, datanames=c("ID","Time", "cTime", "Treat", "Outcome"))
head(simdat1$data,n=20)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.