Learn R Programming

statpsych: Statistical Methods for Psychologists

statpsych implements confidence interval and sample size methods that are especially useful in psychological research. The methods can be applied in 1-group, 2-group, paired-samples, and multiple-group designs and to a variety of parameters including means, medians, proportions, slopes, standardized mean differences, standardized linear contrasts of means, plus several measures of correlation and association. The confidence intervals and sample size functions are applicable to single parameters as well as differences, ratios, and linear contrasts of parameters. The sample size functions can be used to approximate the sample size needed to estimate a parameter or function of parameters with desired confidence interval precision or to perform a variety of hypothesis tests (directional two-sided, equivalence, superiority, noninferiority) with desired power. For details, see: https://dgbonett.sites.ucsc.edu/.

Installation

You can install the currently-released version from CRAN with this R command:

install.packages("statpsych")

Alternatively, you can install the latest development version from GitHub with these R commands:

install.packages("devtools")
devtools::install_github("dgbonett/statpsych")

Feedback, issues, and contributions

Submit feedback, suggestions, and bugs to github here.

Copy Link

Version

Install

install.packages('statpsych')

Monthly Downloads

656

Version

2.0.0

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Douglas G. Bonett

Last Published

July 11th, 2026

Functions in statpsych (2.0.0)

ci.bayes.normal

Bayesian credible interval for a normal prior distribution
ci.2x2.stdmean.mixed

Computes confidence intervals of standardized effects in a 2x2 mixed design
ci.2x2.stdmean.ws

Computes confidence intervals of standardized effects in a 2x2 within-subjects design
ci.bayes.cor

Bayesian credible interval for a Pearson or partial correlation with a skeptical prior
ci.agree.3rater

Computes confidence intervals for a 3-rater design with dichotomous ratings
ci.agree2

Confidence interval for G-index difference in a 2-group design
ci.bayes.spcor

Bayesian credible interval for a semipartial correlation with a skeptical prior
ci.agree

Confidence interval for a G-index of agreement
ci.bayes.prop

Bayesian credible interval for a proportion
ci.biphi

Confidence interval for a biserial-phi correlation
ci.cor

Confidence interval for a Pearson or partial correlation
ci.condslope

Confidence intervals for conditional (simple) slopes in a linear model
ci.cor2

Confidence interval for a 2-group Pearson correlation difference
ci.cqv

Confidence interval for a coefficient of quartile variation
ci.bscor

Confidence interval for a biserial correlation
ci.cramer

Confidence interval for Cramer's V
ci.condslope.log

Confidence intervals for conditional (simple) slopes in a logistic model
ci.cor2.gen

Confidence interval for a 2-group correlation difference
ci.diversity

Confidence intervals for diversity indices
ci.cv

Confidence interval for a coefficient of variation
ci.icc

Confidence interval for an intraclass reliability coefficient
ci.indirect

Confidence interval for an indirect effect
ci.lc.median.bs

Confidence interval for a linear contrast of medians in a between-subjects design
ci.cod

Confidence interval for a coefficient of dispersion
ci.lc.glm

Confidence interval for a linear contrast of general linear model parameters
ci.lc.gen.bs

Confidence interval for a linear contrast of parameters in a between-subjects design
ci.lc.prop.scheffe

Scheffe confidence interval for a linear contrast of proportions in a between-subjects design
ci.kendalltau

Confidence interval for a Kendall tau-a correlation
ci.kappa

Confidence interval for two kappa reliability coefficients
ci.lc.reg

Confidence interval for a linear contrast of regression coefficients in multiple group regression model
ci.cor.dep

Confidence interval for a difference in dependent Pearson correlations
ci.cronbach

Confidence interval for a Cronbach reliability
ci.lc.prop.bs

Confidence interval for a linear contrast of proportions in a between- subjects design
ci.lc.stdmean.ws

Confidence interval for a standardized linear contrast of means in a within-subjects design
ci.etasqr

Confidence interval for eta-squared
ci.lc.stdmean.bs

Confidence interval for a standardized linear contrast of means in a between-subjects design
ci.mean.gen

Confidence intervals for generalized means
ci.fisher

