skills/43-wentorai-research-plugins/skills/analysis/econometrics/robustness-checks/SKILL.md
Sequential robustness checks in Stata with confounder blocks
npx skillsauth add brycewang-stanford/Awesome-Agent-Skills-for-Empirical-Research robustness-checksInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
A skill for conducting sequential robustness checks in Stata, systematically adding blocks of potential confounders to assess estimate stability.
* Base model
svy: regress outcome controls treatment
estimates store m1
* Add confounder block
svy: regress outcome controls treatment confounder1 confounder2
estimates store m2
* Compare
esttab m1 m2, se star(+ 0.1 * 0.05 ** 0.01)
* Define base controls
local control_var i.batch age i.race i.gender i.education
estimates clear
* Model 1: Base model
svy: regress outcome `control_var' treatment
margins, dydx(treatment) post
estimates store m1
* Model 2: Add contextual factors
svy: regress outcome `control_var' treatment covid health_insurance
margins, dydx(treatment) post
estimates store m2
* Model 3: Add health factors
svy: regress outcome `control_var' treatment cci_charlson any_encounter
margins, dydx(treatment) post
estimates store m3
* Model 4: Add psychological factors
svy: regress outcome `control_var' treatment depression anxiety
margins, dydx(treatment) post
estimates store m4
* Model 5: Add behavioral factors
svy: regress outcome `control_var' treatment i.smoke_status bmi
margins, dydx(treatment) post
estimates store m5
*------------------------------------------------------------
* Table: Robustness Checks
*------------------------------------------------------------
version 17
clear all
use "analysis_data.dta", clear
svyset cluster [pweight = weight]
* Base controls (always included)
local control_var i.batch leukocytes age i.race i.gender i.education i.marital
estimates clear
*--- Model 1: Baseline ---
svy: regress outcome `control_var' treatment
margins, dydx(treatment) post
estimates store m1
*--- Model 2: + COVID & Insurance ---
svy: regress outcome `control_var' treatment covid health_insurance
margins, dydx(treatment) post
estimates store m2
*--- Model 3: + Healthcare utilization ---
svy: regress outcome `control_var' treatment cci_charlson any_encounter_3years
margins, dydx(treatment) post
estimates store m3
*--- Model 4: + Multimorbidity ---
svy: regress outcome `control_var' treatment multi_morbidity
margins, dydx(treatment) post
estimates store m4
*--- Model 5: + Psychosocial factors ---
svy: regress outcome `control_var' treatment matter_important matter_depend
margins, dydx(treatment) post
estimates store m5
*--- Model 6: + Occupation ---
svy: regress outcome `control_var' treatment i.occ_group
margins, dydx(treatment) post
estimates store m6
*--- Model 7: + Smoking ---
svy: regress outcome `control_var' treatment i.smoke_status
margins, dydx(treatment) post
estimates store m7
*--- Model 8: + Childhood adversity ---
svy: regress outcome `control_var' treatment c.aces_sum_std
margins, dydx(treatment) post
estimates store m8
*--- Export ---
esttab m1 m2 m3 m4 m5 m6 m7 m8 using "robustness.csv", csv se ///
mtitle("Base" "+COVID" "+Health" "+Morbid" "+Psych" "+Occ" "+Smoke" "+ACE") ///
nogap label replace star(+ 0.1 * 0.05 ** 0.01)
* Repeat for each outcome
foreach outcome in pace grimage2 phenoage {
estimates clear
svy: regress `outcome' `control_var' treatment
margins, dydx(treatment) post
estimates store `outcome'_m1
svy: regress `outcome' `control_var' treatment covid health_insurance
margins, dydx(treatment) post
estimates store `outcome'_m2
svy: regress `outcome' `control_var' treatment cci_charlson any_encounter
margins, dydx(treatment) post
estimates store `outcome'_m3
}
* Export all
esttab pace_m1 pace_m2 pace_m3 grimage2_m1 grimage2_m2 grimage2_m3 ///
using "robustness_all.csv", csv se nogap label replace
estimates clear
* Linear specification
svy: regress outcome `control_var' treatment
estimates store linear
* Logged outcome
gen log_outcome = ln(outcome + 1)
svy: regress log_outcome `control_var' treatment
estimates store log_linear
* Categorical treatment
svy: regress outcome `control_var' i.treatment_cat
estimates store categorical
* With squared term
svy: regress outcome `control_var' c.treatment##c.treatment
estimates store quadratic
esttab linear log_linear categorical quadratic using "spec_checks.csv", ///
csv se nogap label replace
estimates clear
* Full sample
svy: regress outcome `control_var' treatment
estimates store full
* Exclude outliers
svy: regress outcome `control_var' treatment if outcome < p99_outcome
estimates store no_outliers
* Complete cases only
svy: regress outcome `control_var' treatment if complete_case == 1
estimates store complete
* Subpopulation
svy, subpop(if age >= 50): regress outcome `control_var' treatment
estimates store age50plus
esttab full no_outliers complete age50plus using "sample_checks.csv", ///
csv se nogap label replace
estimates clear
* Binary treatment
svy: regress outcome `control_var' treatment_binary
margins, dydx(treatment_binary) post
estimates store binary
* Continuous treatment
svy: regress outcome `control_var' treatment_continuous
margins, dydx(treatment_continuous) post
estimates store continuous
* Categorical treatment
svy: regress outcome `control_var' i.treatment_cat
margins, dydx(treatment_cat) post
estimates store categorical
* Standardized treatment
svy: regress outcome `control_var' c.treatment_std
margins, dydx(treatment_std) post
estimates store standardized
esttab binary continuous categorical standardized using "alt_definitions.csv", ///
csv se nogap label replace
| Result | Interpretation | |--------|----------------| | Estimate stable across models | Robust to confounding | | Estimate attenuates with additions | Confounding present | | Estimate reverses sign | Serious confounding concern | | Estimate strengthens | Suppression effect | | SE increases substantially | Multicollinearity |
development
Conduct rigorous thematic analysis (TA) of qualitative data following Braun and Clarke's (2006) six-phase framework. Use whenever the user mentions 'thematic analysis', 'TA', 'Braun and Clarke', 'qualitative coding', 'identifying themes', or asks for help analysing interviews, focus groups, open-ended survey responses, or transcripts to identify patterns. Also trigger for questions about inductive vs theoretical coding, semantic vs latent themes, essentialist vs constructionist epistemology, building a thematic map, or writing up a qualitative findings section. Covers all six phases, the four upfront analytic decisions, the 15-point quality checklist, and the five common pitfalls. Produces a Word document write-up and an annotated thematic map. Does NOT cover IPA, grounded theory, discourse analysis, conversation analysis, or narrative analysis — use a different method for those.
development
Guide users through writing a systematic literature review (SLR) following the PRISMA 2020 framework. Use this skill whenever the user mentions 'systematic review', 'systematic literature review', 'SLR', 'PRISMA', 'PRISMA 2020', 'PRISMA flow diagram', 'PRISMA checklist', or asks for help writing, structuring, or auditing a literature review that follows reporting guidelines. Also trigger when the user asks about inclusion/exclusion criteria for a review, search strategies for databases like Scopus/WoS/PubMed, study selection processes, risk of bias assessment, or narrative synthesis for a review paper. This skill covers the full PRISMA 2020 checklist (27 items), produces a Word document manuscript in strict journal article format, generates an annotated PRISMA flow diagram, and enforces APA 7th Edition referencing throughout. It does NOT cover meta-analysis or statistical pooling. By Chuah Kee Man.
testing
Performs placebo-in-time sensitivity analysis with hierarchical null model and optional Bayesian assurance. Use when checking model robustness, verifying lack of pre-intervention effects, or estimating study power.
data-ai
Fit, summarize, plot, and interpret a chosen CausalPy experiment. Use after the causal method has been selected, including when configuring PyMC/sklearn models and scale-aware custom priors.