This package offers statistical power calculation for designs detecting equivalence of two-group means. It also performs optimal sample allocation and provides the Monte Carlo confidence interval (MCCI) method to test the significance of equivalence.
To compute the MCCI for difference or equivalence tests, the minimum required arguments are the estimate(s) and corresponding standard error(s). The function can take up to five sets of estimates and their standard errors. It could include components of one or two mediation effects if mediation is TRUE.
When two or more sets of parameters are specified (and mediation is FALSE), the function computes the MCCIs for the difference across these estimates. When mediation is TRUE, the function computes the MCCIs for the estimated mediation effects (in one study) or the difference across these mediation effects (in two studies/groups).
The function also provides a plot of the MCCIs by default. Arguments are available to adjust the appearance of the plot. See the function documentation for details.
These functions identify optimal sample allocation for different types of experiments where the maximum statistical is achieved under a fixed budget.
This function plots the statistical power curves under a fixed budget to illustrate the optimal design identification.
These functions perform power analyses for equivalence test in different types of designs. They can calculate statistical power, required sample size, and the minimum detectable difference between equivalence bounds and the estimate depending on which one and only one of parameters is unspecified in the function.
For example, the power.1.eq function for randomized controlled trials detecting equivalence has the following arguments.
## [1] "The 95% MCCI for difference test is (-0.078, -0.022)"
## [1] "The 90% MCCI for equivalence test is (-0.073, -0.027)"
# Note. Effect difference (the black square representing d1 - d2), 90% MCCI
# (the thick horizontal line) for the test of equivalence, and 95% MCCI
# (the thin horizontal line) for the test of moderation
# (or difference in effects).# Adjust the plot
myci <- mcci(d = c(.1, .15), se = c(.01, .01),
eq.bd = c(-0.2, 0.2), xlim = c(-.2, .7))## [1] "The 95% MCCI for difference test is (-0.078, -0.022)"
## [1] "The 90% MCCI for equivalence test is (-0.073, -0.027)"
-MCCI for the difference and equivalence in mediation effects (product of the m~x and y~m paths) in two studies
## [1] "The 95% MCCI for difference test is (-0.289, -0.19)"
## [1] "The 90% MCCI for equivalence test is (-0.281, -0.198)"
# 1. Conventional Power Analyses from Difference Perspectives
# Calculate the required sample size to achieve certain level of power
mysample <- power.1.eq(d = .1, eq.dis = 0.1, p =.5,
r12 = .5, q = 1, power = .8)## The required sample size (n) is 1237.868.
## $n
## [1] 1237.868
# Calculate power provided by a sample size allocation
mypower <- power.1.eq(d = 0.1, eq.dis = 0.1, n = 1238, p =.5,
r12 = .5, q = 1)## The statistical power (power) is 0.8000373.
## $power
## [1] 0.8000373
# Calculate minimum detectable distance a given sample size allocation can achieve
myeq.dis <- power.1.eq(d = .1, n = 1238, p =.5,
r12 = .5, q = 1, power = .8)## The minimum detectable difference between equivalence bounds and mean/effect differnce (eq.dis) is 0.09996871.
## $eq.dis
## [1] 0.09996871
# 2. Power Analyses Using Optimal Sample Allocation
# Optimal sample allocation identification
od <- od.1.eq(r12 = 0.5, c1 = 1, c1t = 10)## The optimal proportion of units in treatment (p) is 0.2402531.
# Required budget and sample size at the optimal allocation
budget <- power.1.eq(expr = od, d = 0.1, eq.dis = 0.1,
power = .8) ## The required budget (m) is 5359.788.
## The required sample size (n) is 1694.914.
# Required budget and sample size by an balanced design with p = .50
budget.balanced <- power.1.eq(expr = od, d = 0.1, eq.dis = 0.1,
power = .8,
constraint = list(p = .50))## The required budget (m) is 6808.272.
## The required sample size (n) is 1237.868.
# 27% more budget required from the balanced design with p = 0.50.
(budget.balanced$out$m-budget$out$m)/budget$out$m *100## [1] 27.02501