Fisher confidence interval
ci.mean.fpc

Confidence interval for a mean with a finite population correction
ci.lc.mean.bs

Confidence interval for a linear contrast of means in a between-subjects design
ci.median

Confidence interval for a median
ci.cronbach2

Confidence interval for a difference in Cronbach reliabilities in a 2-group design
ci.median.ps

Confidence interval for a paired-samples median difference
ci.pairs.mult

Confidence intervals for pairwise proportion differences of a multinomial variable
ci.pairs.prop.bs

Bonferroni confidence intervals for all pairwise proportion differences in a between-subjects design
ci.oddsratio

Confidence interval for an odds ratio
ci.mean2

Confidence interval for a 2-group mean difference
ci.mean.ps

Confidence interval for a paired-samples mean difference
ci.median2

Confidence interval for a 2-group median difference
ci.ratio.cod2

Confidence interval for a ratio of dispersion coefficients in a 2-group design
ci.ratio.cv2

Confidence interval for a ratio of coefficients of variation in a 2-group design
ci.phi

Confidence interval for a phi correlation
ci.pbcor

Confidence intervals for point-biserial correlations
ci.prop2.inv

Confidence interval for a 2-group proportion difference using inverse sampling
ci.mad

Confidence interval for a mean absolute deviation
ci.lc.mean.scheffe

Scheffe confidence interval for a linear contrast of means in a between-subjects design
ci.prop2

Confidence interval for a 2-group proportion difference
ci.mann

Confidence interval for a Mann-Whitney parameter
ci.poisson

Confidence interval for a Poisson rate
ci.popsize

Confidence interval for an unknown population size
ci.ratio.mad.ps

Confidence interval for a paired-samples MAD ratio
ci.mape

Confidence interval for a mean absolute prediction error
ci.prop

Confidence intervals for a proportion
ci.mean

Confidence interval for a mean
ci.prop.inv

Confidence interval for a proportion using inverse sampling
ci.prop.fpc

Confidence interval for a proportion with a finite population correction
ci.pv

Confidence intervals for positive and negative predictive values with retrospective sampling
ci.random.anova

Confidence intervals for parameters of one-way random effects ANOVA
ci.ratio.median.ps

Confidence interval for a paired-samples median ratio
ci.ratio.mean2

Confidence interval for a 2-group mean ratio
ci.rel2

Confidence interval for a 2-group reliability difference
ci.ratio.sd2

Confidence interval for a 2-group ratio of standard deviations
ci.sign

Confidence interval for the parameter of the one-sample sign test
ci.spear

Confidence interval for a Spearman correlation
ci.spcor

Confidence interval for a semipartial correlation
ci.sd

Confidence interval for a standard deviation
ci.rsqr

Confidence interval for squared multiple correlation
ci.reliability

Confidence interval for a reliability coefficient
ci.ratio.median2

Confidence interval for a 2-group median ratio
ci.ratio.mad2

Confidence interval for a 2-group ratio of mean absolute deviations
ci.ratio.poisson2

Confidence interval for a ratio of Poisson rates in a 2-group design
ci.ratio.mape2

Confidence interval for a ratio of mean absolute prediction errors in a 2-group design
ci.theil

Theil-Sen estimate and confidence interval for slope
ci.slope.median.bs

Confidence interval for the slope of medians in a one-factor experimental design with a quantitative between-subjects factor
ci.ratio.mean.ps

Confidence interval for a paired-samples mean ratio
ci.slope.prop.bs

Confidence interval for a slope of a proportion in a single-factor experimental design with a quantitative between-subjects factor
ci.stdmean2

Confidence intervals for a 2-group standardized mean difference
ci.stdmean.ps

Confidence intervals for a paired-samples standardized mean difference
ci.tetra

Confidence interval for a tetrachoric correlation
ci.ratio.prop.ps

Confidence interval for a paired-samples proportion ratio
ci.stdmean

Confidence interval for a standardized mean
ci.spear2

Confidence interval for a 2-group Spearman correlation difference
expon.slope

Confidence interval for an exponentiated slope
ci.prop.ps

