Skip to contents

Central formulas for all registered ggpower tests. See linked vignettes for worked examples.

General power

Power=1β=P(reject H0H1)\text{Power} = 1 - \beta = P(\text{reject } H_0 \mid H_1)

For many tests, power is computed from a noncentral distribution:

Power=1FH1(c)+(one/two-tailed adjustment)\text{Power} = 1 - F_{H_1}(c) + \text{(one/two-tailed adjustment)}

where cc is the critical value under H0H_0 and FH1F_{H_1} is the CDF under H1H_1.


t tests

Cohen’s d (one sample / paired)

d=μ1μ0σd = \frac{\mu_1 - \mu_0}{\sigma}

Noncentrality: δ=dn\delta = d\sqrt{n} (one sample, paired).

Two independent means

d=μ1μ2σd = \frac{\mu_1 - \mu_2}{\sigma}

δ=dn1n2n1+n2\delta = d\sqrt{\frac{n_1 n_2}{n_1 + n_2}}

Point-biserial correlation

Convert ρ\rho to dd: d=2ρ1ρ2d = \frac{2\rho}{\sqrt{1-\rho^2}}.

Linear regression slope

δ=(β1β0)nσresidualσx2\delta = \frac{(\beta_1 - \beta_0)\sqrt{n}}{\sigma_{\text{residual}}} \cdot \sqrt{\sigma_x^2}

Generic t (direct NCP)

User supplies noncentrality parameter δ\delta and dfdf directly.

Vignette: t Tests


F tests and ANOVA

Cohen’s f from η2\eta^2

f=η21η2f = \sqrt{\frac{\eta^2}{1-\eta^2}}

Noncentrality (omnibus)

λ=f2Norλ=f2(Nk1)\lambda = f^2 \cdot N \quad \text{or} \quad \lambda = f^2 \cdot (N - k - 1)

depending on the test (see registry method field).

Multiple regression f2f^2

f2=R21R2f^2 = \frac{R^2}{1-R^2}

R2R^2 increase

f2=Rfull2Rreduced21Rfull2f^2 = \frac{R^2_{\text{full}} - R^2_{\text{reduced}}}{1 - R^2_{\text{full}}}

Two variances

F=σ12σ02F = \frac{\sigma_1^2}{\sigma_0^2}

Power from noncentral F with numerator df1=1df_1 = 1.

Vignette: ANOVA and Regression


Chi-square tests

One-sample variance

Test σ2\sigma^2 against σ02\sigma_0^2 via χ2\chi^2 with df=n1df = n-1.

Cohen’s w (Gof / contingency)

w=i(p1ip0i)2p0iw = \sqrt{\sum_i \frac{(p_{1i} - p_{0i})^2}{p_{0i}}}

Noncentrality: λ=Nw2\lambda = N w^2.

Vignette: Exact and Proportions


Exact and proportion tests

Binomial / one proportion / sign test

H0:p=p0vsH1:p=p1H_0: p = p_0 \quad \text{vs} \quad H_1: p = p_1

Exact binomial enumeration or normal approximation for large nn.

Fisher exact (two proportions)

H0:p1=p2H_0: p_1 = p_2

Uses hypergeometric enumeration; normal Cohen’s hh fallback for large tables.

McNemar (approximation)

Discordant-pair binomial proxy on n01n_{01} vs n10n_{10}.

Vignette: Exact and Proportions


z tests

Independent correlations (Fisher Z)

q=FisherZ(r1)FisherZ(r2)q = \text{FisherZ}(r_1) - \text{FisherZ}(r_2)

z=q1n13+1n23z = \frac{q}{\sqrt{\frac{1}{n_1-3}+\frac{1}{n_2-3}}}

Dependent correlations (Steiger)

Uses covariance of Fisher-Z transformed correlations; see z_corr_dependent_* tests.

Logistic regression (Wald)

z=log(OR)SE(log(OR))z = \frac{\log(\text{OR})}{\text{SE}(\log(\text{OR}))}

Poisson regression (Wald)

z=β1SE(β1)z = \frac{\beta_1}{\text{SE}(\beta_1)}

Tetrachoric (approximation)

Large-sample Fisher-Z on tetrachoric ρ\rho.

Vignette: Correlation and z Tests


Nonparametric tests

Asymptotic relative efficiency (ARE)

Wilcoxon tests map to equivalent dd via ARE:

deff=dAREd_{\text{eff}} = d \cdot \sqrt{\text{ARE}}

then reuse t-test noncentrality.

Vignette: Nonparametric Tests


Biomarker discovery

ROC AUC — Hanley-McNeil (one sample)

SE(A)=A(1A)+(n11)(Q1A2)+(n01)(Q2A2)n1n0\text{SE}(A) = \sqrt{\frac{A(1-A) + (n_1-1)(Q_1 - A^2) + (n_0-1)(Q_2 - A^2)}{n_1 n_0}}

z=AA0SE(A)z = \frac{A - A_0}{\text{SE}(A)}

Two independent AUCs — DeLong-style

z=A1A2Var(A1)+Var(A2)z = \frac{A_1 - A_2}{\sqrt{\text{Var}(A_1) + \text{Var}(A_2)}}

Diagnostic accuracy

Separate binomial tests for sensitivity and specificity; reported power is min(Powersens,Powerspec)\min(\text{Power}_{\text{sens}}, \text{Power}_{\text{spec}}).

Log-rank (Schoenfeld)

z|log(HR)|1/DDp(1p)z \approx \frac{|\log(\text{HR})|}{\sqrt{1/D}} \cdot \sqrt{D \cdot p(1-p)}

Cox regression

z|log(HR)|Ez \approx |\log(\text{HR})| \sqrt{E}

where EE is expected events.

FDR screening

Benjamini-Hochberg at level qq; power from independent two-sample tt tests with proportion π0\pi_0 true nulls.

Vignettes: ROC / AUC, Diagnostic accuracy


Clinical trials

Superiority (continuous)

One-sided two-sample tt: δ=dn1n2/(n1+n2)\delta = d\sqrt{n_1 n_2/(n_1+n_2)}.

Superiority (binary)

One-sided Fisher / proportion test on p0p_0 vs p1p_1.

Non-inferiority (continuous)

H0:μTμCΔvsH1:μTμC>ΔH_0: \mu_T - \mu_C \le -\Delta \quad \text{vs} \quad H_1: \mu_T - \mu_C > -\Delta

Shifted mean difference: dNI=d+Δ/σd_{\text{NI}} = d + \Delta/\sigma.

Non-inferiority (binary)

Normal approximation on pTpC+Δp_T - p_C + \Delta.

Equivalence — TOST

Two one-sided tests:

PowerTOSTPowerupper×Powerlower\text{Power}_{\text{TOST}} \approx \text{Power}_{\text{upper}} \times \text{Power}_{\text{lower}}

Simon two-stage

P(success)=kP(stage 1)P(stage 2stage 1)P(\text{success}) = \sum_{k} P(\text{stage 1}) \cdot P(\text{stage 2} \mid \text{stage 1})

under H0H_0 and H1H_1 response rates.

Cluster RCT design effect

DE=1+(m1)ICC\text{DE} = 1 + (m - 1) \cdot \text{ICC}

Effective neff=n/DEn_{\text{eff}} = n / \text{DE}; then standard two-sample formulas.

Vignettes: Phase III superiority, Non-inferiority, Equivalence