Логотип Rdd

Rdd

Спільнота
ericluo04
rdd

Design, estimate, validate, and write up a regression discontinuity analysis, in both the continuity and local-randomization frameworks, with the full falsification battery and a refusal rule for designs that fail validation. TRIGGER on "regression discontinuity", "RDD", "running variable", "score cutoff", "rdrobust", "bandwidth selection", "McCrary test", "density test", "fuzzy RD", "regression kink", "local randomization", "donut", "geographic RD", "boundary discontinuity", "multiple cutoffs", "heaping", "rddensity", "rdlocrand", "RDHonest", or any setting where treatment switches at a known score threshold (loyalty tiers, spend thresholds, ranking cutoffs, algorithmic triggers, eligibility scores, age or tenure rules).

Огляд

Видавецьericluo04
Репозиторійclaude-academic-workflow
Назва навичкиrdd
Зірки
26
Форки
3
Файли в пакеті
3
Посилання
  • Інструкції у форматі Markdown

    Файл SKILL.md, який модель завантажує за потреби, тож токени витрачаються лише тоді, коли запит справді відповідає навичці.

  • Працює з будь-якою LLM

    Навички ШІ — це звичайний Markdown, а не код для певного постачальника, тому вони працюють із GPT, Claude, Gemini, Grok або локальною моделлю.

  • Файлів у комплекті: 3

    Скрипти, шаблони й довідкові матеріали, які модель може читати під час роботи. Файли доступні лише для читання й ніколи не виконуються.

  • Відкритий вихідний код

    Опубліковано на GitHub користувачем ericluo04. Перегляньте вихідний вміст перед установленням.

Встановлення

Установіть навичку ШІ Rdd у TypingMind, щоб використовувати її з будь-якою LLM, або додайте її до іншого агента, що читає SKILL.md.

1

Встановити в TypingMind

TypingMind встановлює навичку безпосередньо з її папки GitHub — читає SKILL.md, збирає файли ресурсів у пакет і зберігає результат локально.

  1. Відкрийте застосунок і перейдіть до Плагіни → Навички.
  2. Виберіть «Встановити з GitHub».
  3. Вставте наведений нижче URL папки навички та підтвердьте встановлення.
    https://github.com/ericluo04/claude-academic-workflow/tree/main/skills/rdd
  4. Увімкніть навичку в кожному чаті, де хочете її використовувати.
Плагіни → Навички → Нова навичка → За URL GitHub, потім вставте URL папки й натисніть «Продовжити».
2

Встановити в іншому агенті

Будь-який агент, що підтримує формат Agent Skills, може використовувати цю навичку — скопіюйте папку до каталогу навичок цього агента.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/ericluo04/claude-academic-workflow.git /tmp/claude-academic-workflow
mkdir -p .claude/skills
cp -r /tmp/claude-academic-workflow/skills/rdd .claude/skills/rdd
Після копіювання перезапустіть Claude Code, щоб завантажити нову навичку.

Використовуйте навичку в TypingMind

Увімкніть навичку Rdd в будь-якому чаті TypingMind, і далі модель усе зробить сама. Назва й опис навички містяться в системному промпті, а щойно надходить відповідний запит, модель самостійно завантажує повні інструкції — вам не потрібно викликати навичку вручну, і до фактичного використання вона не витрачає токенів.

Модель самостійно завантажує навичку Rdd, щойно надходить відповідний запит.

Працює з будь-якою моделлю ШІ

Навички ШІ — це звичайні інструкції Markdown, а не код для певного постачальника, тому навичка Rdd не прив’язана до моделі, для якої її створено. Установіть її один раз у TypingMind і використовуйте з GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama або локальною моделлю, яку ви запускаєте самостійно, — усе з вашими власними ключами API.

  • Завантажується лише за потреби

    Системний промпт містить лише назву й опис. Інструкції завантажуються за першого відповідного запиту, тож невикористана навичка нічого не коштує.

  • Змінюйте моделі під час чату

    Оскільки навичка — це інструкції, а не код, зміна моделі не порушує її роботу: наступна модель читає той самий файл SKILL.md.

Інструкції навички

Це вміст файлу SKILL.md, який завантажує модель. Прочитайте його перед установленням — навичка містить інструкції, яких дотримуватиметься ваша модель.