Confidence interval for a paired-samples proportion difference
ci.slope.mean.bs

Confidence interval for the slope of means in a one-factor experimental design with a quantitative between-subjects factor
ci.ratio.prop2

Confidence interval for a 2-group proportion ratio
ci.slope

Confidence interval for a slope in a simple linear model
ci.tukey

Tukey-Kramer confidence intervals for all pairwise mean differences in a between-subjects design
pi.cronbach

Prediction limits for sample value of Cronbach reliability in a future study
pi.prop

Prediction interval for a sample proportion in a future study
ci.stdmean.strat

Confidence intervals for a 2-group standardized mean difference with stratified sampling
etasqr.adj

Bias adjustment for an eta-squared estimate
fitindices

SEM fit indices
power.lc.mean.bs

Approximates the power of a test for a linear contrast of means for planned sample sizes in a between-subjects design
power.mean2

Approximates the power of a two-sample t-test for planned sample sizes
power.prop

Approximates the power of a 1-group proportion test for a planned sample size
etasqr.gen.2way

Generalized eta-squared estimates in a two-factor design
pi.var

Prediction limits for a sample variance in a future study
logitfit

The confusion matrix is computed using the observed 0 or 1 response variable scores, the predicted probabilities from the logistic model, and a specified cutpoint.
pi.cor

Prediction limits for a sample correlation in a future study
pi.score2

Prediction interval for a difference of scores in a 2-group experiment
ci.var.upper

Upper confidence limit of a variance
ci.yule

Confidence intervals for generalized Yule coefficients
power.cor

Approximates the power of a correlation test for a planned sample size
power.cor2

Approximates the power of a test for equal correlations in a 2-group design for planned sample sizes
random.sample

Generate a random sample
random.y

Generate random sample of scores
power.prop.ps

Approximates the power of a paired-samples test of equal proportions for a planned sample size
power.prop2

Approximates the power of a 2-group proportion test for planned sample sizes
random.yx

Generates random bivariate normal scores
power.mann

Approximates the power of a Mann-Whitney test
random.yx.nonnormal

Generates random bivariate nonnormal scores
pi.score

Prediction interval for one score
pi.score.ps

Prediction interval for difference of scores in a 2-level within-subjects experiment
power.mean

Approximates the power of a one-sample t-test for a planned sample size
sim.ci.cor

Simulates confidence interval coverage probability for a Pearson correlation
sim.ci.stdmean.ps

Simulates confidence interval coverage probability for a standardized mean difference in a paired-samples design
sim.ci.stdmean2

Simulates confidence interval coverage probability for a standardized mean difference in a 2-group design
power.mean.ps

Approximates the power of a paired-samples t-test for a planned sample size
sim.ci.mean.ps

Simulates confidence interval coverage probability for a paired-samples mean difference
sim.ci.mean2

Simulates confidence interval coverage probability for a 2-group mean difference
randomize

Randomize a sample into groups
signal

Parameter estimates for a signal detection study
sim.ci.median.ps

Simulates confidence interval coverage probability for a median difference in a paired-samples design
size.ci.biphi

Sample size for biserial-phi correlation confidence interval
sim.ci.median

Simulates confidence interval coverage probability for a median
size.ci.cor2

Sample size for a 2-group Pearson correlation difference confidence interval
size.ci.cronbach

Sample size for a Cronbach reliability confidence interval
sim.ci.mean

Simulates confidence interval coverage probability for a mean
sim.ci.spear

Simulates confidence interval coverage probability for a Spearman correlation
sim.ci.median2

Simulates confidence interval coverage probability for a median difference in a 2-group design
size.ci.cv

Sample size for a coefficient of variation
size.ci.etasqr

Sample size for an eta-squared confidence interval
size.ci.agree

Sample size for a G-index confidence interval
size.ci.cronbach.prior

Sample size for a Cronbach reliability confidence interval using an reliability estimate from a prior study
size.ci.kendalltau

Sample size for a Kendall-a correlation confidence interval
size.ci.condmean

Sample size for a conditional mean confidence interval
size.ci.gen

Sample size for a confidence interval for any type of parameter
size.ci.cronbach2

