Skip to main content

Set of utility functions for analyzing experimental and observational data

Project description

ci

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


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

experiment_utils_pd-0.1.0-py3-none-any.whl (25.8 kB view details)

Uploaded Python 3

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

Hashes for experiment_utils_pd-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3d1578f8efddfedb428d32c2b47eac6217e8c50f614714e2cccff5def08682aa
MD5 364906493a71fd9de4975429ff674a91
BLAKE2b-256 576ce9972acd1899b3695e8c09c23910cbcd14e4d8392865033669a63a4d8799

See more details on using hashes here.

File details

Details for the file experiment_utils_pd-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for experiment_utils_pd-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c589ceee2777faedc3c95c67c245771fe2e7c8f3684f69080c0026e8f9e9a7ac
MD5 ae6b48a4d065a9af8a34c016b535b467
BLAKE2b-256 448f952b58f823fd71dbcc1afe3612df19ef990706f3c7765db663e5c67d9288

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page