{ "info": { "author": "Sylvain Chassang", "author_email": "sylvain.chassang@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Topic :: Scientific/Engineering" ], "description": "# rct\n[![Build Status](https://travis-ci.com/sylvaingchassang/rct.svg?branch=master)](https://travis-ci.com/sylvaingchassang/rct)\n\n### What this package does\n\nThis package provides tools to generate robust and balanced random assignments\nfollowing [Banerjee, Chassang, Montero, and Snowberg (2019)](https://www.sylvainchassang.org/assets/papers/adversarial_experimentation.pdf).\n\nThe `RCT`, `KRerandomizedRCT`, and `QuantileTargetingRCT` classes of\n the `rct.design` module implement RCT, K-rerandomized\n RCT, and Quantile Targeting RCT designs described in [Banerjee, Chassang, Montero, and Snowberg (2019)](https://www.sylvainchassang.org/assets/papers/adversarial_experimentation.pdf).\n\nFor each design, `assignment_from_iid` draws designs selected from i.i.d. assignments;\n `assignment_from_shuffled` draws designs selected from exchangeable\n assignments guaranteed to exactly match desired sampling weights (up to\n integer issues).\n\nThe package allows for an arbitrary number of treatment arms, specified via\nthe `weights` argument in each design.\n\n`rct` implements various balance objectives, including: \n - minimizing the Mahalanobis distance between the mean of selected\n covariates across treatment arms; \n - maximizing the minimum p-value for the regression of covariates on\n treatment dummies; \n - soft blocking on selected covariates; \n - linear combinations of existing objectives.\n\nCustomizing balance objectives, besides linear combinations of existing balance functions, is straightforward. First, you can pass different \naggregating functions to the `BalanceObjective` constructor. For instance, this would allow to maximize the mean p-value rather than the minimum p-value. Second, you can simply define a new class inheriting from `BalanceObjective` and implementing the abstract method `_balance_func`.\n\n\n### Citation\n\nTo cite `rct` in publications, use \n```\nBanerjee, Abhijit, Sylvain Chassang, Sergio Montero, and Erik Snowberg. \nA theory of experimenters. No. w23867. National Bureau of Economic Research, 2017.\n```\nThe corresponding `bibtex` entry is: \n```\n@techreport{banerjee2017theory, \n title={A theory of experimenters}, \n author={Banerjee, Abhijit and Chassang, Sylvain and Montero, Sergio and Snowberg, Erik}, \n year={2017}, \n institution={National Bureau of Economic Research} \n}\n```\n\n### Installation\n\nThis package is tested for `python 3.6` and `python 3.7` under Ubuntu\nLinux 16.04.\n\nYou may download the package via `pip`:\n\n`$ pip install rct`\n\nthis will install all required dependencies.\n\nAlternatively, you can clone (`git@github.com:sylvaingchassang/rct.git`) or [download a `.zip`](https://github.com/sylvaingchassang/rct/archive/master.zip) of the repo. If you\ndo so you must install requirements for the package manually. With `pip`, run \n\n`./rct$ pip install -r requirements.txt`\n\n### Running tests\n\nBefore using the package, you may want to check that unit and\nintegration tests pass on your machine. To this end, run\n\n`./rct$ pytest --cov=. --cov-report=term-missing`\n\n### Examples\n\nExample notebooks illustrate the use of `rct` modules:\n - [`rct/notebooks/examples_rct.ipynb`](https://github.com/sylvaingchassang/rct/blob/master/notebooks/examples_rct.ipynb) shows how to generate\n traditional i.i.d. and shuffled RCT assignments for binary and ternary\n treatments. The `pvalue_report` function provides a useful summary of\n assignment balance by reporting the `(#treatments -1, #covariates)`\n matrix of p-values obtained from regressing covariates on different\n treatment dummies.\n\n - [`rct/notebooks/examples_k_rerandomized_rct.ipynb`](https://github.com/sylvaingchassang/rct/blob/master/notebooks/examples_k_rerandomized_rct.ipynb) shows how to\n obtain k-rerandomized i.i.d. and shuffled assignments under various balance\n objectives.\n\n - [`rct/notebooks/examples_quantile_targeting_rct.ipynb`](https://github.com/sylvaingchassang/rct/blob/master/notebooks/examples_quantile_targeting_rct.ipynb) performs a\n similar exercise for quantile targeting experiment designs.\n\nIntegration tests located at `rct/tests/test_integration.py` replicate\nthe content of these notebooks.\n\n### Contribute\n\nIf you want to improve `rct` please reach out! \n\nWhether you are a programmer who wants to improve our code, or an experiment designer with a\npractical comment, or a new design idea, we want to talk to you!\n\nOn our current todo list (2019/09/20): \n - adding type hints to improve readability; \n - profiling & speed improvement; \n - implementing sequential designs. \n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/sylvaingchassang/rct", "keywords": "experiment-design RCTs A/B-testing", "license": "", "maintainer": "", "maintainer_email": "", "name": "rct", "package_url": "https://pypi.org/project/rct/", "platform": "", "project_url": "https://pypi.org/project/rct/", "project_urls": { "Homepage": "https://github.com/sylvaingchassang/rct" }, "release_url": "https://pypi.org/project/rct/0.0.4/", "requires_dist": [ "pandas (>=0.25.1)", "numpy (>=1.17.2)", "statsmodels (>=0.10.1)", "parameterized (>=0.7.0)", "lazy-property (>=0.0.1)" ], "requires_python": ">=3.6", "summary": "design robust balanced randomized experiments", "version": "0.0.4" }, "last_serial": 5915633, "releases": { "0.0.3": [ { "comment_text": "", "digests": { "md5": "a5528a3e3855b4e69293e60ed0c3a300", "sha256": "546d5d2e196f3085b2f30929589fbbe61507f945d951aff2351615fbe3189b69" }, "downloads": -1, "filename": "rct-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "a5528a3e3855b4e69293e60ed0c3a300", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 13630, "upload_time": "2019-10-02T00:37:29", "url": "https://files.pythonhosted.org/packages/69/d9/d0d66317ac1e20efe85c690d1b2ae18a2b33f9663124cc47fbdef33b2bc8/rct-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2d34d489b524af33b6fb86f07f624941", "sha256": "7114fe57d6e7f0de00bb11773ce5996f7e841a28416a83fbd8fe43d8ddd798c3" }, "downloads": -1, "filename": "rct-0.0.3.tar.gz", "has_sig": false, "md5_digest": "2d34d489b524af33b6fb86f07f624941", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 12041, "upload_time": "2019-10-02T00:37:30", "url": "https://files.pythonhosted.org/packages/68/6e/69ccadc0651fcc97d1ae4f2e1d930bd4879049a4c1d836c5da1ceddf0d48/rct-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "bab01c8655454c106ac9c4cd2fb7fe02", "sha256": "ca8772728b4aaaee5275a9c8e0b518d7d0bd7b3d43e15cabb674d750c63f4f5d" }, "downloads": -1, "filename": "rct-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "bab01c8655454c106ac9c4cd2fb7fe02", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 33234, "upload_time": "2019-10-02T01:13:35", "url": "https://files.pythonhosted.org/packages/bb/9e/475df0bdf0450713aed63825efb46709ba9b9e42709fd366ebb39b3820c6/rct-0.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c679d8d30d0235cfe583a4c1af457385", "sha256": "bfe14ffe17e85de0606b8fe9b60b99823877a80958bdd0bf237d3dcf9e043a25" }, "downloads": -1, "filename": "rct-0.0.4.tar.gz", "has_sig": false, "md5_digest": "c679d8d30d0235cfe583a4c1af457385", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 22557, "upload_time": "2019-10-02T01:13:37", "url": "https://files.pythonhosted.org/packages/87/8d/f510d9c402aa6c8d31822ce2c7f25d23566f13176cd9d83cdc297e26793e/rct-0.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "bab01c8655454c106ac9c4cd2fb7fe02", "sha256": "ca8772728b4aaaee5275a9c8e0b518d7d0bd7b3d43e15cabb674d750c63f4f5d" }, "downloads": -1, "filename": "rct-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "bab01c8655454c106ac9c4cd2fb7fe02", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 33234, "upload_time": "2019-10-02T01:13:35", "url": "https://files.pythonhosted.org/packages/bb/9e/475df0bdf0450713aed63825efb46709ba9b9e42709fd366ebb39b3820c6/rct-0.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c679d8d30d0235cfe583a4c1af457385", "sha256": "bfe14ffe17e85de0606b8fe9b60b99823877a80958bdd0bf237d3dcf9e043a25" }, "downloads": -1, "filename": "rct-0.0.4.tar.gz", "has_sig": false, "md5_digest": "c679d8d30d0235cfe583a4c1af457385", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 22557, "upload_time": "2019-10-02T01:13:37", "url": "https://files.pythonhosted.org/packages/87/8d/f510d9c402aa6c8d31822ce2c7f25d23566f13176cd9d83cdc297e26793e/rct-0.0.4.tar.gz" } ] }