Learn R Programming

⚠️There's a newer version (2.0.0) of this package.Take me there.

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

617

Version

1.9.0

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Douglas G. Bonett

Last Published

January 13th, 2026

Functions in statpsych (1.9.0)

ci.biphi

Confidence interval for a biserial-phi correlation
ci.agree

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

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

Confidence interval for G-index difference in a 2-group design
ci.2x2.stdmean.mixed

Computes confidence intervals of standardized effects in a 2x2 mixed design
ci.agree.3rater

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

Bayesian credible interval for a normal prior distribution
ci.bayes.cor

Bayesian credible interval for a Pearson or partial correlation with a skeptical prior
ci.bayes.prop

Bayesian credible interval for a proportion
ci.2x2.stdmean.ws

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

Confidence interval for a coefficient of quartile variation
ci.bscor

Confidence interval for a biserial correlation
ci.cor2

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

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

Confidence interval for a Pearson or partial correlation
ci.cod

Confidence interval for a coefficient of dispersion
ci.cor.dep

Confidence interval for a difference in dependent Pearson correlations
ci.condslope.log

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

Fisher confidence interval
ci.cronbach

Confidence interval for a Cronbach reliability
ci.indirect

Confidence interval for an indirect effect
ci.etasqr

Confidence interval for eta-squared
ci.icc

Confidence interval for an intraclass reliablity coefficient
ci.kappa

Confidence interval for two kappa reliability coefficients
ci.lc.gen.bs

Confidence interval for a linear contrast of parameters in a between-subjects design
ci.cramer

Confidence interval for Cramer's V
ci.cv

Confidence interval for a coefficient of variation
ci.diversity

Confidence intervals for diversity indices
ci.cor2.gen

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

Confidence interval for a difference in Cronbach reliabilities in a 2-group design
ci.lc.glm

Confidence interval for a linear contrast of general linear model parameters
ci.lc.stdmean.ws

Confidence interval for a standardized linear contrast of means in a within-subjects design
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.lc.prop.bs

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

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

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

Confidence interval for a paired-samples median difference
ci.lc.mean.bs

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

Confidence interval for a Mann-Whitney parameter
ci.mean

Confidence interval for a mean
ci.mean.fpc

Confidence interval for a mean with a finite population correction
ci.median2

Confidence interval for a 2-group median difference
ci.mape

Confidence interval for a mean absolute prediction error
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.mean.gen

Confidence intervals for generalized means
ci.pairs.prop.bs

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

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

Confidence intervals for point-biserial correlations
ci.random.anova

Confidence intervals for parameters of one-way random effects ANOVA
ci.phi

Confidence interval for a phi correlation
ci.poisson

Confidence interval for a Poisson rate
ci.ratio.cod2

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

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

Confidence intervals for a proportion
ci.popsize

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

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

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

Confidence intervals for positive and negative predictive values with retrospective sampling
ci.lc.stdmean.bs

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

Confidence interval for a linear contrast of regression coefficients in multiple group regression model
ci.prop.ps

Confidence interval for a paired-samples proportion difference
ci.oddsratio

Confidence interval for an odds ratio
ci.ratio.mean.ps

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

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

Confidence interval for a median
ci.ratio.poisson2

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

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

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

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

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

Confidence interval for the parameter of the one-sample sign test
ci.ratio.prop.ps

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

Confidence interval for a semipartial correlation
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.ratio.mad2

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

Confidence intervals for pairwise proportion differences of a multinomial variable
ci.tetra

Confidence interval for a tetrachoric correlation
ci.ratio.median2

Confidence interval for a 2-group median ratio
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.median.ps

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

Confidence interval for a 2-group proportion difference
ci.slope.median.bs

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

Theil-Sen estimate and confidence interval for slope
ci.stdmean2

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

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

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

Upper confidence limit of a variance
ci.tukey

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

Prediction interval for a sample proportion in a future study
expon.slope

Confidence interval for an exponentiated slope
power.mean.ps

Approximates the power of a paired-samples t-test for a planned sample size
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
iqv

Indices of qualitative variation
pi.score

Prediction interval for one score
ci.yule

Confidence intervals for generalized Yule coefficients
power.mean2

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

Confidence interval for a 2-group reliability difference
ci.spear

Confidence interval for a Spearman correlation
ci.reliability

Confidence interval for a reliability coefficient
ci.ratio.mape2

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

Confidence interval for a 2-group Spearman correlation difference
ci.stdmean

Confidence interval for a standardized mean
etasqr.adj

Bias adjustment for an eta-squared estimate
power.prop

Approximates the power of a 1-group proportion test for a planned sample size
random.sample

Generate a random sample
power.mean

Approximates the power of a one-sample t-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
fitindices

SEM fit indices
signal

Parameter estimates for a signal detection study
ci.rsqr

Confidence interval for squared multiple correlation
ci.stdmean.ps

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

Simulates confidence interval coverage probability for a Pearson correlation
randomize

Randomize a sample into groups
random.yx

Generates random bivariate scores
sim.ci.spear

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

