od.1.111: Optimal sample allocation calculation for single-level...

View source: R/od.1.111.R

od.1.111R Documentation

Optimal sample allocation calculation for single-level randomized controlled trials (RCTs) investigating mediation effects (1-1-1)

Description

The optimal design of single-level RCTs probing mediation effects is to identify the optimal sample allocation that use the minimum budget to achieve a fixed level of statistical power. The optimal design parameter is the proportion of individuals/units to be assigned to the experimental condition. This function identifies the optimal p.

Usage

od.1.111(
  a = NULL,
  b = NULL,
  c1 = NULL,
  c1t = NULL,
  m = NULL,
  r.yx = 0,
  r.mx = 0,
  r.mw = 0,
  q.a = 0,
  q.b = 0,
  test = "joint",
  p = NULL,
  n = NULL,
  tol = 1e-11,
  power = 0.8,
  d.p = c(0.1, 0.5),
  sig.level = 0.05,
  two.tailed = TRUE,
  plim = c(0.01, 0.99),
  varlim = c(0, 0.001),
  plab = NULL,
  varlab = NULL,
  vartitle = NULL,
  nlim = c(6, 1e+06),
  verbose = TRUE,
  max.value = Inf,
  max.iter = 300,
  e = 1e-10,
  n.of.ants = 10,
  n.of.archive = 20,
  q = 1e-04,
  xi = 0.5
)

Arguments

a

The treatment effect on the mediator.

b

The within-treatment correlation between the outcome and the mediator.

c1

The cost of sampling an individual in the control group.

c1t

The cost of sampling an individual in the treated group.

m

Total budget.

r.yx

The within-treatment correlation between the outcome and the covariate(s) in the outcome model.

r.mx

The within-treatment correlation between the mediator and the covariate(s) in the outcome model.

r.mw

The within-treatment correlation between the mediator and the covariate(s) in the mediator model.

q.a

The number of covariates at the mediator model (except the treatment indicator), the default value is zero.

q.b

The number of covariates in the outcome model (except the treatment indicator and the mediator), the default value is zero.

test

The type of test will be used to detect mediation effects. The default is the joint significance test (i.e., test = "joint", "Joint","JOINT"). Another choice is the Sobel test by specifying the argument as test = "sobel", "Sobel", or "SOBEL".

p

The proportion of level-4 clusters/units to be assigned to treatment.

n

Total number of individuals in the experimental study, the default value is NULL.

tol

convergence tolerance.

power

Statistical power specified, default is .80.

d.p

The initial sampling domains for p. Default is c(0.10, 0.50).

sig.level

Significance level or type I error rate, default value is 0.05.

two.tailed

Two tailed test, the default value is TRUE.

plim

The plot range for p, default value is c(0, 1).

varlim

The plot range for variance, default value is c(0, 0.05).

plab

The plot label for p , default value is "Proportion of Individuals in Treatment: p".

varlab

The plot label for variance, default value is "Variance".

vartitle

The title of variance plot, default value is NULL.

nlim

The interval/range used to numerically solve for n, the default values are c(6, 1e7).

verbose

Print out evaluation process if TRUE, default is TRUE.

max.value

Maximal value of optimization when used as the stopping criterion. Default is infinite.

max.iter

Maximal number of function evaluations when used as the stopping criterion. Default is 200.

e

Maximum error value used when solution quality used as the stopping criterion, default is 1e-10.

n.of.ants

Number of ants used in each iteration after the initialization stage, the default value is 10.

n.of.archive

Size of the solution archive, default is 20.

q

Locality of the search (0,1), default is 0.0001.

xi

Convergence pressure (0, Inf), suggested: (0, 1), default is 0.5.

Value

Unconstrained or constrained optimal sample allocation p). The function also returns statistical power, function name, design type, and parameters used in the calculation.

Examples

myod <- od.1.111(a = .3, b = .5, c1 = 10, c1t = 100)
myod

odr documentation built on Aug. 8, 2023, 5:13 p.m.