Set of utility functions for analyzing experimental and observational data
Project description
Experiment utils
Generic functions for experiment analysis and design:
Installation
pip install git+https://github.com/sdaza/experiment-utils-pd.git
How to use it
Experiment Analyzer
df is a Pandas DataFrame:
from experiment_utils import ExperimentAnalyzer
# Example with balance adjustment and balance_method
analyzer = ExperimentAnalyzer(
df,
treatment_col="treatment",
outcomes=['registrations', 'visits'],
covariates=covariates,
experiment_identifier=["campaign_key"],
adjustment="balance", # Options: 'balance', 'IV', or None
balance_method="ps-logistic", # Options: 'ps-logistic', 'ps-xgboost', 'entropy'
target_effect="ATT" # Options: 'ATT', 'ATE', 'ATC'
)
analyzer.get_effects()
print(analyzer.results)
Parameters:
adjustment: Choose 'balance' for covariate balancing (using balance_method), 'IV' for instrumental variable adjustment, or None for unadjusted analysis.balance_method: Selects the method for balancing: 'ps-logistic' (logistic regression), 'ps-xgboost' (XGBoost), or 'entropy' (entropy balancing).target_effect: Specifies the estimand: 'ATT', 'ATE', or 'ATC'.
Power Analysis
from experiment_utils import PowerSim
p = PowerSim(metric='proportion', relative_effect=False,
variants=1, nsim=1000, alpha=0.05, alternative='two-tailed')
p.get_power(baseline=[0.33], effect=[0.03], sample_size=[3000])
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
experiment_utils_pd-0.1.0.tar.gz
(26.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file experiment_utils_pd-0.1.0.tar.gz.
File metadata
- Download URL: experiment_utils_pd-0.1.0.tar.gz
- Upload date:
- Size: 26.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d1578f8efddfedb428d32c2b47eac6217e8c50f614714e2cccff5def08682aa
|
|
| MD5 |
364906493a71fd9de4975429ff674a91
|
|
| BLAKE2b-256 |
576ce9972acd1899b3695e8c09c23910cbcd14e4d8392865033669a63a4d8799
|
File details
Details for the file experiment_utils_pd-0.1.0-py3-none-any.whl.
File metadata
- Download URL: experiment_utils_pd-0.1.0-py3-none-any.whl
- Upload date:
- Size: 25.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c589ceee2777faedc3c95c67c245771fe2e7c8f3684f69080c0026e8f9e9a7ac
|
|
| MD5 |
ae6b48a4d065a9af8a34c016b535b467
|
|
| BLAKE2b-256 |
448f952b58f823fd71dbcc1afe3612df19ef990706f3c7765db663e5c67d9288
|