delicatessen


Namedelicatessen JSON
Version 2.1 PyPI version JSON
download
home_pagehttps://github.com/pzivich/Deli
SummaryGeneralized M-Estimation
upload_time2024-03-16 15:48:37
maintainer
docs_urlNone
authorPaul Zivich
requires_python
licenseMIT
keywords m-estimation sandwich-variance estimating-equations
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![delicatessen](docs/images/delicatessen_header.png)

# Delicatessen

![tests](https://github.com/pzivich/Delicatessen/actions/workflows/python-package.yml/badge.svg)
[![version](https://badge.fury.io/py/delicatessen.svg)](https://badge.fury.io/py/delicatessen)
[![arXiv](https://img.shields.io/badge/arXiv-2203.11300-b31b1b.svg)](https://arxiv.org/abs/2203.11300)
[![docs](https://readthedocs.org/projects/deli/badge/?version=latest)](https://deli.readthedocs.io/en/latest/?badge=latest)
[![Downloads](https://pepy.tech/badge/delicatessen/month)](https://pepy.tech/project/delicatessen)

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) 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 estimation of the variance
via the sandwich variance.

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](https://deli.readthedocs.io/en/latest/) 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`

```python
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

```python
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](https://deli.readthedocs.io/en/latest/).

## References

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

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).

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

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



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/pzivich/Deli",
    "name": "delicatessen",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "m-estimation sandwich-variance estimating-equations",
    "author": "Paul Zivich",
    "author_email": "zivich.5@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/2e/90/44402b006fb65fbbae20a31247068288cf57e8ce72c48e5143865a598c92/delicatessen-2.1.tar.gz",
    "platform": null,
    "description": "![delicatessen](docs/images/delicatessen_header.png)\r\n\r\n# Delicatessen\r\n\r\n![tests](https://github.com/pzivich/Delicatessen/actions/workflows/python-package.yml/badge.svg)\r\n[![version](https://badge.fury.io/py/delicatessen.svg)](https://badge.fury.io/py/delicatessen)\r\n[![arXiv](https://img.shields.io/badge/arXiv-2203.11300-b31b1b.svg)](https://arxiv.org/abs/2203.11300)\r\n[![docs](https://readthedocs.org/projects/deli/badge/?version=latest)](https://deli.readthedocs.io/en/latest/?badge=latest)\r\n[![Downloads](https://pepy.tech/badge/delicatessen/month)](https://pepy.tech/project/delicatessen)\r\n\r\nThe one-stop sandwich (variance) shop in Python. `delicatessen` is a Python 3.8+ library for the generalized calculus\r\nof M-estimation.\r\n\r\n**Citation**: Zivich PN, Klose M, Cole SR, Edwards JK, & Shook-Sa BE. (2022). Delicatessen: M-Estimation in Python.\r\n*arXiv:2203.11300* [stat.ME]\r\n\r\n\r\n## M-Estimation and Estimating Equations\r\n\r\nHere, we provide a brief overview of M-estimation theory. For more detailed introductions to M-estimation, see Ross\r\net al. (2024) or Chapter 7 of Boos & Stefanski (2013). M-estimation is a generalization of likelihood-based methods.\r\n*M-estimators* are solutions to estimating equations. To apply the M-estimator, we solve the estimating equations using\r\nobserved data. This is similar to other approaches, but the key advantage of M-Estimators is estimation of the variance\r\nvia the sandwich variance.\r\n\r\nWhile M-Estimation is a powerful tool, the derivatives and matrix algebra can quickly become unwieldy. This is where \r\n`delicatessen` comes in. `delicatessen` takes estimating functions and data, and solves for the parameter estimates,\r\ncomputes the derivatives, and performs the matrix algebra calculations. Therefore, M-estimators can be more easily\r\nadopted without having to perform by-hand calculations. In other words, we can let the computer do the math for us.\r\n\r\nTo further ease use, `delicatessen` also comes with a variety of built-in estimating equations. See\r\nthe [delicatessen website](https://deli.readthedocs.io/en/latest/) for details on the available estimating equations,\r\nhow to use them, and practical examples.\r\n\r\n\r\n## Installation\r\n\r\n### Installing:\r\n\r\nYou can install via `python -m pip install delicatessen`\r\n\r\n### Dependencies:\r\n\r\nThe dependencies are: `numpy`, `scipy`\r\n\r\nTo replicate the tests located in `tests/`, you will additionally need to install: `panda`, `statsmodels`, and `pytest`\r\n\r\nWhile versions of `delicatessen` prior to v1.0 were compatible with older versions of Python 3 and NumPy and SciPy, the\r\nv1.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\r\na better numerical approximation procedure for the derivative. If you want to use with older versions of those packages\r\nor older versions of Python, install v0.6 instead.\r\n\r\n\r\n## Getting started\r\n\r\nBelow is a simple demonstration of calculating the mean with `delicatessen`\r\n\r\n```python\r\nimport numpy as np\r\ny = np.array([1, 2, 3, 1, 4, 1, 3, -2, 0, 2])\r\n```\r\n\r\nLoading the M-estimator functionality, building the corresponding estimating equation for the mean, and printing the\r\nresults to the console\r\n\r\n```python\r\nfrom delicatessen import MEstimator\r\n\r\ndef psi(theta):\r\n    return y - theta[0]\r\n\r\nestr = MEstimator(psi, init=[0, ])\r\nestr.estimate()\r\n\r\nprint(estr.theta)     # Estimate of the mean\r\nprint(estr.variance)  # Variance estimate\r\n```\r\n\r\nFor further details on using `delicatessen`, see the full documentation and worked examples available\r\nat [delicatessen website](https://deli.readthedocs.io/en/latest/).\r\n\r\n## References\r\n\r\nBoos DD, & Stefanski LA. (2013). M-estimation (estimating equations). In Essential Statistical Inference\r\n(pp. 297-337). Springer, New York, NY.\r\n\r\nRoss RK, Zivich PN, Stringer JS, & Cole SR. (2024). M-estimation for common epidemiological measures: introduction and\r\napplied examples. *International Journal of Epidemiology*, 53(2).\r\n\r\nStefanski LA, & Boos DD. (2002). The calculus of M-estimation. *The American Statistician*, 56(1), 29-38.\r\n\r\nZivich PN, Klose M, Cole SR, Edwards JK, & Shook-Sa BE. (2022). Delicatessen: M-Estimation in Python.\r\n*arXiv preprint arXiv:2203.11300*.\r\n\r\n\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Generalized M-Estimation",
    "version": "2.1",
    "project_urls": {
        "Homepage": "https://github.com/pzivich/Deli"
    },
    "split_keywords": [
        "m-estimation",
        "sandwich-variance",
        "estimating-equations"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "65bbf19cc359211cebc0350c3c7b7a81d4816d80acf30d762b1f19aea92417d6",
                "md5": "8cbedfd61d5ce2e3748628a03c583f60",
                "sha256": "66b2c16f4de373bfe2972ef9c0256628b6666abd16b7cf65682244a49a4476d7"
            },
            "downloads": -1,
            "filename": "delicatessen-2.1-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8cbedfd61d5ce2e3748628a03c583f60",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 94053,
            "upload_time": "2024-03-16T15:48:35",
            "upload_time_iso_8601": "2024-03-16T15:48:35.515240Z",
            "url": "https://files.pythonhosted.org/packages/65/bb/f19cc359211cebc0350c3c7b7a81d4816d80acf30d762b1f19aea92417d6/delicatessen-2.1-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2e9044402b006fb65fbbae20a31247068288cf57e8ce72c48e5143865a598c92",
                "md5": "1ac4840a38d9a266c6a879001901250f",
                "sha256": "c1696d36e28eeedef348aad3b787c9fbc9b73313fe575dcb0495bc1b507e9393"
            },
            "downloads": -1,
            "filename": "delicatessen-2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "1ac4840a38d9a266c6a879001901250f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 69187,
            "upload_time": "2024-03-16T15:48:37",
            "upload_time_iso_8601": "2024-03-16T15:48:37.325254Z",
            "url": "https://files.pythonhosted.org/packages/2e/90/44402b006fb65fbbae20a31247068288cf57e8ce72c48e5143865a598c92/delicatessen-2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-16 15:48:37",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pzivich",
    "github_project": "Deli",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "delicatessen"
}
        
Elapsed time: 0.22652s