Sample size for a 2-group Cronbach reliability difference confidence interval
size.ci.indirect

Sample size for an indirect effect confidence interval
size.ci.icc

Sample size for a intraclass correlation confidence interval
size.ci.lc.ancova

Sample size for a linear contrast confidence interval in an ANCOVA
size.ci.lc.mean.ws

Sample size for a within-subjects mean linear contrast confidence interval
size.ci.gen2

Sample size for a confidence interval for the difference of any type of parameter
size.ci.lc.mean.bs

Sample size for a between-subjects mean linear contrast confidence interval
size.ci.mean.ps.prior

Sample size for a paired-samples mean difference confidence interval using an estimated variance and correlation from a prior study
size.ci.mean.ps

Sample size for a paired-samples mean difference confidence interval
size.ci.lc.stdmean.ws

Sample size for a within-subjects standardized linear contrast of means confidence interval
size.ci.mape

Sample size for a mean absolute prediction error confidence interval
size.ci.lc.stdmean.bs

Sample size for a between-subjects standardized linear contrast of means confidence interval
size.ci.ancova2

Sample size for a 2-group ANCOVA confidence interval
size.ci.cor

Sample size for a Pearson or partial correlation confidence interval
size.ci.lc.prop.bs

Sample size for a between-subjects proportion linear contrast confidence interval
size.ci.pbcor

Sample size for a point-biserial correlation confidence interval
size.ci.cor.prior

Sample size for a Pearson correlation confidence interval using an estimated correlation from a prior study
size.ci.prop.ps

Sample size for a paired-sample proportion difference confidence interval
size.ci.mean2

Sample size for a 2-group mean difference confidence interval
size.ci.lc.median.bs

Sample size for a between-subjects median linear contrast confidence interval
size.ci.median

Sample size for a median confidence interval
size.ci.prop.prior

Sample size for a proportion confidence interval using an estimated proportion from a prior study
size.ci.prop

Sample size for a proportion confidence interval
size.ci.prop2

Sample size for a 2-group proportion difference confidence interval
size.ci.icc.prior

Sample size for an intraclass correlation confidence interval using a planning value from a prior study
size.ci.mean

Sample size for a mean confidence interval
size.ci.second

Sample size for a second-stage confidence interval
size.ci.phi

Sample size for phi correlation confidence interval
size.ci.slope

Sample size for a slope confidence interval
size.ci.mean.prior

Sample size for a mean confidence interval using an estimated variance from a prior study
size.ci.spear2

Sample size for a 2-group Spearman correlation difference confidence interval
size.ci.tetra

Sample size for a tetrachoric correlation confidence interval
size.supinf.mean.ps

Sample size for a paired-samples mean superiority or noninferiority test
size.ci.slope.gen

Sample size for a slope confidence interval in a general statistical model
size.ci.spear

Sample size for a Spearman correlation confidence interval
size.ci.stdmean2

Sample size for a 2-group standardized mean difference confidence interval
size.ci.ratio.mean2

Sample size for a 2-group mean ratio confidence interval
size.ci.rsqr

Sample size for a squared multiple correlation confidence interval
size.ci.ratio.mean.ps

Sample size for a paired-samples mean ratio confidence interval
size.test.cor2

Sample size for a test of equal Pearson or partial correlation in a 2-group design
size.supinf.mean2

Sample size for a 2-group mean superiority or noninferiority test
size.test.cor

Sample size for a test of a Pearson or partial correlation
size.ci.stdmean.ps

Sample size for a paired-samples standardized mean difference confidence interval
size.test.ancova2

Sample size for a 2-group ANCOVA hypothesis test
size.equiv.prop.ps

Sample size for a paired-samples proportion equivalence test
size.equiv.mean2

Sample size for a 2-group mean equivalence test
size.ci.median2

Sample size for a 2-group median difference confidence interval
size.ci.oddsratio

Sample size for an odds ratio confidence interval
size.ci.ratio.prop2

Sample size for a 2-group proportion ratio confidence interval
size.ci.ratio.prop.ps

Sample size for a paired-samples proportion ratio confidence interval
size.test.mann

Sample size for a Mann-Whitney test
size.test.cronbach

