run_simulations_2x2_rom | R Documentation |
This function simulates a 2x2 crossover trial across multiple iterations. It evaluates equivalence across multiple endpoints using the Ratio of Means (ROM) test.
run_simulations_2x2_rom(
nsim,
n,
muT,
muR,
SigmaW,
lequi_tol,
uequi_tol,
alpha,
sigmaB,
dropout,
Eper,
Eco,
typey,
adseq,
k,
arm_seed
)
nsim |
Integer. The number of simulations to run. |
n |
Integer. The sample size per period. |
muT |
Numeric vector. Mean outcomes for the active treatment. |
muR |
Numeric vector. Mean outcomes for the reference treatment. |
SigmaW |
Numeric matrix. Within-subject covariance matrix for endpoints. |
lequi_tol |
Numeric vector. Lower equivalence thresholds for each endpoint. |
uequi_tol |
Numeric vector. Upper equivalence thresholds for each endpoint. |
alpha |
Numeric vector. Significance levels for hypothesis testing across endpoints. |
sigmaB |
Numeric. Between-subject variance for the crossover model. |
dropout |
Numeric vector of size 2. Dropout rates for each sequence. |
Eper |
Numeric vector. Expected period effects for each sequence. |
Eco |
Numeric vector. Expected carryover effects for each sequence. |
typey |
Integer vector indicating the classification of each endpoint, where |
adseq |
Logical. If |
k |
Integer. Minimum number of endpoints required for equivalence. |
arm_seed |
Integer vector. Random seed for each simulation. |
This function evaluates equivalence using the Ratio of Means (ROM) test.
Equivalence is determined based on predefined lower lequi_tol
and upper uequi_tol
equivalence thresholds,
and hypothesis testing is conducted at the specified significance level alpha
.
If adseq
is TRUE
, primary endpoints must establish equivalence before secondary endpoints are evaluated.
The sample size per period is adjusted based on dropout rates, ensuring valid study conclusions.
The simulation incorporates within-subject correlation using SigmaW
and accounts for between-subject variance with sigmaB
.
Expected period effects Eper
and carryover effects Eco
are included in the model.
A fixed random seed arm_seed
is used to ensure reproducibility across simulations.//'
A numeric matrix where each column stores simulation results:
The first row (totaly
) represents the overall equivalence decision (1 = success, 0 = failure).
Subsequent rows contain equivalence decisions per endpoint,
mean estimates for the treatment group, mean estimates for the reference group,
standard deviations for treatment, and standard deviations for reference.
@author Thomas Debray tdebray@fromdatatowisdom.com
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.