Skip to content

Add data science practitioner strategy and brand awareness tutorial#286

Merged
igerber merged 3 commits intomainfrom
ds-analysis
Apr 9, 2026
Merged

Add data science practitioner strategy and brand awareness tutorial#286
igerber merged 3 commits intomainfrom
ds-analysis

Conversation

@igerber
Copy link
Copy Markdown
Owner

@igerber igerber commented Apr 9, 2026

Summary

  • Add strategic analysis (docs/business-strategy.md) assessing the opportunity to make diff-diff appealing to data science practitioners — competitive landscape, personas, gap analysis, and phased roadmap
  • Add parallel B1-B4 roadmap track in ROADMAP.md targeting practitioners in marketing, product, and operations
  • Deliver B1a: Tutorial 17 — measuring campaign impact on brand awareness with survey data
  • Tutorial showcases unique SurveyDesign support in a CPG brand tracking scenario with naive-vs-corrected comparison (2.14x SE ratio), brand funnel analysis (awareness/consideration/purchase intent), staggered rollout extension with CallawaySantAnna, HonestDiD sensitivity, and stakeholder communication guidance

Methodology references (required if estimator / math changes)

  • Method name(s): N/A — no methodology changes
  • Paper / source link(s): N/A
  • Any intentional deviations from the source (and why): None

Validation

  • Tests added/updated: No test changes (tutorial-only PR)
  • Backtest / simulation / notebook evidence: Tutorial 17 executes end-to-end via jupyter nbconvert --execute with seeded DGPs producing deterministic output

Security / privacy

  • Confirm no secrets/PII in this PR: Yes

Generated with Claude Code

Strategic analysis of the opportunity to make diff-diff appealing to data
science practitioners (marketing, product, operations). Adds a parallel
B1-B4 roadmap track targeting this audience, and delivers the first item
(B1a): Tutorial 17 — measuring campaign impact on brand awareness with
survey data. The tutorial showcases the unique survey design support
(SurveyDesign with strata, PSU, FPC, weights) in a CPG brand tracking
scenario, with naive-vs-corrected comparison, brand funnel analysis,
staggered rollout extension, and stakeholder communication guidance.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 9, 2026

Overall Assessment

⚠️ Needs changes

Executive Summary

  • P1 methodology issue: the new HonestDiD example fits CallawaySantAnna() with the default base_period="varying" and suppresses the warning that the library emits for this exact case, even though the implementation and registry say HonestDiD on CS results requires base_period="universal" for valid interpretation.
  • P2 methodology/docs issue: the tutorial story is “8 of 20 DMAs,” but the synthetic DGP is documented as 200 respondents per period, and the notebook renames respondent unit to market_id. That mismatches the unit of analysis for the example.
  • P2 code-quality issue: the no-matplotlib fallback is broken; it prints trends in the else branch before trends is defined.
  • P3 methodology/docs issue: the notebook labels the naive-vs-survey SE ratio as a “design effect,” but the existing survey tutorial and registry define DEFF differently.
  • No security findings. I could not execute the notebook locally because this review environment is missing Python deps (numpy import fails), so notebook validation here is static.

Methodology

Code Quality

  • Severity: P2. Impact: the notebook claims plots will be skipped when matplotlib is unavailable, but the first plotting cell calls print(trends.to_string()) in the else branch even though trends is only defined inside the if HAS_MATPLOTLIB branch. That path raises NameError instead of degrading gracefully. docs/tutorials/17_brand_awareness_survey.ipynb:72 docs/tutorials/17_brand_awareness_survey.ipynb:189 Concrete fix: compute trends before the conditional, or recompute it inside the else branch.

Performance

  • No findings.

Maintainability

  • No findings.

Tech Debt

  • No new tech-debt-only findings. The blocking methodology issue above is not mitigated by TODO.md.

Security

  • No findings. I did not see secrets, PII, or suspicious notebook metadata/outputs in the new files.

Documentation/Tests

  • No additional diff-local findings beyond the issues above. I could not run the notebook in this environment because the workspace Python is missing required packages, so this review is static for notebook behavior.

Path to Approval

  1. Refit the HonestDiD section with CallawaySantAnna(base_period="universal") (or fit a second CS model solely for the sensitivity section) so the example matches the library’s documented methodology.
  2. Remove the blanket warning suppression around compute_honest_did(...) and revise the surrounding markdown so pre-period checks are described as supportive evidence, not confirmation that parallel trends “holds.”

- P1: Use base_period="universal" for CallawaySantAnna in staggered
  section so HonestDiD sensitivity analysis is methodologically valid
- P2: Fix unit of analysis — rename to respondent_id, reframe narrative
  as respondent-level survey data (not market-level DMAs)
- P2: Fix matplotlib fallback — compute trends before conditional
- P2: Replace blanket warnings.simplefilter("ignore") with targeted
  RuntimeWarning filter for survey module matmul artifacts only;
  UserWarnings and methodology warnings now come through
- P3: Rename "Design effect (SE ratio)" to "SE inflation ratio" to
  avoid terminology drift from formal DEFF definition
- Soften parallel trends language from "confirming" to "consistent with"

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@igerber
Copy link
Copy Markdown
Owner Author

igerber commented Apr 9, 2026

/ai-review

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 9, 2026

