power.2.221: Budget and/or sample size, power calculation for CRTs probing...

View source: R/power.2.221.R

power.2.221R Documentation

Budget and/or sample size, power calculation for CRTs probing mediation effects with cluster-level mediators

Description

This function can calculate required budget for desired power and power under a fixed budget for experimental studies with group mediators probing mediation effects. It also can perform conventional power analyses (e.g., required sample size and power calculation).

Usage

power.2.221(
  cost.model = TRUE,
  expr = NULL,
  constraint = NULL,
  sig.level = 0.05,
  two.tailed = TRUE,
  a = NULL,
  b = NULL,
  test = "joint",
  n = NULL,
  p = NULL,
  power = NULL,
  J = NULL,
  m = NULL,
  c1 = NULL,
  c1t = NULL,
  c2 = NULL,
  c2t = NULL,
  r2m = r2m,
  r.yx = 0,
  r.mw = 0,
  r.yw = 0,
  icc = NULL,
  q = 0,
  q.a = 0,
  q.b = 0,
  powerlim = NULL,
  Jlim = NULL,
  mlim = NULL
)

Arguments

cost.model

Logical; power analyses accommodating costs and budget (e.g., required budget for desired power, power/MDES under fixed budget) if TRUE, otherwise conventional power analyses (e.g., required sample size, power, or MDES calculation); default value is TRUE.

expr

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

constraint

specify the constrained value of p and/or n in a list format to overwrite that/those from expr; default value is NULL.

sig.level

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

two.tailed

Logical; two-tailed tests if TRUE, otherwise one-tailed tests; default value is TRUE.

a

The treatment effect on the mediator.

b

The within treatment correlation between the outcome and the mediator at the cluster level.

test

The type of test will be used to detect mediation effects. Default is the joint significance test (i.e., test = "joint"). The other choice is the Sobel test by specifying the argument as test = "sobel".

n

The level-1 sample size per level-2 unit.

p

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

power

Statistical power.

J

The total level-2 sample size.

m

Total budget.

c1

The cost of sampling one level-1 unit in control condition.

c1t

The cost of sampling one level-1 unit in treatment condition.

c2

The cost of sampling one level-2 unit in control condition.

c2t

The cost of sampling one level-2 unit in treatment condition.

r2m

The proportion of mediator variance explained by covariates in the mediator model.

r.yx

The correlation between the outcome and the covariate at the individual level.

r.mw

The correlation between the mediator and the covariate at the cluster level.

r.yw

The correlation between the outcome and the covariate at the cluster level.

icc

The unconditional intraclass correlation coefficient (ICC) in population or in each treatment condition.

q

The number of level-2 covariates.

q.a

The number of covariates in the mediator model (except the treatment indicator).

q.b

The number of covariates in the outcome model at the cluster level (except the treatment indicator and the mediator).

powerlim

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

Jlim

The range for searching the root of level-2 sample size (J) numerically, default is c(4, 10e10).

mlim

the range for searching the root of budget (m) numerically, default value is the costs sampling nlim units across treatment conditions or c(4 * ncost, 10e10 * ncost) with ncost = ((1 - p) * c1 + p * c1t)

Value

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


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