Skip to main content

grmpy is a Python package for the simulation and estimation of the generalized Roy model.

grmpy

grmpy is an open-source Python package for the simulation and estimation of the generalized Roy model. It serves as a teaching tool to promote the conceptual framework of the generalized Roy model, illustrate a variety of issues in the econometrics of policy evaluation, and showcases basic software engineering practices.
Marginal Treatment Effects (MTE) can be estimated based on a parametric normal model or, alternatively, via the semiparametric method of Local Instrumental Variables (LIV).

You can install grmpy either via pip

$ pip install grmpy

Or download it directly from our GitHub repository and install the package in editable mode

$ git clone https://github.com/OpenSourceEconomics/grmpy.git
$ pip install -e .

Quick Start

Initialization File

grmpy relies on an "initialization.yml" file (referred to as ìnit_file below) to perform both simulation and estimation. For example, check out these two init_files for simulation and parametric estimation as well as a semiparametric estimation setup.

Below you'll find some example code you can copy to jump-start your project.

Simulation

import grmpy

# Specify the initilaization file you want to use, e.g.:
init_file = "ProjectFiles/simulation.yml"

data = grmpy.simulate(init_file)

Estimation

import grmpy

# Specify the initilaization file you want to use, e.g.:
init_file = "ProjectFiles/estimation.yml"

# Parametric Normal Model
rslt = grmpy.fit(init_file, semipar=False)
grmpy.plot_mte(rslt, init_file, color="blue", semipar=False, save_plot="MTE_par.png")

# Local Instrumental Variables (Semiparametric Model)
rslt = grmpy.fit(init_file, semipar=True)
grmpy.plot_mte(rslt, init_file, color="orange", semipar=True, nboot= 250, save_plot="MTE_semipar.png")

Please visit our online documentation for tutorials and more.


docs passing license code style

Metadata

Release files for grmpy 0.1.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for grmpy 0.1.10
File Size Uploaded
grmpy-0.1.10.tar.gz 566.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for grmpy 0.1.10
File Interpreter ABI Platform
grmpy-0.1.10-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 1.2 MB

Release files / grmpy-0.1.10.tar.gz

Download URL grmpy-0.1.10.tar.gz
Size 566.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1191990d33272f7bea3870ba0be8a214ff547cf162ad7783e3d54883283aa230
BLAKE2b-256 checksum
How to use checksums
21d8789b7e943b726476e77ac69556bb98a5d8697f4a7eb9ee8f3cacc8932f3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.10

Release files / grmpy-0.1.10-py2.py3-none-any.whl

Download URL grmpy-0.1.10-py2.py3-none-any.whl
Size 604.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
ce36773d018c72ecfcef672d0c0fe78b0226f31774994949c2f4f0eed8863bb7
BLAKE2b-256 checksum
How to use checksums
0da3ac6fe72afdcc0c7b2e7192be76a0e7d81081cb273ee6b8eb44df8ad9402c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.10
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