Pocock and Simon design simulations {covadap} | R Documentation |
Simulations of the Pocock and Simon's minimization method
Description
Implements the Pocock and Simon's minimization method by Pocock and Simon (1975) for assigning patients to two treatments A and B by simulating the covariate profile of each patient using an existing dataset or specifying number and levels of the covariates. The procedure works with qualitative covariates only.
Usage
#With existing dataframe
PocSim.sim(data, covar = NULL, n = NULL, p = 0.85, nrep = 1000,
print.results = TRUE)
#With covariates
PocSim.sim(data = NULL, covar, n, p = 0.85, nrep = 1000,
print.results = TRUE)
Arguments
data |
a data frame or a matrix. Each row of |
covar |
either a vector or a list to be specified only if |
n |
number of patients (to be specified only if |
p |
biased coin probability for the Efron's allocation function ( |
nrep |
number of trial replications. |
print.results |
logical. If TRUE a summary of the results is printed. |
Details
This function simulates nrep
times a clinical study assigning patients to treatments A and B with the minimization method by Pocock and Simon (see PocSim
).
When covar
is provided, the function finds all the possible combination of the levels of the covariates, i.e., the strata and, at each trial replication, the patients' covariate profiles are uniformly sampled within those strata. The specification of covar
requires the specification of the number of patients n
.
When data
is provided, at each trial replication, the patients' covariate profiles are sampled from the observed strata with uniform distribution. In this case the number of patients equals the number of rows of data
.
The summary printed when print.results = TRUE
reports the averages, in absolute value, of the imbalance measures, strata imbalances and within-covariate imbalances of the nrep
trial replications. See also PocSim
.
Value
It returns an object of class
"covadapsim"
, which is a list containing the following elements:
summary.info |
|
Imbalances |
a list with the imbalance measures at the end of each simulated trial:
|
out |
For each replication returns a list of the data provided in input ( |
References
Pocock S J, Simon R. Sequential treatment assignment with balancing for prognostic factors in the controlled clinical trial. Biometrics, 1975, 31(1): 103-115.
See Also
See Also as PocSim
.
Examples
require(covadap)
# Here we set nrep = 100 for illustrative purposes,
# Set it equal to at least 5000 for more reliable Monte Carlo estimates.
### With existing dataframe
df1 <- data.frame("gender" = sample(c("female", "male"), 100, TRUE, c(1 / 3, 2 / 3)),
"age" = sample(c("18-35", "36-50", ">50"), 100, TRUE),
"bloodpressure" = sample(c("normal", "high", "hyper"), 100, TRUE),
stringsAsFactors = TRUE)
# Simulate the design
res1 <- PocSim.sim(data = df1, covar = NULL, n = NULL, p = 0.85, nrep = 100)
### With covariates
# e.g. two binary covariates and one with three levels and 100 patients
res2 <- PocSim.sim(data = NULL, covar = c(2,2,3), n = 100,
p = 0.85, nrep = 100)