Skip to main content

delicatessen

Delicatessen

tests version arXiv docs Downloads

The one-stop sandwich (variance) shop in Python. delicatessen is a Python 3.8+ library for the generalized calculus of M-estimation.

Citation: Zivich PN, Klose M, Cole SR, Edwards JK, & Shook-Sa BE. (2022). Delicatessen: M-Estimation in Python. arXiv:2203.11300 [stat.ME]

M-Estimation and Estimating Equations

Here, we provide a brief overview of M-estimation theory. For more detailed introductions to M-estimation, see Ross et al. (2024), Stefanski & Boos (2002), or Chapter 7 of Boos & Stefanski (2013). M-estimation is a generalization of likelihood-based methods. M-estimators are solutions to estimating equations. To apply the M-estimator, we solve the estimating equations using observed data. This is similar to other approaches, but the key advantage of M-Estimators is variance estimation via the empirical sandwich variance estimator.

While M-Estimation is a powerful tool, the derivatives and matrix algebra can quickly become unwieldy. This is where delicatessen comes in. delicatessen takes estimating functions and data, and solves for the parameter estimates, computes the derivatives, and performs the matrix algebra calculations. Therefore, M-estimators can be more easily adopted without having to perform by-hand calculations. In other words, we can let the computer do the math for us.

To further ease use, delicatessen also comes with a variety of built-in estimating equations. See the delicatessen website for details on the available estimating equations, how to use them, and practical examples.

Installation

Installing:

You can install via python -m pip install delicatessen

Dependencies:

The dependencies are: numpy, scipy

To replicate the tests located in tests/, you will additionally need to install: panda, statsmodels, and pytest

While versions of delicatessen prior to v1.0 were compatible with older versions of Python 3 and NumPy and SciPy, the v1.0+ releases are only available for Python 3.8+ with NumPy v1.18.5+ and SciPy v1.9.0. This change was made to use a better numerical approximation procedure for the derivative. If you want to use with older versions of those packages or older versions of Python, install v0.6 instead.

Getting started

Below is a simple demonstration of calculating the mean with delicatessen

import numpy as np
y = np.array([1, 2, 3, 1, 4, 1, 3, -2, 0, 2])

Loading the M-estimator functionality, building the corresponding estimating equation for the mean, and printing the results to the console

from delicatessen import MEstimator

def psi(theta):
    return y - theta[0]

estr = MEstimator(psi, init=[0, ])
estr.estimate()

print(estr.theta)     # Estimate of the mean
print(estr.variance)  # Variance estimate

For further details on using delicatessen, see the full documentation and worked examples available at delicatessen website.

References

Boos DD, & Stefanski LA. (2013). M-estimation (estimating equations). In Essential Statistical Inference (pp. 297-337). Springer, New York, NY.

Stefanski LA, & Boos DD. (2002). The calculus of M-estimation. The American Statistician, 56(1), 29-38.

Ross RK, Zivich PN, Stringer JS, & Cole SR. (2024). M-estimation for common epidemiological measures: introduction and applied examples. International Journal of Epidemiology, 53(2).

Zivich PN, Klose M, Cole SR, Edwards JK, & Shook-Sa BE. (2022). Delicatessen: M-Estimation in Python. arXiv preprint arXiv:2203.11300.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

delicatessen-4.3.tar.gz (158.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

delicatessen-4.3-py2.py3-none-any.whl (240.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file delicatessen-4.3.tar.gz.

File metadata

  • Download URL: delicatessen-4.3.tar.gz
  • Upload date:
  • Size: 158.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for delicatessen-4.3.tar.gz
Algorithm Hash digest
SHA256 09efe9c08b25b38432575df8d80eb1927f3caa5eadb9889292e82d927315770a
MD5 5706b38877de499f605189a4cd75eaf5
BLAKE2b-256 c08e20a8e5d709f14b3743f5a23c8104bf0f6f8f69e2fcd59fcae4c1efc3f4e4

See more details on using hashes here.

File details

Details for the file delicatessen-4.3-py2.py3-none-any.whl.

File metadata

  • Download URL: delicatessen-4.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 240.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for delicatessen-4.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ef4e8142dd7a952dfe0729f552d5a2f7316a25f5b52396765ea9a34b18163ea4
MD5 2c9472ee51de342faaec1db30e8669e3
BLAKE2b-256 3a1bd875d42b9ddb09700b74f6dc4a17768f3ef106b3b7f662bcb0adcd4865bd

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

4.3 This release

2 files

4.2

2 files

4.1

2 files

4.0

2 files

3.2

2 files

3.1

2 files

3.0

2 files

2.4

2 files

2.3

2 files

2.2

2 files

2.1

2 files

2.0

2 files

1.4

2 files

1.3

2 files

1.2

2 files

1.1

2 files

1.0

2 files

0.6

2 files

0.5

2 files

0.4

2 files

0.3

2 files

0.2

2 files

0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page