getSimulationResults: Simulate trials

View source: R/getSimulationResults.R

getSimulationResultsR Documentation

Simulate trials

Description

Simulate the rejection probability for a given design and alternative.

Usage

getSimulationResults(
  design,
  maxNumberOfIterations = 10000,
  alternative,
  seed = NULL
)

Arguments

design

An object of class TrialDesignOptimalConditionalError created by getDesignOptimalConditionalErrorFunction(). Contains all necessary arguments to calculate the optimal conditional error function for the specified case.

maxNumberOfIterations

Number of trials to be simulated.

alternative

Assumed relative effect size.

seed

An optional seed for reproducibility.

Details

Simulates the probabilities of overall rejection as well as early futility and early efficacy for the provided scenario and design. This is done by generating random normally distributed test statistics and calculating their p-values.

Value

An object of class SimulationResultsOptimalConditionalError containing the simulation results.

See Also

getDesignOptimalConditionalErrorFunction(), getOverallPower()

Examples


design <- getDesignOptimalConditionalErrorFunction(
 alpha = 0.025, alpha1 = 0.001, alpha0 = 0.5, delta1 = 0.25,
 useInterimEstimate = FALSE,
 conditionalPower = 0.9, likelihoodRatioDistribution = "maxlr",
 firstStageInformation = 10
)

# Simulate under the null hypothesis and for a mean difference of 0.5
getSimulationResults(
 design = design, alternative = c(0, 0.5)
)



optconerrf documentation built on Sept. 9, 2025, 5:29 p.m.