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

339

Version

1.7.0

License

GPL-3

Issues

Pull Requests

Stars

Forks

Last Published

December 19th, 2024

Functions in statpsych (1.7.0)

ci.2x2.prop.bs

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

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

Computes confidence intervals in a 2x2 mixed design for medians
ci.2x2.mean.bs

Computes tests and confidence intervals of effects in a 2x2 between-subjects design for means
adj.se

Adjusted standard errors for slope coefficients in an exploratory analysis
ci.agree2

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

Confidence interval for a G-index of agreement
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.prop

Bayesian credible interval for a proportion
ci.2x2.mean.mixed

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

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

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

Confidence interval for a biserial-phi correlation
ci.bayes.spcor

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

Confidence interval for a Mann-Whitney parameter
ci.cor2.gen

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

Confidence interval for eta-squared
ci.cv

Confidence interval for a coefficient of variation
ci.cor2

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

Confidence interval for a mean absolute prediction error
ci.bayes.cor

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

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

Confidence interval for a Cronbach reliability
ci.cor

Confidence interval for a Pearson or partial correlation
ci.cor.dep

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

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

Confidence interval for Cramer's V
ci.cqv

Confidence interval for a coefficient of quartile variation
ci.mean

Confidence interval for a mean
ci.mean.ps

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

Confidence interval for a mean with a finite population correction
ci.condslope.log

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

Confidence interval for a mean absolute deviation
ci.lc.stdmean.ws

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

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

Fisher confidence interval
ci.mean2

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

Confidence interval for an indirect effect
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.oddsratio

Confidence interval for an odds ratio
ci.median2

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

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

Confidence interval for a biserial correlation
ci.lc.median.bs

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

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

Confidence interval for two kappa reliability coefficients
ci.pbcor

Confidence intervals for point-biserial correlations
ci.cod

Confidence interval for a coefficient of dispersion
ci.prop.fpc

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

Confidence intervals for a proportion
ci.random.anova

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

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

Confidence interval for a phi correlation
ci.ratio.mad.ps

Confidence interval for a paired-samples MAD ratio
ci.lc.gen.bs

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

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

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

Confidence interval for a proportion using inverse sampling
ci.poisson

Confidence interval for a Poisson rate
ci.prop.ps

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

Confidence interval for a 2-group median ratio
ci.lc.reg

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

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

Confidence interval for a 2-group ratio of standard deviations
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.rel2

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

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

Confidence interval for a Spearman correlation
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.slope.prop.bs

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

Confidence interval for a semipartial correlation
ci.stdmean

Confidence interval for a standardized mean
ci.stdmean.ps

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

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

Confidence interval for a 2-group Spearman correlation difference
pi.prop

Prediction interval for an estimated proportion
pi.cor

Prediction limits for an estimated correlation
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
power.mean

Approximates the power of a one-sample t-test for a planned sample size
power.mean.ps

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

Confidence interval for a reliability coefficient
ci.lc.stdmean.bs

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

Confidence interval for squared multiple correlation
sim.ci.median2

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

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

Sample size for a conditional mean confidence interval
sim.ci.spear

Simulates confidence interval coverage probability for a Spearman correlation
size.ci.cor

Sample size for a Pearson or partial correlation confidence interval
size.ci.ratio.mean.ps

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

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

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

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

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

Confidence interval for a tetrachoric correlation
ci.sign

Confidence interval for the parameter of the one-sample sign test
ci.slope.mean.bs

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

Tukey-Kramer confidence intervals for all pairwise mean differences in a between-subjects design
ci.var.upper

Upper confidence limit of a variance
ci.ratio.prop.ps

Confidence interval for a paired-samples proportion ratio
pi.score.ps

Prediction interval for difference of scores in a 2-level within-subjects experiment
ci.ratio.prop2

Confidence interval for a 2-group proportion ratio
pi.score

Prediction interval for one score
size.ci.ratio.mean2

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

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

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

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

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

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

Sample size for a Cronbach reliability confidence interval
size.test.lc.mean.ws

Sample size for a test of a within-subjects mean linear contrast
size.ci.cronbach2

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

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