Regression discontinuity

An opinionated RD workflow grounded in a read canon (references/canon.md): the Cattaneo-Titiunik Annual Review of Economics survey and its applied companion, the Cattaneo-Keele-Titiunik guide, which includes a real failed design this skill uses as its refusal template. Deliverable: the recommendation with its citation, the R estimation and diagnostics code, and a methods paragraph. The skill stops at the four stop points in ../causal-design/references/shared-rules.md (section "Stop points") and puts each choice to the user.

Current as of 2026-10-09; refresh per shared-rules (../causal-design/references/shared-rules.md, section "Refresh path"). Nothing enters the canon without the user's approval.

Design shapes and the case that anchors each

Each canonical case is a precedent a methods section can cite; details.md says what each teaches.

Design shapeCanonical caseMarketing analogueWhat kills it
Age or tenure eligibility ruleCard, Dobkin, Maestas 2008trial expiry, anniversary status rolloffsomething else switches at the same threshold
Agency-measured score, sharpHansen 2015churn-score retention offersreps or managers override the rule off-cutoff
Heaped or rounded scoreAlmond et al. 2010; Barreca et al. 2011, 2016spend thresholds recorded in whole dollarsexcess mass at round values that the density test misses
Share crossing a fixed barLee, Moretti, Butler 2004seller badge above an on-time-delivery ratepredetermined covariates already jump in the smallest window
Admission cutoff, fuzzy first stageHoekstra 2009lead-score outreach with rep discretiona first stage too weak to carry the ratio
Boundary or geographic RDBlack 1999DMA advertising bordersthe border sorts households, or ads spill across it

The design gate: is this an RD at all?

An RD requires a score, a known cutoff, and a treatment rule that existed ex ante and is verifiable. Before any estimation, write the qualitative account: who computes the score, was the cutoff public, can agents precisely control their score near it. Precise manipulation is the most important threat. Lab-measured or third-party-computed scores resist it; self-influenced scores (customer spend near a tier threshold, follower counts near a monetization bar) invite exactly the sorting the density test detects, so the falsification battery carries more weight in marketing settings than in the medical originals.

One more gate question, and the one sharp designs skip: list every rule, benefit, message, and flag that changes at this exact threshold, and say which of them is the treatment. Medicare starts at 65 and so does retirement, so Card, Dobkin, and Maestas (2008) went to a third dataset on the same running variable (the pooled March CPS 1996-2004, pp. 2247-2248) and showed employment does not jump. When the confounder is not in your data, find a dataset on the same score where it is.

State the no-interference assumption: one unit's side of the cutoff does not change another unit's outcome. A seller badge or a loyalty tier can shift the competitors and peers sitting just below the cutoff. When that is plausible, the estimate mixes the direct effect with a spillover onto the comparison group, and the price is that the RD no longer identifies the direct effect alone. Name the channel in the write-up. Spillover designs belong to the field-experiment skill's interference material.

