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.3.tar.gz
(27.4 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.3.tar.gz.
File metadata
- Download URL: experiment_utils_pd-0.1.3.tar.gz
- Upload date:
- Size: 27.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a52812084a5502a2900014b35caf464e96d67bd4f75bc896662f285da564bdd
|
|
| MD5 |
b5bcfbf9a2be6e45963d3ab02564d200
|
|
| BLAKE2b-256 |
be5e0d0799a82dbe7376a9a33d945a7c45fcaa6fac0254836ba4d64117c22be2
|
File details
Details for the file experiment_utils_pd-0.1.3-py3-none-any.whl.
File metadata
- Download URL: experiment_utils_pd-0.1.3-py3-none-any.whl
- Upload date:
- Size: 26.7 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 |
183bed0ce734884322f44e9125ff7e5424ed13ca7ab7491ce39e3593b91e9819
|
|
| MD5 |
08749d55b6091bfb264328c89a533993
|
|
| BLAKE2b-256 |
db61d030dc860c0586f4810893952576e049a1143b7c601c475db947f888d815
|