Sample size to test a Cronbach reliability
size.test.mean

Sample size for a test of a mean
size.ci.sd

Sample size for a standard deviation confidence interval
size.test.mean2

Sample size for a test of a 2-group mean difference
size.test.mean.ps

Sample size for a test of a paired-samples mean difference
size.ci.yule

Sample size for a Yule's Q confidence interval
size.test.cronbach2

Sample size to test equality of Cronbach reliability coefficients in a 2-group design
size.equiv.mean.ps

Sample size for a paired-samples mean equivalence test
size.test.prop

Sample size for a test of a single proportion
size.test.icc

Sample size to test an intraclass correlation
size.test.gen2

Sample size for a test of 2-group difference for any type of parameter
size.test.prop.ps

Sample size for a test of a paired-samples proportion difference
spearmanbrown

Computes the reliability of a scale with r2 measurements given the reliability of a scale with r1 measurements
slope.contrast

Contrast coefficients for the slope of a quantitative factor
test.kurtosis

Computes p-value for test of excess kurtosis
test.cor2

Hypothesis test for a 2-group Pearson or partial correlation difference
size.test.sign.ps

Sample size for a paired-samples sign test
size.test.slope

Sample size for a test of a slope
test.cor

Hypothesis test for a Pearson or partial correlation
test.anova.bs

Between-subjects F statistic and eta-squared from summary information
size.equiv.prop2

Sample size for a 2-group proportion equivalence test
size.interval.cor

Sample size for an interval test of a Pearson or partial correlation
size.supinf.prop.ps

Sample size for a paired-samples superiority or inferiority test of proportions
test.kurtosis.geary

Computes estimate and test of excess Geary kurtosis
test.prop2

Hypothesis test for a 2-group proportion difference
test.skew

Computes p-value for test of skewness
test.prop

Hypothesis test for a proportion
test.mono.prop.bs

Test of monotonic trend in proportions for an ordered between-subjects factor
test.spear2

Hypothesis test for a 2-group Spearman correlation difference
test.spear

Hypothesis test for a Spearman correlation
size.supinf.prop2

Sample size for a 2-group superiority or inferiority test of proportions
test.mean

Hypothesis test for a mean
size.test.lc.prop.bs

Sample size for a test of between-subjects proportion linear contrast
test.mono.mean.bs

Test of a monotonic trend in means for an ordered between-subjects factor
test.mono.median.bs

Test of a monotonic trend in medians for an ordered between-subjects factor
size.test.lc.mean.ws

Sample size for a test of a within-subjects mean linear contrast
size.test.lc.mean.bs

Sample size for a test of a between-subjects mean linear contrast
size.test.lc.ancova

Sample size for a mean linear contrast test in an ANCOVA
size.test.prop2

Sample size for a test of a 2-group proportion difference
size.test.gen

Sample size for a test of any type of parameter
test.prop.bs

Hypothesis test of equal proportions in a between-subjects design
test.prop.ps

Hypothesis test for a paired-samples proportion difference
size.test.sign

Sample size for a 1-group sign test
adj.se

Adjusted standard errors for slope coefficients in an exploratory analysis
ci.2x2.prop.mixed

Computes tests and confidence intervals of effects in a 2x2 mixed design for proportions
ci.2x2.stdmean.bs

Computes confidence intervals of standardized effects in a 2x2 between-subjects design
ci.2x2.median.ws

Computes confidence intervals of effects in a 2x2 within-subjects design for medians
ci.2x2.prop.bs

Computes tests and confidence intervals of effects in a 2x2 between- subjects design for proportions
ci.2x2.mean.bs

Computes tests and confidence intervals of effects in a 2x2 between-subjects design for means
ci.2x2.median.bs

Computes tests and confidence intervals of effects in a 2x2 between-subjects design for medians
ci.2x2.mean.ws

Computes tests and confidence intervals of effects in a 2x2 within-subjects design for means
ci.2x2.mean.mixed

Computes tests and confidence intervals of effects in a 2x2 mixed design for means
ci.2x2.median.mixed

Computes confidence intervals in a 2x2 mixed design for medians