Set of utility functions for analyzing experimental and observational data
Project description
Experiment utils
Generic functions for experiment analysis and design:
Installation
PyPI
pip install experiment-utils-pd
From GitHub
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.5.tar.gz
(27.3 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.5.tar.gz.
File metadata
- Download URL: experiment_utils_pd-0.1.5.tar.gz
- Upload date:
- Size: 27.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf883fb0d1c2b6a8826fa54979bc060d90f397923060a8d592621b7e3de0de05
|
|
| MD5 |
47e2f15a434b710a576d2f63eceb6824
|
|
| BLAKE2b-256 |
e8cc31d63d097b0c79cb232ab240396f305912de67971dced23182f86ef24933
|
File details
Details for the file experiment_utils_pd-0.1.5-py3-none-any.whl.
File metadata
- Download URL: experiment_utils_pd-0.1.5-py3-none-any.whl
- Upload date:
- Size: 26.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bdadfbd0a31fe15b2c55dae2b4628eebece5af23d53d0a3126d9d8ee1a4c6e2a
|
|
| MD5 |
4faeeadb1942f7d2d87d1ee220b9381a
|
|
| BLAKE2b-256 |
4367d3cc95372544558cce049df04a9ee5d1e61131c35be3a3555c1770bcf20f
|