power.eq.2group {anomo} | R Documentation |
Statistical Power Analysis for Equivalence Tests of Two-Group Means
Description
Statistical power analysis for equivalence test of two-group means.
Usage
power.eq.2group(
cost.model = FALSE,
expr = NULL,
constraint = NULL,
d = NULL,
eq.dis = NULL,
m = NULL,
c1 = NULL,
c1t = NULL,
n = NULL,
p = NULL,
q = 1,
sig.level = 0.05,
r12 = NULL,
power = NULL,
powerlim = NULL,
nlim = NULL,
mlim = NULL,
eq.dislim = NULL,
verbose = TRUE
)
Arguments
cost.model |
Logical; power analyses accommodating costs and budget (e.g., required budget for desired power, power, minimum detectable eq.dis under a fixed budget) if TRUE. Otherwise, conventional power analysis is performed (e.g., required sample size, power, or minimum detectable eq.dis calculation); default value is FALSE, and it will be changed to TRUE if expr is not NULL. |
expr |
Returned object from function
|
constraint |
Specify the constrained value of
|
d |
The estimated difference in two-group means. |
eq.dis |
A positive number to specify the distance from equivalence
bounds to |
m |
Total budget. |
c1 |
The cost of sampling one unit in the control condition. |
c1t |
The cost of sampling one unit in the treated condition. |
n |
The total sample size across groups. |
p |
The proportion of individuals in the intervention group or group 1. |
q |
The number of predictors in the combined linear regression model. Default is 1. |
sig.level |
The significance level. Default is .05. |
r12 |
The proportion of variance explained by covariates if any. |
power |
Statistical power. |
powerlim |
The range for solving the root of power (power) numerically, default value is c(1e-10, 1 - 1e-10). |
nlim |
The range for searching the root of sample size (n) numerically, default value is c(4, 10e10). |
mlim |
The range for searching the root of budget ( |
eq.dislim |
The range for solving the root of equivalence difference with the effect size (d) numerically, default value is c(0, 10). |
verbose |
Logical; print the process if TRUE, otherwise not; default value is TRUE. |
Value
Required budget (and/or required sample size), statistical power, or minimum detectable eq.dis depending on the specification of parameters. The function also returns the function name, design type, and parameters used in the calculation.
Examples
library(anomo)
# 1. Conventional Power Analyses from Difference Perspectives
# Calculate the required sample size to achieve certain level of power
mysample <- power.eq.2group(d = .1, eq.dis = 0.1, p =.5,
r12 = .5, q = 1, power = .8)
mysample$out
# Calculate power provided by a sample size allocation
mypower <- power.eq.2group(d = 1, eq.dis = .1, n = 1238, p =.5,
r12 = .5, q = 1)
mypower$out
# Calculate the minimum detectable distance a given sample size allocation
# can achieve
myeq.dis <- power.eq.2group(d = .1, n = 1238, p =.5,
r12 = .5, q = 1, power = .8)
myeq.dis$out
# 2. Power Analyses Using Optimal Sample Allocation
myod <- od.eq.2group(r12 = 0.5, c1 = 1, c1t = 10)
budget <- power.eq.2group(expr = myod, d = .1, eq.dis = 0.1,
q = 1, power = .8)
budget.balanced <- power.eq.2group(expr = myod, d = .1, eq.dis = 0.1,
q = 1, power = .8,
constraint = list(p = .50))
(budget.balanced$out$m-budget$out$m)/budget$out$m *100
# 27% more budget required from the balanced design with p = 0.50.