Skip to content
masurpPublic

About

Conducting and Visualizing Specification Curve Analyses

Topics

Resources

Code of conduct

Contributing

Stars

73 stars

Watchers

4 watching

Forks

Repository files navigation

specr logo

specr

Conducting and Visualizing Specification Curve Analyses

CRAN status CRAN downloads Lifecycle: stable R-CMD-check

News

  • 16 October 2026: specr version 1.1.0 is now available via CRAN. It adds the function infer_curve() to conduct inference on the specification curve (the third step outlined by Simonsohn et al., 2020), accepts a named list of model functions in setup(), can show the choice labels on the left side of the plot, and fixes several bugs. See this vignette and the version history for details.

  • 14 October 2026: The inference procedure of the development version (specr version 1.0.1) has been rewritten. The new function infer_curve() replaces boot_null(), which refitted each specification on too many rows and therefore produced p-values that were too small. infer_curve() is calibrated (about 5% false positives at alpha = .05 in simulations), much faster, and reports all three test statistics proposed by Simonsohn et al. (2020). If you have used boot_null(), please recompute your results. See this vignette and the version history for details.

  • 22 May 2024: The new development version (specr version 1.0.1) includes new functions to conduct inferences on the specification curve analysis (the third step outlined Simonsohn et al., 2020). See this vignette for further details.

  • 20 January 2023: specr version 1.0.0 is now available via CRAN. This is a major update with several new features and functions. Note: it introduces a new framework for conducting specification curve analyses compared to earlier versions (see version history for more details).

  • 4 December 2020: specr development version 0.2.2 is available via github. Mostly minor updates and bug fixes.

  • 26 March 2020: specr version 0.2.1 has been released on CRAN.

What is specr?

The goal of specr is to facilitate specification curve analyses (Simonsohn, Simmons & Nelson, 2020; also known as multiverse analyses, see Steegen, Tuerlinckx, Gelman & Vanpaemel, 2016). The package can be used to investigate how different (theoretically plausible) analytical choices affect outcome statistics within the universe of one single data set. It provides functions to setup, run, evaluate, and plot the multiverse of specifications. A simple example of how to use specr is provided below. For more information about the various functions and specific vignettes and use cases, visit the documentation.

Disclaimer

We do see a lot of value in investigating how analytical choices affect a statistical outcome of interest. However, we strongly caution against using specr as a tool to somehow arrive at a better estimate. Running a specification curve analysis does not make your findings any more reliable, valid or generalizable than a single analysis. The method is only meant to inform about the effects of analytical choices on results, and not a better way to estimate a correlation or effect.

Installation

Install specr from CRAN:

install.packages("specr")  

Or install the most recent development version from GitHub with:

# install.packages("devtools")
devtools::install_github("masurp/specr")  

Usage

Using specr is comparatively simple. The two main functions are setup(), in which analytic choices are specified as arguments, and specr(), which fits the models across all specifications. The latter creates a class called “specr.object”, which can be summarized and plotted with generic function such as summary or plot.

# Load package ----
library(specr)

# Setup Specifications ----
specs <- setup(data = example_data, 
               y = c("y1", "y2"), 
               x = c("x1", "x2"), 
               model = c("lm"),
               controls = c("c1", "c2"),
               subsets = list(group1 = unique(example_data$group1),
                              group2 = unique(example_data$group2)))

# Run Specification Curve Analysis ----
results <- specr(specs)

# Plot Specification Curve ----
plot(results)

Specification curve (estimates ranked from lowest to highest with confidence intervals) and the analytical choices of each specification

How to cite this package

citation("specr")
#> To cite 'specr' in publications use:
#> 
#>   Masur, P. K., & Scharkow, M. (2026). specr: Conducting and
#>   Visualizing Specification Curve Analyses (Version 1.1.0).
#>   https://CRAN.R-project.org/package=specr
#> 
#> A BibTeX entry for LaTeX users is
#> 
#>   @Misc{specr,
#>     title = {specr: Conducting and Visualizing Specification Curve Analyses (Version 1.1.0)},
#>     author = {Philipp K. Masur and Michael Scharkow},
#>     year = {2026},
#>     url = {https://CRAN.R-project.org/package=specr},
#>   }

References

Other resources on multiverse/specification curve analyses

The following papers and websites are interesting resources to explore the method further and learn about potential promises and pitfalls:

Papers that used ‘specr’

If you have published a paper in which you used specr and you would like to be included in the following list, please send an email to Philipp.

About

Conducting and Visualizing Specification Curve Analyses

Topics

Resources

Code of conduct

Contributing

Stars

73 stars

Watchers

4 watching

Forks

Releases

Packages

Used by

Contributors

Languages