Learn R Programming

DMAR (version 1.0.0)

ss_power_equivalence_c: Sample Size for Equivalence or Noninferiority of a Linear Contrast

Description

Computes the smallest per-group sample size at which the two one-sided tests procedure (Schuirmann, 1987) for a linear contrast \(\psi = \sum_j c_j \mu_j\), or the companion one-sided noninferiority test, attains a desired power. Power is computed exactly through power_equivalence_c. This is the declaration-probability route to planning; the accuracy in parameter estimation (AIPE) route, which targets the confidence interval width directly, is ss_aipe_c, and the two answer the same question whenever true_psi = 0 and the width target is calibrated to the bounds.

Usage

ss_power_equivalence_c(
  c_weights,
  sigma,
  delta_lower = NULL,
  delta_upper = NULL,
  true_psi = 0,
  desired_power = 0.85,
  alpha_level = 0.05,
  side = c("equivalence", "noninferiority")
)

Value

A data.frame with rows necessary_n_per_group

(the recommended sample size for each of the \(J\) groups named by c_weights), total_N (the implied total,

\(J \times n\)), and actual_power (the exact power achieved at the recommendation). The result carries the

dmar_ss_power class, so tidy and

glance summarize it in broom convention.

Arguments

c_weights

The contrast weights. The weights must sum to zero with the positive weights summing to 1 and the negative weights to -1, so that the bounds are on the raw scale of the response.

sigma

The anticipated error standard deviation (the square root of the mean square error).

delta_lower, delta_upper

Equivalence bounds on the raw scale of the response. Both must be positive; the equivalence region is \((-\delta_L, +\delta_U)\). If only delta_upper is supplied, the bounds are symmetric. Noninferiority uses \(-\delta_L\) alone.

true_psi

The population contrast the design should be able to detect as equivalent (or noninferior). Default 0. For equivalence it must lie strictly inside the bounds; for noninferiority, strictly above \(-\delta_L\). The farther true_psi sits from the center of the region, the larger the required sample size.

desired_power

The target probability of declaring equivalence (or noninferiority) at true_psi. Default 0.85, matching ss_power_contrast.

alpha_level

One-sided significance level for each test. Default 0.05.

side

"equivalence" (default) or "noninferiority".

Author

Ken Kelley [email protected]

Details

Design. Planning assumes equal allocation across the \(J\) groups named by c_weights and a pooled error term on \(N - J\) degrees of freedom. Groups with zero weight still contribute error degrees of freedom, which is why they belong in c_weights when the fitted model will include them.

The search. The function starts from the normal-theory approximation and moves to the smallest integer \(n\) whose exact power reaches desired_power. Power is monotone in \(n\) once the design is feasible, so the search is a short walk.

Relation to the half-width rule. With symmetric bounds \(\pm\delta\), true_psi = 0, and \(\alpha = .05\), targeting a 90% CI half-width of \(\delta/2\) yields a declaration probability of about .90; this function makes the probability the target directly rather than through the width.

References

Chattopadhyay, B., Bandyopadhyay, T., Kelley, K., & Padalunkal, J. J. (2025). A sequential approach for noninferiority or equivalence of a linear contrast under cost constraints. Psychological Methods, 30(2), 425--439. tools:::Rd_expr_doi("10.1037/met0000570")

Maxwell, S. E., Kelley, K., & Rausch, J. R. (2008). Sample size planning for statistical power and accuracy in parameter estimation. Annual Review of Psychology, 59, 537--563. tools:::Rd_expr_doi("10.1146/annurev.psych.59.103006.093735")

Schuirmann, D. J. (1987). A comparison of the two one-sided tests procedure and the power approach for assessing the equivalence of average bioavailability. Journal of Pharmacokinetics and Biopharmaceutics, 15(6), 657--680.

See Also

power_equivalence_c, ss_aipe_c, ss_power_contrast, equivalence_c

Other equivalence testing: equivalence_c(), equivalence_r(), equivalence_smd(), plot_equivalence(), power_density_equivalence_md(), power_equivalence_c(), power_equivalence_md(), power_equivalence_md_plot()

Other sample size for power: power_fisher_exact(), ss_aipe_mixed_effects(), ss_power_R2(), ss_power_R2_sensitivity(), ss_power_c(), ss_power_c_ancova(), ss_power_composite_ancova(), ss_power_composite_ancova_2group(), ss_power_composite_anova(), ss_power_composite_factorial_ancova(), ss_power_composite_factorial_ancova_het(), ss_power_composite_factorial_anova(), ss_power_composite_sem(), ss_power_contrast(), ss_power_factorial_ancova(), ss_power_factorial_anova(), ss_power_indirect_effect(), ss_power_mixed_effects(), ss_power_one_way_anova(), ss_power_pcm(), ss_power_r(), ss_power_rc(), ss_power_reg_coef(), ss_power_reg_coef_sensitivity(), ss_power_rm_anova(), ss_power_sc(), ss_power_sem(), ss_power_smd(), ss_power_split_plot_anova()

Examples

Run this code
# 1. Two-group equivalence with bounds of 5 raw-scale points and an
#    anticipated error SD of 15.67: n per group for 90% power at
#    true equivalence.
ss_power_equivalence_c(c_weights = c(1, -1), sigma = 15.67,
                       delta_upper = 5, desired_power = 0.90)

# 2. Noninferiority is cheaper than equivalence at the same bound.
ss_power_equivalence_c(c_weights = c(1, -1), sigma = 15.67,
                       delta_upper = 5, desired_power = 0.90,
                       side = "noninferiority")

# 3. A true contrast off center raises the requirement.
ss_power_equivalence_c(c_weights = c(1, -1), sigma = 15.67,
                       delta_upper = 5, true_psi = 2,
                       desired_power = 0.90)

Run the code above in your browser using DataLab