ZhaoNew_Sim: Simulation Function of Zhao's New Design for Binary and...

View source: R/CARA_function.R

ZhaoNew_SimR Documentation

Simulation Function of Zhao's New Design for Binary and Continuous Response

Description

This function simulates a trial using Zhao's new design for binary and continuous responses.

Usage

ZhaoNew_Sim(
  n,
  mu,
  beta,
  gamma,
  m0 = 40,
  pts.X,
  pts.Z,
  response,
  omega,
  p = 0.8
)

Arguments

n

a positive integer. The sample size of the simulated data.

mu

a vector of length 2. The true parameters of treatment.

beta

a vector of length 2. The true parameters of predictive covariate and interaction with treatment.

gamma

a vector of length k. The true parameters of prognostic covariates.

m0

a positive integer. The number of first 2m0 patients will be allocated equally to both treatments.

pts.X

a vector of length n. The vector of patients' binary predictive covariates.

pts.Z

a matrix of n x k. The matrix of patients' binary prognostic covariates.

response

the type of the response. Options are "Binary" or "Cont".

omega

a vector of length 2+k. The weight of imbalance.

p

a positive value between 0.75 and 0.95. The probability parameter of Efron's biased coin design.

Value

method

The name of procedure.

sampleSize

The sample size of the trial.

assignment

The randomization sequence.

X1proportion

Average allocation proportion for treatment A when predictive covariate equals the smaller value.

X2proportion

Average allocation proportion for treatment A when predictive covariate equals the larger value.

proportion

Average allocation proportion for treatment A.

failureRate

Proportion of treatment failures (if response = "Binary").

meanResponse

Mean response value (if response = "Cont").

rejectNull

Logical. Indicates whether the treatment effect is statistically significant based on a Wald test.

Examples

set.seed(123)

# Simulation settings
n = 400                    # total number of patients
m0 = 40                    # initial burn-in sample size
mu = c(0.5, 0.8)           # potential means (for continuous or logistic link)
beta = c(1, 1)             # treatment effect and predictive covariate effect
gamma = c(0.1, 0.5)        # prognostic covariate effects
omega = rep(0.25, 4)       # imbalance weights
p = 0.8                    # biased coin probability

# Generate patient covariates
pts.X = sample(c(1, -1), n, replace = TRUE)  # predictive covariate
pts.Z = cbind(
  sample(c(1, -1), n, replace = TRUE),        # prognostic Z1
  sample(c(1, -1), n, replace = TRUE)         # prognostic Z2
)

# Run the simulation (binary response setting)
result = ZhaoNew_Sim(
  n = n,
  mu = mu,
  beta = beta,
  gamma = gamma,
  m0 = m0,
  pts.X = pts.X,
  pts.Z = pts.Z,
  response = "Binary",
  omega = omega,
  p = p
)


caradpt documentation built on Aug. 28, 2025, 9:09 a.m.

Related to ZhaoNew_Sim in caradpt...