Skip to main content

Conditional Minimax Regret design rules for pilot-informed experiments

Project description

cmrdesign Python Package

Python implementation of cmrdesign, the applied Conditional Minimax Regret design-rule package.

The methods accompany When and How to Pilot: Design Rules for Two-Wave Experiments by Juan C. Yamin. This package is implementation-focused and uses simulated examples only; paper replications and empirical simulations are intentionally kept out of the package repository.

Installation

Until the first PyPI upload, install from GitHub for normal use:

python -m pip install "cmrdesign @ git+https://github.com/juancyamin/cmrdesign.git#subdirectory=python"

The first alpha candidate is also available on TestPyPI for release testing:

python -m pip install \
  --index-url https://test.pypi.org/simple/ \
  --extra-index-url https://pypi.org/simple \
  cmrdesign==0.1.0a1

For local development from the repository root:

python -m pip install -e python

Quick Example

import numpy as np
import cmrdesign as cmr

rng = np.random.default_rng(123)
d = np.r_[np.ones(40), np.zeros(40)]
y = np.r_[rng.beta(2, 5, 40), rng.beta(4, 4, 40)]

fit = cmr.cmr_two_arm(y, d, alpha=0.05, method="bounded")
print(fit.pi)
print(fit.U_CMR)

Implemented Surface

  • cmr_two_arm() and cmr_binary().
  • method="auto" for the applied bounded/binary default.
  • Maurer-Pontil bounded-outcome variance rectangles.
  • Exact Bernoulli folded-binomial variance rectangles.
  • Martinez-Taboada-Ramdas (MTR) bounded-outcome rectangles.
  • Two-arm unbounded-outcome median-of-means rectangles via cmr_unbounded().
  • Shared-control multi-arm CMR via cmr_multiarm().
  • Stratified CMR via cmr_stratified().
  • Multiple-outcome CMR for weighted-index and co-primary workflows via cmr_multiple_outcomes().
  • Proxy/delayed-outcome CMR bridge widening via cmr_proxy().
  • Appendix E pilot-planning helpers via cmr_plan().
  • Expert rectangle helpers via rectangle_*() and cmr_*_from_rectangle().

See the repository-level docs for applied guidance:

  • docs/quickstart.md
  • docs/choosing_methods.md
  • docs/methods.md
  • docs/pilot_planning.md

From the repository root, run local checks with:

python -m pip install -e python
python -m unittest discover -s python/tests -v

Project details


Download files

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

Source Distribution

cmrdesign-0.1.0a1.tar.gz (37.4 kB view details)

Uploaded Source

Built Distribution

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

cmrdesign-0.1.0a1-py3-none-any.whl (39.1 kB view details)

Uploaded Python 3

File details

Details for the file cmrdesign-0.1.0a1.tar.gz.

File metadata

  • Download URL: cmrdesign-0.1.0a1.tar.gz
  • Upload date:
  • Size: 37.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for cmrdesign-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 8450a2377066e92460667e2a3fecbeb4d613729785058f6cc85429772927295c
MD5 e8f6d95cb66767e660550d9ec0a72b59
BLAKE2b-256 e3cf91273c18e54cf6eaf0b1301e63b8844928b89f21651d3251b56aab3ab783

See more details on using hashes here.

File details

Details for the file cmrdesign-0.1.0a1-py3-none-any.whl.

File metadata

  • Download URL: cmrdesign-0.1.0a1-py3-none-any.whl
  • Upload date:
  • Size: 39.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for cmrdesign-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 66cc830b7c1b2840e6b9feae524c70f093544959ec5a0f8ba5bd6ace93e32449
MD5 bc6bf5ae74b5bd8ea7e6a5a767667dbb
BLAKE2b-256 d313f658a253dc8b37905ef68badb59bc6c4613049eb97f1bc7d84d22dd5bebc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page