power.1.111: Budget and/or sample size, power, MDES calculation for MRTs...

View source: R/power.1.111.R

power.1.111R Documentation

Budget and/or sample size, power, MDES calculation for MRTs investigating mediation effects with individual-level mediators

Description

This function can calculate required budget for desired power and power under a fixed budget for multisite-randomized trials (MRTs) with individual mediators probing mediation effects. It also can perform conventional power analyses (e.g., required sample size and power calculation).

Usage

power.1.111(
  cost.model = TRUE,
  expr = NULL,
  constraint = NULL,
  sig.level = 0.05,
  two.tailed = TRUE,
  a = NULL,
  b = NULL,
  power = NULL,
  m = NULL,
  test = NULL,
  n = NULL,
  p = NULL,
  c1 = NULL,
  c1t = NULL,
  r.yx = 0,
  r.mx = 0,
  r.mw = 0,
  q.a = 0,
  q.b = 0,
  max.iter = 300,
  alim = c(0, 4),
  blim = c(0.01, 0.99),
  powerlim = NULL,
  nlim = c(6, 1e+07),
  mlim = NULL
)

Arguments

cost.model

Logical; power analyses accommodating costs and budget (e.g., required budget for a desired power, power under fixed budget) if TRUE. Otherwise, conventional power analyses are performed (e.g., required sample size and power calculation); default value is TRUE.

expr

Returned object from function od.1.111; default value is NULL; if expr is specified, parameter values of a, b, c, ct, and p used or solved in function od.1.111 will be passed to the current function; only the values of p that specified or solved in function od.1.111 can be overwritten if constraint is specified.

constraint

If specified, the constrained value of p in a list format (e.g., constraint = list(p = 0.5)) will overwrite that from expr; default value is NULL.

sig.level

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

two.tailed

Two tailed test, the default value is TRUE.

a

The treatment effect on the mediator.

b

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

power

Statistical power specified, default is .80.

m

Total budget.

test

The type of test will be used to detect mediation effects. The default is the NULL or the one used in the expr Choices are the joint significance test (i.e., test = "joint", "Joint","JOINT") or the Sobel test (test = "sobel", "Sobel", or "SOBEL").

n

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

p

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

c1

The cost of sampling an individual in the control group.

c1t

The cost of sampling an individual in the treated group.

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.

max.iter

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

alim

The range for identifying the root of a path effect (a) numerically. Default value is c(0, 4).

blim

The range for identifying the root of b path within-treatment correlation between the mediator and outcome (b) numerically. Default value is (.01, .99), if (b) is negative, please re-code the outcome or mediator to make it positive.

powerlim

The range for solving the root of power (power) numerically, default value is c(1e-10, 1 - 1e-10).

nlim

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

mlim

The range for identifying the root of budget (m) numerically, default value is the costs sampling nlim units.

Value

Required budget (or required sample size), statistical power, (a) , or (b) depending on the specification of parameters. The function also returns the function name, design type, and parameters used in the calculation.

Examples

# Optimal design and power analyses accommodating costs and budget
myod <- od.1.111(a = .3, b = .5, c1 = 10, c1t = 100)
# myod
mypower <- power.1.111(expr = myod, power = .8)
#mypower

# Conventional power analyses
mypower <- power.1.111(cost.model = FALSE, a = .3, b = .5, test = "joint",
                       power = .8, p =.5)
#mypower
mypower <- power.1.111(cost.model = FALSE, n = 350, b = .5, test = "joint",
                       power = .8, p =.5)
#mypower


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