🔁 AI review rerun (requested by @igerber)

Head SHA: 5873d1f660a4700888825b57361c3a4e09a6abd1


Overall Assessment

⚠️ Needs changes

Executive Summary

  • All prior P1+ findings appear resolved. In particular, the HonestDiD example now fits CallawaySantAnna(base_period="universal") before calling compute_honest_did(...), which matches the Methodology Registry note for CS-to-HonestDiD usage.
  • The earlier no-matplotlib fallback bug and the misleading “design effect” label also appear resolved in the new notebook.
  • Severity P1 [Newly identified]: the tutorial’s “trustworthiness” section validates a survey-aware DiD result with non-survey-aware diagnostics. The placebo DiD omits survey_design=sd, and check_parallel_trends() is only a simple slope comparison with no survey-design or panel-dependence adjustment.
  • No security findings.
  • Static review only: the notebook is valid JSON, but I could not execute it here because the local environment cannot import diff_diff (numpy is missing).

Methodology

Re-review note: the previous HonestDiD/base-period blocker is resolved. The staggered section now uses CallawaySantAnna(base_period="universal") and then compute_honest_did(...), consistent with the registry’s CS/HonestDiD note. References: docs/tutorials/17_brand_awareness_survey.ipynb#L322, docs/tutorials/17_brand_awareness_survey.ipynb#L368, docs/methodology/REGISTRY.md#L1991

Code Quality

  • No findings.

Performance

  • No findings.

Maintainability

  • No findings.

Tech Debt

  • No findings. The P1 above is not mitigated by TODO.md tracking. Reference: TODO.md#L51

Security

  • No findings. I did not see secrets, PII, or committed notebook outputs.

Documentation/Tests

  • No additional findings beyond the methodology issue above.
  • Static review only: docs/tutorials/17_brand_awareness_survey.ipynb is valid JSON, but full execution could not be verified because the local environment is missing numpy.

Path to Approval

  1. Update the placebo cell to run DifferenceInDifferences.fit(..., survey_design=sd) so the falsification result uses the same design-based inference the tutorial advocates for the main estimate.
  2. Change the parallel-trends subsection so it no longer presents check_parallel_trends() as formal validation for the survey design. Either replace it with a survey-aware pre-period diagnostic, or clearly label it as informal/non-survey-aware and soften the later summary/stakeholder text that says the result is “supported” by those checks.

- Pass survey_design=sd to placebo DiD fit so falsification uses the
  same design-based inference as the main estimate
- Label check_parallel_trends() as informal/non-survey-aware and
  direct readers to HonestDiD for formal robustness assessment
- Soften diagnostic summary prose: "supportive evidence" not validation
- Update tutorial summary to distinguish informal checks from formal
  sensitivity analysis

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@igerber
Copy link
Copy Markdown
Owner Author

igerber commented Apr 9, 2026

/ai-review

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 9, 2026

🔁 AI review rerun (requested by @igerber)

Head SHA: bc7e55712e63323f6bf86b5ab93c9433fabdd1e6


Overall Assessment

✅ Looks good

Executive Summary

Methodology

No findings.

Affected methods reviewed: DifferenceInDifferences with SurveyDesign, CallawaySantAnna event-study aggregation, and HonestDiD. The changed notebook now uses survey-aware inference consistently in the placebo refit, clearly discloses that check_parallel_trends() is only an informal slope comparison, and uses base_period="universal" for the CS event-study path before HonestDiD. That is consistent with the in-code helper behavior and the Methodology Registry notes for CS survey support and HonestDiD base-period handling. docs/tutorials/17_brand_awareness_survey.ipynb:L121-L172 docs/tutorials/17_brand_awareness_survey.ipynb:L228-L261 docs/tutorials/17_brand_awareness_survey.ipynb:L317-L363 diff_diff/utils.py:L618-L710 docs/methodology/REGISTRY.md:L429-L439 docs/methodology/REGISTRY.md:L1989-L1991

Code Quality

No findings.

Performance

No findings.

Maintainability

No findings.

Tech Debt

No findings.

I did not see a new silent-correctness issue that would need TODO-based mitigation, and nothing in the changed files appears to depend on an already-deferred limitation in TODO.md:L51-L75.

Security

No findings.

I did not find secrets or PII in the changed files, and the new notebook metadata is minimal.

Documentation/Tests

  • Severity: P3 [Newly identified]. Impact: docs/tutorials/README.md was not updated to include the new brand-awareness notebook, so users browsing the tutorials directory directly will not see Tutorial 17 in the local index even though it was added and linked from the top-level README. Concrete fix: add a 17_brand_awareness_survey.ipynb entry to docs/tutorials/README.md and reconcile that local tutorial list while touching the file. References: docs/tutorials/README.md:L1-L73 README.md:L126-L145 docs/tutorials/17_brand_awareness_survey.ipynb:L1-L404

Static review only: notebook execution was not reproduced locally because the environment cannot import numpy/pandas.

@igerber igerber added the ready-for-ci Triggers CI test workflows label Apr 9, 2026
@igerber igerber merged commit e90908e into main Apr 9, 2026
3 of 4 checks passed
@igerber igerber deleted the ds-analysis branch April 9, 2026 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-ci Triggers CI test workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant