Learn R Programming

powertools (version 1.0.0)

Power and Sample Size Tools

Description

Power and sample size calculations for a variety of study designs and outcomes. Methods include t tests, ANOVA (including tests for interactions, simple effects and contrasts), proportions, categorical data (chi-square tests and proportional odds), linear, logistic and Poisson regression, alternative and coprimary endpoints, power for confidence intervals, correlation coefficient tests, cluster randomized trials, individually randomized group treatment trials, multisite trials, treatment-by-covariate interaction effects and nonparametric tests of location. Utilities are provided for computing various effect sizes. Companion package to the book "Power and Sample Size in R", Crespi (2025, ISBN:9781138591622). Further resources available at .

Copy Link

Version

Install

install.packages('powertools')

Monthly Downloads

224

Version

1.0.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Catherine M. Crespi

Last Published

November 15th, 2025

Functions in powertools (1.0.0)

coprimary.z

Power calculations for multiple co-primary continuous endpoints assuming known covariance matrix
ci.mean

Power calculation for precision analysis (confidence interval) for one mean
corr.1samp

Power calculation for test of one correlation coefficient
corr.2samp

Power calculation for comparing two correlation coefficients
crt.long.cont

Power for test of treatment effect in longitudinal cluster randomized trial with baseline measurement
crt.parallel.bin

Power calculation for cluster randomized trial with binary outcome
crt.means.r

Correlation between a cluster mean at baseline and follow up
crt.varexplore

Variance exploration for cluster randomized trials with binary outcomes
crt.xo.cont

Power for test of treatment effect in 2x2 crossover cluster randomized trial
es.w

Cohen w effect size calculation for chi-square tests
irgtt.bin

Power for individual randomized group treatment trial with binary outcome
es.h

Cohen h effect size calculation for two proportions
es.d

Cohen d effect size calculation for one or two means
es.anova.f

Cohen f effect size calculation for one- or two- way analysis of variance
es.q

Cohen q effect size calculation for two correlation coefficients
mlrF.partial

Power calculation for a multiple linear regression partial F test
multisite.bin

Power for a multisite trial with a binary outcome
mlrF.overall

Power calculation for a multiple linear regression overall F test
es.fsq.overall

Cohen f-squared effect size for overall F test in multiple linear regression
prop.paired

Power calculation for McNemar test of two correlated proportions
es.fsq.partial

Cohen f-squared effect size for partial F test in multiple linear regression
relrisk

Power calculation for relative risk
safe.uniroot

Internal-use wrapper for catching errors induced by stats::uniroot
ms.varexplore

Variance exploration for a multisite trial with a binary outcome
signedrank

Power calculation for signed-rank test
prop.1samp

Power calculation for one-sample proportion test
propodds

Power calculations for ordinal categorical variable under proportional odds assumption
prop.2samp

Power calculation for two-sample proportion test
ranksum

Power calculation for rank-sum test
ztest.paired

Power calculation for paired z test
prop.test.equiv

Power calculation for test of equivalence of two proportions
crt.parallel.cont

Power for cluster randomized trial with continuous outcome
chisq.gof

Power calculation for chi-square goodness-of-fit test
check.param

Internal-use function for quality checking individual parameters
irt.hte

Power for detecting treatment effect heterogeneity in an individually randomized trial with a continuous outcome
irgtt.cont

Power for individually randomized group treatment trial with continuous outcome
slr

Power calculation for a simple linear regression
ttest.1samp

Power calculation for one-sample t test
crt.parallel.hte

Power for detecting treatment effect heterogeneity in a cluster randomized trial with a continuous outcome
maps

maps dataframe
ttest.2samp

Power calculation for two-sample t test
ttest.paired

Power calculation for paired t test
matrix.format

Internal-use function for displaying matrices in function outputs
signtest

Power calculation for sign test
multisite.hte

Power for test of heterogeneity of treatment effect in a multisite trial
multisite.cont

Power for test of average treatment effect in a multisite trial
re.clustsize.cont

Relative efficiency of a cluster randomized or multisite trial with continuous outcome with varying cluster sizes
re.clustsize.bin

Relative efficiency of a cluster randomized or multisite trial with binary outcome with varying cluster sizes
ztest.2samp

Power calculation for two-sample z test
ztest.1samp

Power calculation for one-sample z test
anova1way.F.bal

Power calculation for balanced one-way ANOVA omnibus F test
anova2way.F.bal

Power calculation for two-way balanced analysis of variance F tests
anova2way.se.bal

Power calculation for test of simple effect for two-way balanced analysis of variance
anova2way.F.unbal

Power calculation for two-way unbalanced analysis of variance F tests
anova1way.F.unbal

Power calculation for unbalanced one-way analysis of variance omnibus F test
altprimary

Power calculation for multiple alternative (at least one) primary continuous endpoints assuming known covariance matrix
anova1way.c.bal

Power calculation for one-way balanced analysis of variance contrast test
anova2way.c.unbal

Power calculation for two-way unbalanced analysis of variance contrast test
anova2way.c.bal

Power calculation for two-way balanced analysis of variance contrast test
anova1way.c.unbal

Power calculation for one-way unbalanced analysis of variance contrast test
anova2way.se.unbal

Power calculation for test of simple effect for two-way unbalanced analysis of variance
coprimary.t

Power calculations for multiple co-primary continuous endpoints assuming unknown covariance matrix
chisq.indep

Power calculation for chi-square test of independence
check.many

Internal-use function for quality checking sets of parameters
ci.meandiff

Power calculation for precision analysis (confidence interval) for a difference between two means