{"id":32797540,"url":"https://github.com/niisaban/ab-test-lift-sim","last_synced_at":"2026-04-29T21:04:00.563Z","repository":{"id":318187211,"uuid":"1070256745","full_name":"niisaban/ab-test-lift-sim","owner":"niisaban","description":"A/B test lift simulation \u0026 analysis in Python: CUPED variance reduction, power analysis, and guardrail metrics with reproducible pytest CI.","archived":false,"fork":false,"pushed_at":"2025-11-02T19:24:32.000Z","size":42,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-02T21:13:46.789Z","etag":null,"topics":["ab-testing","causal-inference","cuped","experimentation","github-actions","pandas","power-analysis","pytest","python","scipy","srm","statistics"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/niisaban.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-05T15:27:21.000Z","updated_at":"2025-11-02T19:24:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"192c7499-d04e-4108-b37d-ca809fd9c144","html_url":"https://github.com/niisaban/ab-test-lift-sim","commit_stats":null,"previous_names":["niisaban/ab-test-lift-sim"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/niisaban/ab-test-lift-sim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niisaban%2Fab-test-lift-sim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niisaban%2Fab-test-lift-sim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niisaban%2Fab-test-lift-sim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niisaban%2Fab-test-lift-sim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/niisaban","download_url":"https://codeload.github.com/niisaban/ab-test-lift-sim/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niisaban%2Fab-test-lift-sim/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32443576,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T20:22:27.477Z","status":"ssl_error","status_checked_at":"2026-04-29T20:22:26.507Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ab-testing","causal-inference","cuped","experimentation","github-actions","pandas","power-analysis","pytest","python","scipy","srm","statistics"],"created_at":"2025-11-06T00:01:11.693Z","updated_at":"2026-04-29T21:04:00.555Z","avatar_url":"https://github.com/niisaban.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![CI](https://github.com/niisaban/ab-test-lift-sim/actions/workflows/ci.yml/badge.svg)](https://github.com/niisaban/ab-test-lift-sim/actions/workflows/ci.yml)\n\n\n# A/B Test Lift — Simulation \u0026 Analysis\n\n**A/B = \"A versus B\", aka controlled online experiment**.  \nThis mini‑project lets you **simulate** experiments, run **power analyses**, apply **CUPED** (Controlled Pre‑Experiment Data) variance reduction, and compute **lift** with statistical tests.\n\n## Why this repo\n- Practice end‑to‑end: simulate → analyze → interpret → write up.\n- Show **reproducible** DS craft (tests, CI, clean `src/`).\n- Prep for interviews: power, guardrails, CUPED, heterogeneity.\n\n## Quickstart\n```bash\n# (Recommended) Python 3.11+\npython -m venv .venv \u0026\u0026 source .venv/bin/activate  # Windows: .venv\\Scripts\\activate\npip install -r requirements.txt\n\n# Run a small demo (simulate + analyze)\npython scripts/run_demo.py\n\n# Run tests\npytest -q\n```\n### Run tests locally\n\n#### Windows (PowerShell, current session)\n```powershell\n# Expose repo root to Python for this shell session\n$env:PYTHONPATH = (Get-Location).Path\npytest -q --maxfail=1 -ra\n```\n\n#### macOS / Linux (bash/zsh, current session)\n```bash\n# Expose repo root to Python for this shell session\nexport PYTHONPATH=\"$PWD\"\npytest -q --maxfail=1 -ra\n```\n\n#### (Optional) Windows CMD\n```bat\n:: Expose repo root to Python for this CMD session\nset PYTHONPATH=%CD%\n\n:: Run tests (quiet; stop early; show failure summary)\npytest -q --maxfail=1 -ra\n```\n\n\n## Project Structure\n```\nab-test-lift-sim/\n├─ src/\n│  ├─ simulate.py         # traffic \u0026 conversions generator (+ covariate for CUPED)\n│  ├─ metrics.py          # lift, SE, z-test / Welch t-test\n│  ├─ cuped.py            # CUPED theta, adjusted outcome\n│  └─ power.py            # sample-size \u0026 detectable-effect calculators\n├─ scripts/\n│  └─ run_demo.py         # CLI demo tying it all together\n├─ tests/\n│  ├─ test_metrics.py\n│  └─ test_cuped.py\n├─ data/\n│  └─ README.md\n├─ requirements.txt\n├─ .github/workflows/ci.yml\n└─ README.md\n```\n\n## Concepts (expanded)\n- **Lift**: difference in mean outcome between Treatment and Control (absolute or relative).\n- **Power analysis**: probability of detecting a true effect; trades off effect size, variance, alpha, and sample size.\n- **CUPED**: variance reduction using a pre‑experiment covariate `X_pre`:  \n  θ = Cov(Y, X_pre) / Var(X_pre), and `Y_adj = Y - θ(X_pre - mean(X_pre))`.\n- **Guardrail metrics**: KPIs you ensure don’t degrade (e.g., latency, cancellation rate).\n\n## What to practice / document\n- State a **clear hypothesis** and primary metric.\n- Check **randomization balance**; monitor **SRM** (sample‑ratio mismatch).\n- Report **CIs**, **p‑values**, and practical impact (e.g., $$ ROI).\n- Call out **assumptions** (independence, normal approx) \u0026 alternatives (bootstrap).\n\n## Interview talking points\n- When to **stop** an experiment; **sequential** peeking pitfalls.\n- Dealing with **novelty effects** and **heterogeneous treatment effects**.\n- Tradeoffs: **CUPED** vs. **stratification** vs. **reweighting**.\n\n---\n\n### Get help / share results\n- ❓ Ask a question → [New Q\u0026A](https://github.com/niisaban/ab-test-lift-sim/discussions/new?category=Q%26A)\n- ✨ Share a result → [New Show \u0026 Tell](https://github.com/niisaban/ab-test-lift-sim/discussions/new?category=Show%20and%20tell)\n\n- 🧰 **Quick fixes / FAQ** → [FAQ thread](https://github.com/niisaban/ab-test-lift-sim/discussions/21)\n\n\n© Use freely for interviews/portfolio.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniisaban%2Fab-test-lift-sim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fniisaban%2Fab-test-lift-sim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniisaban%2Fab-test-lift-sim/lists"}