Simulates confidence interval coverage probability for a standardized mean difference in a paired-samples design
random.y

Generate random sample of scores
size.ci.ancova2

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

Sample size for biserial-phi correlation confidence interval
ci.sd

Confidence interval for a standard deviation
pi.var

Prediction limits for a sample variance in a future study
power.cor

Approximates the power of a correlation test for a planned sample size
pi.score.ps

Prediction interval for difference of scores in a 2-level within-subjects experiment
pi.score2

Prediction interval for a difference of scores in a 2-group experiment
sim.ci.median

Simulates confidence interval coverage probability for a median
sim.ci.mean2

Simulates confidence interval coverage probability for a 2-group mean difference
size.ci.agree

Sample size for a G-index confidence interval
size.ci.cronbach2

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

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

Simulates confidence interval coverage probability for a median difference in a paired-samples design
pi.cor

Prediction limits for a sample correlation in a future study
size.ci.cv

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

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

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

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

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

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

Sample size for a intraclass correlation confidence interval
size.ci.icc.prior

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

Sample size for a confidence interval for the difference of any type of parameter
pi.cronbach

Prediction limits for sample value of Cronbach reliability in a future study
size.ci.etasqr

Sample size for an eta-squared confidence interval
size.ci.lc.median.bs

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

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

Sample size for a median confidence interval
size.ci.gen

Sample size for a confidence interval for any type of parameter
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.mean.ps

Sample size for a paired-samples mean difference confidence interval
size.ci.indirect

Sample size for an indirect effect confidence interval
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.pbcor

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

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

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

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

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

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

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

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

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

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

Sample size for a Spearman correlation confidence interval
size.ci.slope.gen

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

Sample size for a slope confidence interval
size.ci.ratio.mean.ps

Sample size for a paired-samples mean ratio confidence interval
size.ci.spear2

Sample size for a 2-group Spearman correlation difference confidence interval
power.prop.ps

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

Simulates confidence interval coverage probability for a mean
power.prop2

Approximates the power of a 2-group proportion test for planned sample sizes
size.ci.tetra

Sample size for a tetrachoric correlation confidence interval
size.ci.yule

Sample size for a Yule's Q confidence interval
size.equiv.mean.ps

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

Sample size for a test of a Pearson or partial correlation
size.equiv.mean2

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

Sample size for a paired-sample proportion difference confidence interval
size.supinf.mean.ps

Sample size for a paired-samples mean superiority or noninferiority test
size.interval.cor

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

Sample size for a paired-samples proportion equivalence test
size.ci.condmean

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

Sample size for a Pearson or partial correlation confidence interval
size.ci.cor.prior

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

Simulates confidence interval coverage probability for a paired-samples mean difference
size.equiv.prop2

Sample size for a 2-group proportion equivalence test
size.ci.cor2

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

Sample size for a linear contrast confidence interval in an ANCOVA
size.test.gen2

Sample size for a test of 2-group difference for any type of parameter
size.supinf.mean2

Sample size for a 2-group mean superiority or noninferiority test
size.ci.lc.mean.bs

Sample size for a between-subjects mean linear contrast confidence interval
size.test.mean

Sample size for a test of a mean
size.test.cor2

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

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

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

Sample size for a test of any type of parameter
size.test.mann

Sample size for a Mann-Whitney test
size.ci.ratio.mean2

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

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

Sample size for a proportion confidence interval
size.test.lc.mean.ws

Sample size for a test of a within-subjects mean linear contrast
size.ci.ratio.prop.ps

Sample size for a paired-samples proportion ratio confidence interval
size.ci.stdmean.ps

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

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

Sample size for a test of a single proportion
size.test.prop.ps

Sample size for a test of a paired-samples proportion difference
size.test.mean.ps

Sample size for a test of a paired-samples mean difference
size.test.lc.prop.bs

Sample size for a test of between-subjects proportion linear contrast
size.test.mean2

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

Computes p-value for test of skewness
size.test.lc.ancova

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

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

Sample size for a test of a slope
test.mono.mean.bs

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

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

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

Hypothesis test for a 2-group Pearson or partial correlation difference
size.ci.stdmean2

Sample size for a 2-group standardized mean difference confidence interval
test.spear

Hypothesis test for a Spearman correlation
test.kurtosis

Computes p-value for test of excess kurtosis
test.mono.median.bs

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

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

Hypothesis test for a paired-samples proportion difference
test.prop2

Hypothesis test for a 2-group proportion difference
slope.contrast

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

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

Between-subjects F statistic and eta-squared from summary information
spearmanbrown

Computes the reliability of a scale with r2 measurements given the reliability of a scale with r1 measurements
size.test.ancova2

Sample size for a 2-group ANCOVA hypothesis test
size.supinf.prop2

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

Sample size for a 1-group sign test
test.prop.bs

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

Hypothesis test for a 2-group Spearman correlation difference
size.test.prop2

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

Hypothesis test for a proportion
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.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
ci.2x2.stdmean.bs

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

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

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

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

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

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