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

360

Version

1.8.0

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Douglas G. Bonett

Last Published

June 10th, 2025

Functions in statpsych (1.8.0)

ci.2x2.median.mixed

Computes confidence intervals in a 2x2 mixed design for medians
adj.se

Adjusted standard errors for slope coefficients in an exploratory analysis
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.ws

Computes tests and confidence intervals of effects in a 2x2 within-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.stdmean.ws

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

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

Bayesian credible interval for a Pearson or partial correlation with a skeptical prior
ci.2x2.stdmean.mixed

Computes confidence intervals of standardized effects in a 2x2 mixed design
ci.bayes.normal

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

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

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

Confidence interval for a biserial-phi correlation
ci.agree

Confidence interval for a G-index of agreement
ci.bscor

Confidence interval for a biserial correlation
ci.condslope

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

Confidence interval for a coefficient of quartile variation
ci.cor2

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

Bayesian credible interval for a proportion
ci.condslope.log

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

Confidence interval for a Cronbach reliability
ci.cor

Confidence interval for a Pearson or partial correlation
ci.cronbach2

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

Confidence interval for an indirect effect
ci.fisher

Fisher confidence interval
ci.lc.median.bs

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

Confidence interval for a mean
ci.cor2.gen

Confidence interval for a 2-group correlation difference
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.lc.prop.bs

Confidence interval for a linear contrast of proportions in a between- subjects design
ci.cor.dep

Confidence interval for a difference in dependent Pearson correlations
ci.lc.glm

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

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

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

Confidence interval for a mean absolute prediction error
ci.kappa

Confidence interval for two kappa reliability coefficients
ci.cod

Confidence interval for a coefficient of dispersion
ci.lc.gen.bs

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

Confidence interval for a Mann-Whitney parameter
ci.mean.fpc

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

Confidence interval for a mean absolute deviation
ci.median2

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

Confidence interval for a median
ci.median.ps

Confidence interval for a paired-samples median difference
ci.ratio.median2

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

Confidence interval for a paired-samples mean difference
ci.prop.ps

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

Confidence interval for an odds ratio
ci.prop.inv

Confidence interval for a proportion using inverse sampling
ci.ratio.mad2

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

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

Confidence interval for a Poisson rate
ci.ratio.mean.ps

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

Confidence interval for an unknown population size
ci.ratio.mape2

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

Confidence interval for Cramer's V
ci.cv

Confidence interval for a coefficient of variation
ci.sign

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

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

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

Confidence interval for a tetrachoric correlation
ci.rsqr

Confidence interval for squared multiple correlation
ci.spear2

Confidence interval for a 2-group Spearman correlation difference
ci.ratio.median.ps

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

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

Confidence interval for a reliability coefficient
ci.ratio.mean2

Confidence interval for a 2-group mean ratio
ci.random.anova

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

Confidence interval for a standardized mean
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.rel2

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

Confidence interval for a 2-group proportion difference
ci.prop2.inv

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

Confidence interval for eta-squared
ci.ratio.prop.ps

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

Confidence intervals for point-biserial correlations
ci.slope.mean.bs

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

Confidence interval for a semipartial correlation
ci.spear

Confidence interval for a Spearman correlation
ci.ratio.prop2

Confidence interval for a 2-group proportion ratio
power.mean

Approximates the power of a one-sample t-test for a planned sample size
ci.var.upper

Upper confidence limit of a variance
pi.prop

Prediction interval for an estimated proportion
pi.score

Prediction interval for one score
ci.phi

Confidence interval for a phi correlation
ci.prop

Confidence intervals for a proportion
ci.ratio.cv2

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

Confidence interval for a proportion with a finite population correction
ci.ratio.cod2

Confidence interval for a ratio of dispersion coefficients in a 2-group design
ci.slope.median.bs

Confidence interval for the slope of medians in a one-factor experimental design with a quantitative between-subjects factor
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.stdmean.ps

Confidence intervals for a paired-samples standardized mean difference
power.mean.ps

Approximates the power of a paired-samples t-test for a planned sample size
power.mean2

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

Confidence intervals for generalized Yule coefficients
random.yx

Generates random bivariate scores
power.prop

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

Generate a random sample
sim.ci.median.ps

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

Simulates confidence interval coverage probability for a median difference in a 2-group design
randomize

Randomize a sample into groups
expon.slope

Confidence interval for an exponentiated slope
ci.theil

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

Tukey-Kramer confidence intervals for all pairwise mean differences in a between-subjects design
fitindices

SEM fit indices
power.prop.ps

Approximates the power of a paired-samples test of equal proportions 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
sim.ci.spear

Simulates confidence interval coverage probability for a Spearman correlation
power.prop2

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

