Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/createInterims.R
That function creates the INTERIM flag that identifies which subject is included in the analysis at every interim stage.
1 2 3 4 5 6 | createInterims(subjects,
proportion,
seed = .deriveFromMasterSeed(),
idCol = getEctdColName("Subject"),
interimCol = getEctdColName("Interim"),
method = "Sample")
|
subjects |
(Required) Vector of subjects or number of subjects |
proportion |
(Required) Vector of proportions of subjects in each interim. This is a vector of cumulative proportions |
seed |
(Optional) The random number generation seed to use. By default, this is derived from the current random seed |
idCol |
(Optional) Name of the subject column ("SUBJ" by default) |
interimCol |
(Optional) Name of the interim column ("INTERIM" by default) |
method |
(Optional) Method to use. Must be one of Sample or Proportion. Default is Sample |
If the "method" argument is set to "Sample", the interim numbers should be assigned using the following algorithm: Store the number of subjects (nSubjects) and the number of interims (nInterims) Append a zero to the start of the proportions and take differences to get a vector of "non-cumulative" probabilities Take "nSubjects" samples from the values "1" to "nInterims" with probabilities set to the derived "non-cumulative" probabilities Replace the "interim" variable with these values.
If the "method" argument is set to "Proportion", the interim numbers should be assigned using the following algorithm: Store the number of subjects (nSubjects) and the number of interims (nInterims) Convert the cumulative proportions to "non-cumulative" probabilities Allocate a "base" number of subjects to each interim (found by multiplying nSubjects by the set of probabilities, then take the floor of the resulting values) If any subjects are left at this stage, use the "sample" method (below) to allocate the remaining subjects to interims "Shuffle" the interim variable so that the results are not ordered.
A data frame containing the following variables:
SUBJ |
Subject identifier, named after |
INTERIM |
Interim flag, named after |
Mike K Smith mstoolkit@googlemail.com
1 2 3 4 5 6 7 8 9 10 11 | # first interim with 10% of the subjects
# second with 30%
# third with 60%
createInterims(100, proportion = ".1,.3,.6" )
## Not run:
## more examples in the unit tests
file.show( system.file("Runit", "runit.data.interim.R", package = "MSToolkit") )
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.