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.2.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.2.tar.gz.
File metadata
- Download URL: experiment_utils_pd-0.1.2.tar.gz
- Upload date:
- Size: 26.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
814985548031d8e863df54860d74cec6d150a78819a2a1ad548b5f5cb09a5155
|
|
| MD5 |
350d165452d1c42ee3a29ca19ddd221b
|
|
| BLAKE2b-256 |
947ec4ffb1a245009d7e34a76d17c1cd2f0a12eaae371f02df9435f5b02cf997
|
File details
Details for the file experiment_utils_pd-0.1.2-py3-none-any.whl.
File metadata
- Download URL: experiment_utils_pd-0.1.2-py3-none-any.whl
- Upload date:
- Size: 25.9 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 |
9da6311fe75694f5dc31c4674cbbc2f24b09b0523c9fe8018a27c6d77a2fc8cb
|
|
| MD5 |
96807444d760d2a972f70b71acfeb913
|
|
| BLAKE2b-256 |
592fab4746f4b256fcf950cd36075dc01320c8a317a213730dafb191ad1361b8
|