simulate.safeDesign | R Documentation |
Applied to a 'safeDesign' object this function empirically shows the performance of safe experiments under optional stopping.
## S3 method for class 'safeDesign' simulate( object, nsim = nSim, seed = NULL, deltaTrue = NULL, muGlobal = 0, sigmaTrue = 1, lowN = 3, safeOptioStop = TRUE, freqOptioStop = FALSE, nPlanFreq = NULL, logging = TRUE, pb = TRUE, nSim = 1, ... )
object |
A safeDesign obtained obtained from |
nsim |
integer, formally the number of iterations, but by default nsim=nSim |
seed |
integer, seed number. |
deltaTrue |
numeric, if NULL, then the minimally clinically relevant standardised effect size is used as the true data generating effect size deltaTrue. |
muGlobal |
numeric, the true global mean of a paired or two-sample t-test. Its value should not matter for the test. This parameter is treated as a nuisance. |
sigmaTrue |
numeric > 0,the true standard deviation of the data. Its value should not matter for the test.This parameter treated is treated as a nuisance. |
lowN |
integer that defines the smallest n of our search space for n. |
safeOptioStop |
logical, |
freqOptioStop |
logical, |
nPlanFreq |
the frequentist sample size(s) to plan for. Acquired from |
logging |
logical, if |
pb |
logical, if |
nSim |
integer, number of iterations. |
... |
further arguments to be passed to or from methods. |
Returns an object of class "safeTSim". An object of class "safeTSim" is a list containing at least the following components:
the planned sample size(s).
the value of the true standardised effect size (test-relevant parameter) provided by the user.
the true global mean of a paired or two-sample t-test (nuisance parameter) provided by the user.
if TRUE
then paired t-test.
any of "twoSided", "greater", "less" provided by the user.
the smallest number of samples (first group) at which monitoring of the tests begins.
the number of replications of the experiment.
the tolerable type I error provided by the user.
the tolerable type II error provided by the user.
any of "oneSample", "paired", "twoSample" provided by the user.
the parameter (point prior) used in the safe test derived from the design.
Acquired from designSafeT()
.
the frequentist planned sample size(s). Acquired from designFreqT
()
list with the simulation results of the safe test under optional stopping.
list with the simulation results of the frequentist test under optional stopping.
# Design safe test alpha <- 0.05 beta <- 0.20 deltaMin <- 1 designObj <- designSafeT(deltaMin, alpha=alpha, beta=beta, nSim=100) # Design frequentist test freqObj <- designFreqT(deltaMin, alpha=alpha, beta=beta) # Simulate based on deltaTrue=deltaMin simResultsDeltaTrueIsDeltaMin <- simulate(object=designObj, nSim=100) # Simulate based on deltaTrue > deltaMin simResultsDeltaTrueIsLargerThanDeltaMin <- simulate( object=designObj, nSim=100, deltaTrue=2) # Simulate under the null deltaTrue = 0 simResultsDeltaTrueIsNull <- simulate( object=designObj, nSim=100, deltaTrue=0) simulate(object=designObj, deltraTrue=0, nSim=100, freqOptioStop=TRUE, nPlanFreq=freqObj$nPlan)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.