Sample size for a mean confidence interval using a planning value from a prior study
size.test.prop2

Sample size for a test of a 2-group proportion difference
spearmanbrown

Computes the reliability of a scale with r2 measurements given the reliability of a scale with r1 measurements
size.test.lc.prop.bs

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

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

Between-subjects F statistic and eta-squared from summary information
size.ci.spear

Sample size for a Spearman correlation confidence interval
size.ci.prop.prior

Sample size for a proportion confidence interval using a planning value from a prior study
size.ci.prop

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

Sample size for a 2-group Spearman correlation difference confidence interval
size.test.cronbach

Sample size to test a Cronbach reliability
iqv

Indices of qualitative variation
fitindices

SEM fit indices
size.test.slope.gen

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

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

Contrast coefficients for the slope of a quantitative factor
test.prop.bs

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

Hypothesis test for a proportion
ci.median

Confidence interval for a median
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.adj

Bias adjustment for an eta-squared estimate
ci.yule

Confidence intervals for generalized Yule coefficients
pi.score2

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

Prediction limits for an estimated variance
ci.median.ps

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

Confidence interval for a 2-group proportion difference
signal

Parameter estimates for a signal detection study
sim.ci.cor

Simulates confidence interval coverage probability for a Pearson correlation
size.ci.lc.mean.bs

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

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

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

Sample size for a linear contrast confidence interval in an ANCOVA
size.ci.lc.prop.bs

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

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

Sample size for a point-biserial correlation confidence interval
random.sample

Generate a random sample
random.y

Generate random sample of scores
size.ci.cor2

Sample size for a 2-group Pearson correlation difference confidence interval
test.prop2

Hypothesis test for a 2-group proportion difference
size.ci.cor.prior

Sample size for a Pearson correlation confidence interval using a planning value from a prior study
ci.prop2.inv

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

Hypothesis test for a paired-samples proportion difference
power.cor2

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

Sample size for a 2-group mean difference confidence interval
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
size.ci.phi

Sample size for phi correlation confidence interval
size.ci.stdmean.ps

Sample size for a paired-samples standardized mean difference confidence interval
random.yx

Generates random bivariate scores
size.ci.stdmean2

Sample size for a 2-group standardized mean difference confidence interval
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.cor2

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

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

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

Sample size for an odds ratio confidence interval
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
test.kurtosis

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

Hypothesis test for a mean
expon.slope

Confidence interval for an exponentiated slope
pi.var.upper

Upper prediction limit for an estimated variance
size.ci.ancova2

Sample size for a 2-group ANCOVA confidence interval
randomize

Randomize a sample into groups
size.ci.tetra

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

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

Sample size for an indirect effect 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.ci.etasqr

Sample size for an eta-squared confidence interval
size.equiv.prop2

Sample size for a 2-group proportion equivalence test
size.test.prop

Sample size for a test of a single proportion
power.cor

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

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

Sample size for a Yule's Q confidence interval
sim.ci.mean

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

Simulates confidence interval coverage probability for a 2-group mean difference
size.ci.lc.stdmean.ws

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

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

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

Sample size for a slope confidence interval in a general statistical model
size.supinf.prop.ps

Sample size for a paired-samples superiority or inferiority test of proportions
size.supinf.mean.ps

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

Simulates confidence interval coverage probability for a paired-samples mean difference
size.ci.lc.stdmean.bs

Sample size for a between-subjects standardized linear contrast of means confidence interval
size.test.lc.ancova

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

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

Simulates confidence interval coverage probability for a median
size.test.prop.ps

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

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

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

Sample size for a test of a slope
size.test.sign.ps

Sample size for a paired-samples sign test
test.mono.mean.bs

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

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

Hypothesis test for a Pearson or partial correlation
size.test.mann

Sample size for a Mann-Whitney test
test.cor2

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

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

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

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

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

Hypothesis test for a Spearman correlation
test.skew

Computes p-value for test of skewness
ci.2x2.median.ws

Computes confidence intervals of effects in a 2x2 within-subjects design for medians