Skip to main content

cmrdesign Python Package

PyPI Python versions arXiv

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

Install the Python package from PyPI:

python -m pip install cmrdesign

For exact reproducibility, pin the release version:

python -m pip install cmrdesign==0.1.0

For the development version from GitHub:

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

For local development from the repository root:

python -m pip install -e python

Quick Start

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="auto")
print(fit.pi)
print(fit.U_CMR)

allocation = cmr.realize_allocation(fit, n_main=1000)
print(allocation.counts)
print(allocation.realized_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().
  • Pilot-planning helpers from Appendix E of the accompanying paper (Yamin 2026) via cmr_plan().
  • Integer main-wave counts from CMR shares via realize_allocation().
  • Expert rectangle helpers via rectangle_*() and cmr_*_from_rectangle().

See the repository-level docs for applied guidance:

From the repository root, run local checks with:

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

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.0.tar.gz (47.2 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.0-py3-none-any.whl (45.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for cmrdesign-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f116c0f79fab38e1dad4cd2fd1fabc50065aefcef144e5030eecb7a2aa173a6d
MD5 4b900898b7ae7aeea1b5f42681ea2157
BLAKE2b-256 5fb63c27008ee0246e0984ce712bb3ff0acc34c7d6491f03c60138e9a4864c84

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for cmrdesign-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 722988ab3f4ac0c5f612a9593b75072ba76b45bcac9d72512aee8495db2b60f2
MD5 922420753beb822cdb32c41624ad1ffc
BLAKE2b-256 d7a88bbec1012ab2f947d30b95afe33b0a25ac8188f2b257b1e167b7bfbe5917

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 Sentry Error logging StatusPage Status page