| power.1.111m | R Documentation |
This function can calculate required budget for desired power, the minimum detectable effect size, and statistical power under a fixed budget in randomized controlled trials (RCTs) probing moderation effects. It also can perform conventional power analyses (e.g., required sample size calculation, minimum detectable effect size calculation, and power calculation).
power.1.111m(
cost.model = TRUE,
expr = NULL,
constraint = NULL,
sig.level = 0.05,
two.tailed = TRUE,
gamma = NULL,
binary = TRUE,
power = NULL,
m = NULL,
n = NULL,
p = NULL,
Q = 0.5,
c1 = NULL,
c1t = NULL,
r.yx = 0,
r.mx = 0,
r.ym = 0,
q.mod = 1,
gammalim = c(0.005, 5),
powerlim = c(1e-04, 0.9999),
nlim = c(20, 1e+07),
mlim = NULL
)
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 |
constraint |
If specified, the constrained value of
|
sig.level |
Significance level, default value is .05. |
two.tailed |
Logical; two-tailed tests if TRUE, otherwise one-tailed tests; default value is TRUE. |
gamma |
Moderated treatment effect. |
binary |
Logical. The moderator is binary if TRUE and continuous if FALSE. Default is TRUE. |
power |
Statistical power. |
m |
Total budget. |
n |
Total number of individuals. |
p |
The proportion of individuals assigned to the experimental group. |
Q |
The proportion of individuals in one group the binary moderator. Default value is 0.5, which requires the minimum number of individuals to achieve a targeted power. Change it as necessary. |
c1 |
The cost of sampling one unit in control condition. |
c1t |
The cost of sampling one unit in treatment condition. |
r.yx |
Within-treatment correlation between the outcome (y) and the covariate (x) for continuous moderators. Within-treatment within-moderator correlation between the outcome (y) and the covariate (x) for binary moderators. |
r.mx |
Within-treatment correlation between the moderator (m) and the covariate (x), if specified, for continuous moderators. |
r.ym |
Within-treatment correlation between the outcome (y) and the moderator (m), if specified, for continuous moderators. |
q.mod |
The number of covariates in the moderation model (besides the treatment, moderator, and their interaction term). The default value is 1. |
gammalim |
The range for identifying the root of moderation
effect size ( |
powerlim |
The range for identifying the root of power
( |
nlim |
The range for identifying the root of sample size ( |
mlim |
The range for identifying the root of budget ( |
Required budget (m) or required sample size (n),
statistical power(power),
minimum detectable moderation effect size (gamma),
depending on the specification of parameters.
The function also returns the function name, design type,
and parameters used in the calculation.
# Optimal design and power analyses accommodating costs and budget
myod <- od.1.111m(d =.1, gamma = .2, r12 = .50,
c1 = 10, c1t = 100)
myod
N <- power.1.111m(expr = myod, power = .8)
N$out
# Conventional power analyses
# Required sample size for a binary moderator
N <- power.1.111m(cost.model = FALSE, gamma = .2, power = .8, p =.5)
N
# Required sample size for a continuous moderator
N <- power.1.111m(cost.model = FALSE,
gamma = .2, power = .8, p =.5, binary = FALSE)
N
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.