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.8.tar.gz
(29.8 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.8.tar.gz.
File metadata
- Download URL: experiment_utils_pd-0.1.8.tar.gz
- Upload date:
- Size: 29.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f5edf87dfbf1d4445c08626cac95ba38526532fd865ac35068794e790d5146f
|
|
| MD5 |
24d3d01f50b89d7cf69d17750695c313
|
|
| BLAKE2b-256 |
c824ccb76ae3effaa37057b0e6b064499775dad25e60dabc149ecc0ec2f1900a
|
File details
Details for the file experiment_utils_pd-0.1.8-py3-none-any.whl.
File metadata
- Download URL: experiment_utils_pd-0.1.8-py3-none-any.whl
- Upload date:
- Size: 28.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ecbf12e4c724f75b50dad0b95be3881c7c44fb97a5b42ef386c190cba9ec00b8
|
|
| MD5 |
6e4c10c1a57eabc457824a91a25b9353
|
|
| BLAKE2b-256 |
71dc818f16350a2a3904a623886482f2b75859901ecd3170985a8aab6e2289f8
|