Skip to main content

TROP: Triply Robust Panel Estimator

trop is a Python package implementing the Triply Robust Panel (TROP) estimator for average treatment effects in panel data. The core estimator is expressed as a weighted two-way fixed effects (TWFE) objective, with an optional low-rank regression adjustment via a nuclear-norm penalty.

Reference:

Susan Athey, Guido Imbens, Zhaonan Qu, Davide Viviano.
Triply Robust Panel Estimators
Journal of Applied Econometrics (2026)



Installation

pip install trop

Quick start

import numpy as np
import trop

# Y: (N, T) outcomes; unit 0 is treated in the last `treated_periods` columns
W = np.zeros_like(Y)
W[0, -treated_periods:] = 1

# 1. Tune (lambda_unit, lambda_time, lambda_nn) by placebo cross-validation on the controls
lambdas = trop.TROP_cv_cycle(
    np.delete(Y, 0, axis=0), treated_periods,
    unit_grid=np.arange(0, 2, 0.2), time_grid=np.arange(0, 2, 0.2), nn_grid=np.arange(0.005, 0.2, 0.02),
)

# 2. Point estimate
tau = trop.TROP_TWFE_average(Y, W, [0], *lambdas, treated_periods=treated_periods)

# 3. Bootstrap standard error and 95% percentile interval (lambdas held fixed)
res = trop.bootstrap(Y, W, [0], treated_periods, lambdas=lambdas, n_bootstrap=1000, random_state=0)
print(res.estimate, res.se, res.ci)

trop.bootstrap also accepts any estimator with signature (Y, W, treated_units, treated_periods) -> float (e.g. the entries of trop.default_estimator_suite), resamples either control units only (resample="controls", the default) or treated and control units separately (resample="stratified"), and can report effects relative to the counterfactual mean (scale="relative").

Metadata

Release files for trop 0.1.11

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

Source distribution (sdist)

Source distribution for trop 0.1.11
File Size Uploaded Provenance
trop-0.1.11.tar.gz 25.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for trop 0.1.11
File Interpreter ABI Platform
trop-0.1.11-py3-none-any.whl Python 3 none any Details

Total release size: 50.3 kB

Release files / trop-0.1.11.tar.gz

Download URL trop-0.1.11.tar.gz
Size 25.0 kB
Tags Source
SHA-256 checksum
How to use checksums
beed956101cb22a2c9973fa75dfb4fecfd19810b1bedcf61d7a905cdf2267900
BLAKE2b-256 checksum
How to use checksums
804a9042f9f23ec3e995aec5ce4bfc9be0da92a95569e660c89caec002075239
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.1

Release files / trop-0.1.11-py3-none-any.whl

Download URL trop-0.1.11-py3-none-any.whl
Size 25.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0daeb7f45cdb3c8e62029692d7073efb5712f4ddbd7a484e11d1208bf9d9613f
BLAKE2b-256 checksum
How to use checksums
8110860a2beac4551bbaa792e5f4e686f1cfc8c2ca8428559b71cc3c743851b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.1

Security for trop 0.1.11

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.

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