Specification Curve
Specification Curve is a Python package that performs specification curve analysis; it helps with the problem of the "garden of forking paths" (many defensible choices) when doing analysis by running many regressions and summarising the estimated coefficients in an easy to digest chart. Estimation is done by pyfixest, so specifications can vary the outcome, the regressor of interest, controls, fixed effects, instruments, standard errors, weights, the sample and the estimator (OLS, Poisson, logit, probit and quantile regression).
Go to the full documentation for Specification Curve.
Quickstart
import specification_curve as sc
df = sc.load_example_panel() # a made-up panel of firms
sco = sc.SpecificationCurve(
df,
y="log(sales)",
x="treated",
controls=["size", "leverage", "rd"],
fe=[None, "firm", "firm + year"],
vcov=["hetero", {"CRV1": "firm"}],
)
sco.fit()
sco.plot()
Each column is one specification. Here the true effect is 0.3, and the specifications without firm fixed effects overstate it. The estimates are in sco.results, one row per specification.
The same specifications can be written as a pyfixest formula, with comb0() standing for every combination of its terms:
sco = sc.SpecificationCurve(
df,
"log(sales) ~ treated + comb0(size, leverage, rd) | sw0(firm, firm + year)",
x="treated",
vcov=["hetero", {"CRV1": "firm"}],
)
Installation
You can install Specification Curve via uv:
uv add specification-curve
To install the development version from git, use:
pip install git+https://github.com/aeturrell/specification_curve.git
Citing Specification Curve
You can find full citation information at the following link: https://zenodo.org/badge/latestdoi/282989537.
Using Specification Curve in your paper? Let us know by raising an issue beginning with "citation".
License
Distributed under the terms of the MIT license.
Similar Packages
In RStats, there is specr (which inspired many design choices in this package) and spec_chart. Some of the example data in this package is the same as in specr, but please note that results have not been cross-checked across packages.
Metadata
Release files for specification-curve 0.4.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| specification_curve-0.4.2.tar.gz | 312.4 kB | Without provenance | Details for specification_curve-0.4.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| specification_curve-0.4.2-py3-none-any.whl | Python 3 | none | any | Details for specification_curve-0.4.2-py3-none-any.whl |
Total release size: 381.6 kB
Release files / specification_curve-0.4.2.tar.gz
| Download URL | specification_curve-0.4.2.tar.gz |
|---|---|
| Size | 312.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aecb924f086200768f79a27c32313eb6feca8d877ddc66933b864a7408007cf4
|
|
BLAKE2b-256 checksum How to use checksums |
6c3214a2700a12bf290d5855baa9538bad2267404559c359db07cb7ab53a3433
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / specification_curve-0.4.2-py3-none-any.whl
| Download URL | specification_curve-0.4.2-py3-none-any.whl |
|---|---|
| Size | 69.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
21ea36160016c47f4732280a5f73e132f00ca4f2f6cdadd2e791966c2996b35b
|
|
BLAKE2b-256 checksum How to use checksums |
70489f6cd64fd8bf78f1cf6adea33eb17bb9ea6d75826eaa9531aa6fe99133da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for specification-curve 0.4.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.