Confidence intervals for a 2-group standardized mean difference with stratified sampling
size.ci.prop

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

Sample size for a conditional mean confidence interval
power.cor2

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

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

Sample size for a mean confidence interval
etasqr.adj

Bias adjustment for an eta-squared estimate
etasqr.gen.2way

Generalized eta-squared estimates in a two-factor design
size.ci.biphi

Sample size for biserial-phi correlation confidence interval
random.y

Generate random sample of scores
size.ci.ancova2

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

Sample size for a proportion confidence interval using a planning value from a prior study
pi.score.ps

Prediction interval for difference of scores in a 2-level within-subjects experiment
sim.ci.stdmean.ps

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

Prediction limits for an estimated correlation
iqv

Indices of qualitative variation
size.ci.cronbach

Sample size for a Cronbach reliability confidence interval
signal

Parameter estimates for a signal detection study
pi.score2

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

Simulates confidence interval coverage probability for a Pearson correlation
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.lc.stdmean.bs

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

Sample size for a Pearson or partial correlation confidence interval
size.ci.lc.stdmean.ws

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

Sample size for a Pearson correlation confidence interval using a planning value from a prior study
size.ci.lc.median.bs

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

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

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

Sample size for a confidence interval for the difference of any type of parameter
size.ci.ratio.mean2

Sample size for a 2-group mean ratio confidence interval
size.equiv.mean.ps

Sample size for a paired-samples mean equivalence test
size.ci.ratio.mean.ps

Sample size for a paired-samples mean ratio confidence interval
size.ci.lc.prop.bs

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

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

Sample size for a point-biserial correlation confidence interval
size.equiv.mean2

Sample size for a 2-group mean equivalence test
pi.var

Prediction limits for an estimated variance
size.ci.slope

Sample size for a slope confidence interval
size.ci.lc.mean.ws

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

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

Sample size for a 2-group Cronbach reliability difference confidence interval
power.cor

Approximates the power of a correlation test for a planned sample size
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.interval.cor

Sample size for an interval test of a Pearson or partial correlation
size.ci.spear2

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

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

Sample size for a squared multiple correlation confidence interval
size.ci.cor2

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

Sample size for an indirect effect confidence interval
size.supinf.prop2

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

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

Sample size for a 2-group ANCOVA hypothesis test
size.test.lc.mean.bs

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

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

Sample size for a tetrachoric correlation confidence interval
sim.ci.mean

Simulates confidence interval coverage probability for a mean
size.equiv.prop.ps

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

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

Sample size for a paired-samples mean superiority or noninferiority test
sim.ci.stdmean2

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

Sample size for a G-index confidence interval
sim.ci.mean.ps

Simulates confidence interval coverage probability for a paired-samples mean difference
size.ci.median2

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

Sample size for a linear contrast confidence interval in an ANCOVA
size.ci.oddsratio

Sample size for an odds ratio confidence interval
size.test.gen

Sample size for a test of any type of parameter
size.supinf.mean2

Sample size for a 2-group mean superiority or noninferiority test
size.supinf.prop.ps

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

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

Sample size for an eta-squared confidence interval
size.ci.prop.ps

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

Sample size for a mean confidence interval using a planning value from a prior study
size.ci.mean.ps

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

Sample size for a 2-group proportion difference confidence interval
size.test.sign.ps

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

Sample size for a test of a slope
size.ci.ratio.prop.ps

Sample size for a paired-samples proportion ratio confidence interval
spearmanbrown

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

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

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

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

Test of a monotonic trend in means for an ordered between-subjects factor
size.ci.ratio.prop2

Sample size for a 2-group proportion ratio confidence interval
size.test.prop2

Sample size for a test of a 2-group proportion difference
size.ci.stdmean.ps

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

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

Hypothesis test for a proportion
size.test.sign

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

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

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

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

Hypothesis test for a paired-samples proportion difference
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.test.cor

Sample size for a test of a Pearson or partial correlation
size.test.cronbach2

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

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

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

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

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

Hypothesis test for a 2-group proportion difference
size.test.mean.ps

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

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

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

Hypothesis test for a Spearman correlation
size.test.slope.gen

Sample size for a slope hypothesis test in a general statistical model
slope.contrast

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

Hypothesis test for a Pearson or partial correlation
test.cor2

Hypothesis test for a 2-group Pearson or partial correlation difference
test.mean

Hypothesis test for a mean
size.test.prop

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

Computes p-value for test of excess kurtosis
size.test.prop.ps

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

Computes p-value for test of skewness
ci.2x2.mean.bs

Computes tests and confidence intervals of effects in a 2x2 between-subjects design for means
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.mean.mixed

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