Two red flags come from the failed Oncotype-DX application in Cattaneo-Keele-Titiunik (2023). The guide read the take-up jumps at scores 24 and 25 as evidence the guideline was not followed. It rejected the design on the weak first stage (F = 1.51) and on imbalance in the smallest windows. Treating the first flag as disqualifying on its own is this skill's judgment. Off-cutoff jumps mean the official cutoff is not the rule that assigns treatment.

  1. Treatment take-up jumps at score values away from the official cutoff (the rule was soft: reps contact leads below the threshold, managers grant status matches early). Plot take-up against the score before anything else.
  2. Covariate imbalance already in the smallest window around the cutoff: disqualifying when the imbalanced covariate plausibly drives the outcome (the balance battery's standard, below), otherwise a serious flag that demands an explanation before proceeding.

When a design fails, say so and decline to report an effect; the guide's own verdict on its failed application ("the evidence does not support an RD analysis") is the template. Route the question back to causal-design for another identification strategy.

Triage: two frameworks, and which one leads

Sharp vs fuzzy is a fact of the institution, not a choice: sharp when the rule binds mechanically (a trial expires, a discount ends at an anniversary), fuzzy whenever anyone can cross their assignment (overrides, opt-ins). Under fuzziness always report both ITT effects (on take-up and on the outcome) alongside the fuzzy ratio.

Continuity vs local randomization is decided by the score:

  • Continuous score, many observations near the cutoff: continuity framework with local polynomials leads; local randomization is the robustness complement.
  • Discrete score (rule of thumb: roughly 30 or fewer distinct values) or very few observations near the cutoff: local randomization leads. Continuity methods there extrapolate from the nearest mass points and their effective sample size is the number of mass points, not the number of observations. Discrete running variables (weeks of tenure, order counts, months since signup) are the norm in marketing data, which makes this branch more common than the econ literature suggests.
  • Local randomization needs a stronger and different assumption (potential outcomes unrelated to the score inside the window), which must be argued. The two are not nested: local randomization stays valid for discrete scores where continuity methods may fail (Cattaneo-Keele-Titiunik 2023, sec. 2.3).

When both frameworks apply, run both; agreement is a robustness result, and the local randomization CIs covering the continuity point estimate counts as consistency. Expect the window to be far narrower than the bandwidth (in the guide's HIV application, 121 patients vs 2,593), so a local-randomization null alongside a significant continuity estimate can be a power difference, not a contradiction.

The consensus recipe (continuity framework)

Local linear regression, triangular kernel, MSE-optimal bandwidth, robust bias-corrected confidence intervals (Calonico-Cattaneo-Titiunik). Report both the conventional and the robust interval. The one-line justification: in the survey's back-of-the-envelope calculation (Cattaneo and Titiunik 2022), conventional 95 percent intervals at the MSE-optimal bandwidth cover only about 80 percent, and bias correction with the matching variance adjustment restores coverage at the same bandwidth. Two things get called robust: Cunningham, The Mixtape, online ch. 6 sec. 6.6, moves between heteroskedasticity-robust OLS standard errors and rdrobust's Robust row without flagging the difference, and this skill keeps them apart because HC-robust errors leave the point estimate alone while rdrobust's Robust row recenters on the bias-corrected estimate and widens the interval by the variance of the bias estimate.

Hard rules from the review, stated as prohibitions because that is how it states them:

  • Bandwidths must be data-driven and criterion-optimal; choosing one by hand "is discouraged." MSE-optimal for the point estimate, CE-optimal when the interval is the object. Distinct left/right bandwidths are available when curvature differs by side (Arai and Ichimura), and the selectors have clustered variants. The simple RBC implementation runs inference at polynomial order p+1 with the MSE-optimal bandwidth for order p. The Mixtape (online ch. 6 sec. 6.6) replicates Hansen 2015 with hand-picked bandwidths and a rectangular kernel, which is how RD was done before 2014; this skill refuses that as a primary specification and keeps it only for reproducing a paper that predates the criterion-optimal machinery.
  • Never cluster standard errors on the running variable. Lee 2008 and Lee and Card 2008 recommended the practice. This skill states it as a prohibition because Kolesar and Rothe 2018 show that the confidence interval clustered on a discrete score can undercover, with coverage as low as 58 percent at a nominal 95 percent (p. 2279). Use heteroskedasticity-robust variance, honest intervals for a discrete score (RDHonestBME, below), and cluster only on a real assignment unit that is not the score. Replicating or refereeing an older RD, expect to find this and fix it. The family's clustering and multiplicity rules (cluster level, few clusters, a multiplicity statement for the balance battery) are in ../causal-design/references/shared-rules.md.
  • Global polynomial fits are visualization only, never estimation (Gelman-Imbens): boundary behavior, counterintuitive weighting, overfitting.
  • Polynomial order: p = 1 default, p = 2 and a uniform kernel as the robustness checks, never high order. A data-driven choice of order exists (Pei, Lee, Card, and Weber). Underfitting biases in the other direction. Curvature is handled by narrowing the window, since the common MSE-optimal bandwidth shrinks as the curvature difference across the cutoff rises (Imbens and Kalyanaraman 2012). h_MSE also grows with p, so the p = 2 check runs on a wider window and a different effective sample. When p = 2 moves the estimate, check the window. The Mixtape's numbers for both points (Tables 6.1 and 6.8) are in references/details.md, section "Polynomial order: the Mixtape numbers".
  • Covariates are for precision only (Calonico, Cattaneo, Farrell, and Titiunik 2019); they cannot restore identification of the canonical RD parameter, and adjusting an invalid design changes the parameter rather than rescuing it. The point estimate should barely move when covariates enter; a large move signals imbalance.

The local-randomization recipe

Select the window by nested covariate-balance tests, then difference in means inside it, with Fisherian randomization inference when the window holds few observations (exact under the sharp null) and Neyman or super-population inference when it is well populated. Window-selection mechanics, thresholds, and what a narrow window does to power: references/details.md.

Fuzzy designs: the IV discipline applies

The fuzzy estimand is a complier average effect at the cutoff under relevance, exclusion, and monotonicity, so the iv skill's habits transfer:

  • Test the first stage inside the bandwidth or window, never on the full sample; the full-sample F overstates strength. The guide's contrast is the anchor: F around 698 in the valid design against F = 1.51 in the failed one, where the first-stage effect is 0.15 with a Fisherian p-value of 0.32. An in-bandwidth first-stage F that is neither the strong nor the hopeless extreme goes to the iv skill's ladder for reading F. The weak-first-stage intervals come from RD-native tools. In the window, use rdrandinf(fuzzy = list(d, "ar")), whose default statistic is Anderson-Rubin. In the continuity framework, use the bias-aware confidence sets of Noack and Rothe (2024), which are built like Anderson-Rubin sets and stay valid under weak identification. Do not report the 2SLS t.
  • Argue exclusion qualitatively and concretely: it fails if crossing the cutoff changes behavior through anything other than treatment (a low churn score triggering a retention call AND a flag another team acts on).
  • Monotonicity: safe when crossing the threshold moves treatment in one direction only; suspect when overrides run in both directions (the failed-design pattern above, reps contacting below-threshold leads while managers grant early crossings, is exactly the defiers case); one-sided noncompliance buys it for free.
  • Run fuzzy-ratio balance tests: instrument strength amplifies covariate bias, so imbalance invisible to ITT balance can surface in the ratio.
  • Use one MSE-optimal bandwidth for the ratio, not separate ones for numerator and denominator.

Falsification battery

Run them in this order. Each check's bandwidth convention and what its failure means are in references/details.md, section "Falsification checklist with per-check conventions".

  1. Qualitative manipulation account.
  2. Density continuity test (rddensity) plus the exact binomial count test. When a density jump cannot be explained, report the manipulation-robust bounds of Gerard, Rokkanen, and Rothe (2020) or walk away.
  3. Heaping: the raw histogram of the score.
  4. Covariate and placebo-outcome balance. A failure on a covariate that plausibly drives the outcome invalidates the design, and the verdict is to walk away rather than to adjust.
  5. Placebo cutoffs.
  6. Donut hole.
  7. Bandwidth and window sensitivity.

When a null matters, report minimum detectable effects (rdpower), never ex-post power from the observed effect.

The live dispute, carried honestly

Robust bias correction (this canon's school) vs honest uniform-in-bias inference (Armstrong-Kolesar, Imbens-Wager; R package RDHonest). The honest school bounds the second derivative by a constant M and gets uniformly valid intervals; the canon's objection is that a data-driven M destroys the uniformity that motivates the method, and a manual M is equivalent to choosing the bandwidth by hand. RDHonest has two data-driven routes. RDSmoothnessBound() estimates a lower bound on M, and RDHonest() falls back to the Armstrong-Kolesár (2020) rule of thumb when M is omitted (MROT, confirmed in the 1.0.2 CRAN source). Default here: RBC. When a referee or coauthor asks for honest intervals, report RDHonest alongside with the M choice justified in text, and cite both sides.

The honest school's fuzzy answer is Noack and Rothe (2024). Their bias-aware confidence sets match the usual procedures under strong identification and a continuous score. They stay valid with a discrete score, a donut, or a weak first stage, where the delta-method interval relies on approximations that can fail. Report them when the in-bandwidth first stage is weak. They are not on CRAN (index checked 2026-10-09). The authors' FRD package is a Windows binary on Noack's site, and we have not checked it. A 2025 preprint (Ghosh, Imbens, and Wager, PLRD) argues that widely used RD intervals often behave suboptimally in simulations calibrated to twelve published applications. In its v3, rdrobust's RBC intervals undercover in some calibrated designs and at n = 500 (Tables 1 and 3).

Extensions, briefly

  • Kink designs: same machinery on first derivatives; identification is more delicate.
  • Multiple cutoffs or scores (tiered loyalty programs): cutoff-specific effects or normalize-and-pool (rdmulti), with the pooled estimand's interpretation checked.
  • Geographic or boundary RD (DMA advertising borders): rd2d (Cattaneo, Titiunik, and Yu 2025) estimates effects along the boundary from each unit's two-dimensional location, with uniform inference over boundary points.
  • Heterogeneity (subgroup effects at the cutoff): rdhte (Calonico, Cattaneo, Farrell, Palomba, and Titiunik 2025) fits a fully interacted local linear model with robust bias-corrected inference and tests group differences, where applied work has used ad hoc approaches.
  • Repeated thresholds (monthly tier evaluations, where a unit can cross the cutoff many times): a static RD misreads the long-run effect. Hsu and Shen (2024) give identification and inference for dynamic RD under heterogeneous effects.
  • RD in time: hard to justify as standard RD; the local-randomization framework is the adaptation when it works at all. Prefer did or synthetic-control for policy-date designs.
  • Extrapolation beyond the cutoff LATE needs added assumptions, and the menu is in references/details.md. Say which one when claiming anything away from the cutoff. Absent one, the methods paragraph says the estimate is local to the cutoff, full stop.

R implementation

The complete runnable pipeline is scripts/rdd_template.R (estimation in both frameworks, fuzzy diagnostics, the full falsification battery, power/MDE), with every call verified against the rdpackages suite. The core:

r
library(rdrobust); library(rddensity); library(rdlocrand)
rdplot(y, x, c = cutoff)                      # anatomy first
summary(rdrobust(y, x, c = cutoff))           # sharp: local linear, triangular, MSE-h, RBC
summary(rdrobust(d, x, c = cutoff))           # first stage / ITT on take-up
summary(rdrobust(y, x, c = cutoff, fuzzy = d))# fuzzy ratio
summary(rddensity(x, c = cutoff))             # manipulation
w <- rdwinselect(x, Z, cutoff = cutoff)       # local-randomization window
rdrandinf(y, x, cutoff = cutoff, wl = w$w_left, wr = w$w_right)

Four figures carry a credible RD: the density of the score, take-up against the score, covariate balance, and the outcome in bin means. If you cannot see the effect in the bin means you are underpowered or it is not there. Report the estimate against the mean of the dependent variable, so a small coefficient on a large base reads as a precise null (0.6 points on an 84.6 percent base, in the Mixtape's balance table, online ch. 6 sec. 6.6, Table 6.6).

Package index with versions and links in references/details.md. Stata and Python mirrors of the whole suite live at rdpackages.github.io; the guide ships full replication code in all three.

Methods paragraph template

Report each effect with the results sentence in ../causal-design/references/shared-rules.md (section "Results sentence"): magnitude, direction, a benchmark, and the calibration vocabulary.

Treatment assignment changes discontinuously at [cutoff] in [score], a rule set by [institution] before the outcomes we study, and units [cannot / can only imprecisely] control their score near it. The estimand is [the average effect of treatment for units at the cutoff (sharp) / the average effect for compliers at the cutoff (fuzzy)]. We estimate the RD effect with local linear regression, a triangular kernel, and an MSE-optimal bandwidth of [h] on [each side / the left and right] ([N_left] and [N_right] observations inside it), and report robust bias-corrected confidence intervals (Calonico, Cattaneo, and Titiunik 2014; Cattaneo and Titiunik 2022). Standard errors use [the nearest-neighbor heteroskedasticity-robust variance / CR3 variance clustered by [unit], with [G] clusters]. [In the local-randomization framework, the window [w_left, w_right] holds [N_w] observations, and the Fisherian difference in means is [estimate] (p = [p]).] We validate the design with the Cattaneo-Jansson-Ma density test and an exact binomial test, covariate balance at the cutoff with per-covariate bandwidths, placebo cutoffs, donut-hole estimates, and bandwidth sensitivity [and, for the fuzzy design, verify first-stage strength within the estimation bandwidth and report intention-to-treat effects alongside the complier estimate]. The estimate is local to the cutoff; a limitation of this design is that it does not identify effects for [units far from the threshold], and I extrapolate only [not at all / under the stated assumption], which costs [generalizability across the score distribution].

Every claim traces to references/canon.md; keys live in ../causal-design/references/causal.bib.

Handoffs

  • causal-design: whether an RD exists at all; where to go when the design gate fails.
  • iv: the fuzzy branch's in-bandwidth first stage and exclusion argument live here; weak-instrument inference (the F ladder, AR/CLR intervals) lives in iv, along with many-instrument and shift-share logic.
  • did / synthetic-control: policy-date designs masquerading as RD in time.
  • Preregistration: the user writes it themselves; this skill supplies the RD field list for an upcoming threshold change.

Файли в пакеті

Модель читає ці файли за потреби, поки навичку завантажено. Вони доступні для читання й ніколи не виконуються.

Поширені запитання

Що робить навичка ШІ Rdd?

Design, estimate, validate, and write up a regression discontinuity analysis, in both the continuity and local-randomization frameworks, with the full falsification battery and a refusal rule for designs that fail validation. TRIGGER on "regression discontinuity", "RDD", "running variable", "score cutoff", "rdrobust", "bandwidth selection", "McCrary test", "density test", "fuzzy RD", "regression kink", "local randomization", "donut", "geographic RD", "boundary discontinuity", "multiple cutoffs", "heaping", "rddensity", "rdlocrand", "RDHonest", or any setting where treatment switches at a kn...

Навіщо використовувати Rdd у TypingMind?

Тому що ви встановлюєте її один раз і використовуєте з будь-якою моделлю. Rdd — це звичайний Markdown, а не код для конкретного постачальника, тому та сама навичка працює з GPT-5, Claude, Gemini, Grok або локальною моделлю. Ви можете змінити модель навіть посеред чату, і навичка продовжить працювати. TypingMind використовує ваші власні ключі API, тож ви платите безпосередньо постачальникам замість передплати за кожне місце користувача, а ваші навички й чати залишаються у вашому сховищі.

Як встановити Rdd у TypingMind?

Відкрийте в TypingMind Плагіни → Навички → Встановити з GitHub і вставте https://github.com/ericluo04/claude-academic-workflow/tree/main/skills/rdd. TypingMind прочитає файл SKILL.md, додасть супровідні файли та встановить навичку, яку можна вмикати окремо для кожного чату.

Які моделі ШІ можуть використовувати Rdd?

Будь-яка модель, яку ви підключите в TypingMind. Навички ШІ — це звичайні інструкції у форматі Markdown, а не код для конкретного постачальника, тому GPT, Claude, Gemini, Grok і локальні моделі можуть завантажувати цю навичку, коли запит їй відповідає.

Зі скількома моделями ШІ можна використовувати Rdd?

Зі скількома забажаєте. Якщо модель підтримує навички, ви можете використовувати з нею Rdd — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama та інші — усе в TypingMind із власними ключами API.

Чи безкоштовна навичка ШІ Rdd?

Навичку опубліковано на GitHub: ericluo04. Умови ліцензування дивіться в репозиторії. Ви платите лише своєму постачальнику ШІ за використані токени.

Що таке навички ШІ?

Навичка ШІ — це багаторазовий набір інструкцій, який навчає модель ШІ виконувати одне конкретне завдання. Він відповідає відкритому формату Agent Skills: файл SKILL.md із назвою та описом, а також скрипти, шаблони чи довідкові файли, які можуть знадобитися моделі. Модель читає інструкції лише тоді, коли ваш запит відповідає навичці, тому встановлена навичка нічого не коштує, доки її не використано.

Чим навички ШІ відрізняються від плагінів або серверів MCP?

Плагін або сервер MCP надає моделі нові інструменти для виклику — код, який десь виконується й повертає результат. Натомість навичка ШІ надає моделі знання та порядок дій: як підійти до завдання, яких кроків дотримуватися та яким має бути якісний результат. Навички — це звичайний Markdown, тож їм не потрібні ні сервер, ні ключ API, ні середовище виконання, і вони працюють із будь-якою моделлю.

Усі

Створіть власний ШІ-простір уже зараз

Підпишіться на нашу розсилку, щоб дізнаватися про нові функції та майбутні розіграші 👇