This function simulates a parallel-group trial across multiple iterations. It evaluates equivalence across multiple endpoints using the Difference of Means (DOM) test.

run_simulations_par_dom(
  nsim,
  n,
  muT,
  muR,
  SigmaT,
  SigmaR,
  lequi_tol,
  uequi_tol,
  alpha,
  dropout,
  typey,
  adseq,
  k,
  arm_seed_T,
  arm_seed_R,
  TART,
  TARR,
  vareq
)

Arguments

nsim

Integer. The number of simulations to run.

n

Integer. The sample size per arm (before dropout).

muT

arma::vec. Mean vector for the treatment arm.

muR

arma::vec. Mean vector for the reference arm.

SigmaT

arma::mat. Covariance matrix for the treatment arm.

SigmaR

arma::mat. Covariance matrix for the reference arm.

lequi_tol

arma::rowvec. Lower equivalence thresholds for each endpoint.

uequi_tol

arma::rowvec. Upper equivalence thresholds for each endpoint.

alpha

arma::rowvec. Significance level for each endpoint.

dropout

arma::vec. Dropout rates for each arm (T, R).

typey

Integer vector indicating the classification of each endpoint, where 1 corresponds to a primary endpoint and 2 corresponds to a secondary endpoint.

adseq

Boolean. If TRUE, applies sequential (hierarchical) testing.

k

Integer. Minimum number of endpoints required for equivalence.

arm_seed_T

arma::ivec. Random seed vector for the treatment group (one per simulation).

arm_seed_R

arma::ivec. Random seed vector for the reference group (one per simulation).

TART

Double. Treatment allocation ratio (proportion of subjects in treatment arm).

TARR

Double. Reference allocation ratio (proportion of subjects in reference arm).

vareq

Boolean. If TRUE, assumes equal variances across treatment and reference groups.

Value

The function returns an arma::mat storing simulation results row-wise for consistency with R's output format. The first row (totaly) contains the overall equivalence decision (1 for success, 0 for failure). The subsequent rows include equivalence deicisons for each endpoint, mean estimates for both treatment and reference groups, and corresponding standard deviations.

Details

Equivalence testing uses either the Difference of Means (DOM) test, applying predefined equivalence thresholds and significance levels. When hierarchical testing (adseq) is enabled, all primary endpoints must demonstrate equivalence before secondary endpoints are evaluated. Dropout rates are incorporated into the sample size calculation to ensure proper adjustment. Randomization is controlled through separate random seeds for the treatment and reference groups, enhancing reproducibility.

Author

Thomas Debray tdebray@fromdatatowisdom.com