/bayesian-estimation
This skill covers Bayesian estimation and inference in quantitative social science. Use when the user is specifying priors, running MCMC, diagnosing chain convergence, or reporting posterior summaries — including hierarchical models, Bayesian structural models, and small-sample
$ npx -y skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill bayesian-estimation --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/bayesian-estimation
Context preview
The summary Claude sees to decide when to auto-load this skill.
This skill covers Bayesian estimation and inference in quantitative social science. Use when the user is specifying priors, running MCMC, diagnosing chain convergence, or reporting posterior summaries — including hierarchical models, Bayesian structural models, and small-sample
SKILL.md
bayesian-estimation.SKILL.mdname: bayesian-estimation
argument-hint: "<model or estimation problem>"
description: >-
This skill covers Bayesian estimation and inference in quantitative social science. Use when the user is specifying priors, running MCMC, diagnosing chain convergence, or reporting posterior summaries — including hierarchical models, Bayesian structural models, and small-sample settings where priors regularize. Triggers on "Bayesian estimation", "Bayesian inference", "MCMC", "Markov chain Monte Carlo", "Stan", "PyMC", "NumPyro", "prior", "posterior", "credible interval", "Bayesian structural", "Bayesian BLP", "Bayesian DSGE", "hierarchical model", "random effects Bayesian", "posterior predictive check", "Bayes factor", "prior predictive check", "NUTS", "HMC", "Hamiltonian Monte Carlo", "R-hat", "rhat", "effective sample size", "ESS", "Bayesian calibration", "posterior distribution", "prior elicitation", "weakly informative prior", "brms", "rstanarm", "cmdstanpy", "pymc", "arviz".
Bayesian Estimation
Reference for Bayesian estimation in quantitative social science: from prior elicitation to MCMC implementation to posterior reporting. Covers the full workflow of specifying a Bayesian model, running inference, diagnosing convergence, and communicating results — with applications to structural models, hierarchical designs, and small-sample settings.
When to Use This Skill
Use when the user is:
- Specifying priors and setting up a Bayesian model in Stan, PyMC, NumPyro, brms, or rstanarm
- Running MCMC and diagnosing R-hat, ESS, divergences, or trace plots
- Implementing hierarchical (multilevel) models with partial pooling
- Adding Bayesian inference to a structural model (BLP, dynamic discrete choice, DSGE)
- Reporting credible intervals, posterior predictive checks, or model comparison statistics
- Eliciting priors from calibration targets or literature benchmarks
- Debugging sampling pathologies: divergences, low acceptance rates, poor mixing
Skip when:
- The model is large-N and well-identified (frequentist MLE/GMM is more efficient and faster)
- The task is pure structural estimation without Bayesian components (use `structural-modeling` skill)
- The user needs classical causal inference (use `causal-inference` skill)
When to Use Bayesian Estimation
Advantages
**Small samples**: Priors act as regularization. With N < 100 observations and several parameters, MLE can overfit or fail to converge. A weakly informative prior is often equivalent to several additional observations of prior knowledge.
**Hierarchical structure**: When data have natural groupings (markets, countries, firms), Bayesian partial pooling is more efficient than either pooling all groups (ignores variation) or fitting each group separately (ignores shared structure). Random effects Bayesian models borrow strength across groups.
**Uncertainty propagation**: The posterior is a full distribution. Downstream quantities (elasticities, welfare changes, counterfactuals) inherit full uncertainty without a delta method approximation.
**Natural model comparison**: Posterior predictive checks and LOO-CV are cleaner than frequentist test-based model selection, especially for non-nested models.
**Constrained parameters**: Parameters with domain restrictions (discount factors in [0,1], positive variances, simplex probability vectors) are handled naturally via transformed parameter blocks and appropriate priors.
When to Prefer Frequentist
- Large N (N > 10,000): Priors become irrelevant as the likelihood dominates; MLE or GMM is faster
- Simple models where MLE is efficient (OLS, logit, Poisson): No benefit from Bayesian approach
- Publication venues requiring classical standard errors and p-values (some applied micro journals)
- Models requiring solving equilibrium constraints (NFXP/MPEC) at each draw — computationally prohibitive
Comparison Table
| Scenario | Bayesian | Frequentist | |----------|----------|-------------| | N = 50, 10 parameters | Preferred — priors regularize | MLE may not converge | | N = 100,000, 5 parameters | Either works; MLE faster | Preferred — priors irrelevant | | Hierarchical / multi-group | Preferred — partial pooling | Mixed effects via ML is comparable | | Uncertainty in counterfactuals | Preferred — natural propagation | Delta method or bootstrap | | Structural model, large state space | Difficult — MCMC over full model | Preferred — NFXP/MPEC more tractable | | Non-standard likelihood | Either — depends on differentiability | GMM often more flexible | | Model comparison, non-nested | LOO-CV / WAIC | AIC/BIC, Vuong test | | Publication: applied micro top-5 | Use sparingly; justify carefully | Standard expectation |
---
Prior Elicitation
The core task: encode genuine prior knowledge without overwhelming the likelihood.
Weakly Informative Defaults
These encode vague knowledge — parameters are unlikely to be astronomically large — without strongly influencing the posterior when data are informative. These follow Gelman et al. (2008, 2017) recommendations:
| Parameter type | Recommended prior | Rationale | |----------------|-------------------|-----------| | Location / intercept (raw scale) | Normal(0, 10) | Very diffuse; most applications won't have effects > 10 SDs | | Location (standardized predictors) | Normal(0, 2.5) | Rules out extreme effects; standard for logistic regression | | Scale / variance | HalfNormal(1) or Exponential(1) | Positive, concentrates near zero but with wide right tail | | Log-scale parameters (elasticities) | Normal(0, 1) on log scale | Implies elasticity plausibly between 0.14 and 7.4 | | Correlation matrices | LKJ(2) | Shrinks toward identity; LKJ(1) is uniform on correlations | | Simplex (probability vectors) | Dirichlet(1, ..., 1) | Uniform over simplex |
Informative Priors from Calibration Targets
When the literature provides benchmark values, use them as prior means with SD reflecting plausible variation:
1. Use the `meth
Read more
name: bayesian-estimation argument-hint: "<model or estimation problem>" description: >- This skill covers Bayesian estimation and inference in quantitative social science. Use when the user is specifying priors, running MCMC, diagnosing chain convergence, or reporting posterior summaries — including hierarchical models, Bayesian structural models, and small-sample settings where priors regularize. Triggers on "Bayesian estimation", "Bayesian inference", "MCMC", "Markov chain Monte Carlo", "Stan", "PyMC", "NumPyro", "prior", "posterior", "credible interval", "Bayesian structural", "Bayesian BLP", "Bayesian DSGE", "hierarchical model", "random effects Bayesian", "posterior predictive check", "Bayes factor", "prior predictive check", "NUTS", "HMC", "Hamiltonian Monte Carlo", "R-hat", "rhat", "effective sample size", "ESS", "Bayesian calibration", "posterior distribution", "prior elicitation", "weakly informative prior", "brms", "rstanarm", "cmdstanpy", "pymc", "arviz".
Bayesian Estimation
Reference for Bayesian estimation in quantitative social science: from prior elicitation to MCMC implementation to posterior reporting. Covers the full workflow of specifying a Bayesian model, running inference, diagnosing convergence, and communicating results — with applications to structural models, hierarchical designs, and small-sample settings.
When to Use This Skill
Use when the user is:
- Specifying priors and setting up a Bayesian model in Stan, PyMC, NumPyro, brms, or rstanarm
- Running MCMC and diagnosing R-hat, ESS, divergences, or trace plots
- Implementing hierarchical (multilevel) models with partial pooling
- Adding Bayesian inference to a structural model (BLP, dynamic discrete choice, DSGE)
- Reporting credible intervals, posterior predictive checks, or model comparison statistics
- Eliciting priors from calibration targets or literature benchmarks
- Debugging sampling pathologies: divergences, low acceptance rates, poor mixing
Skip when:
- The model is large-N and well-identified (frequentist MLE/GMM is more efficient and faster)
- The task is pure structural estimation without Bayesian components (use `structural-modeling` skill)
- The user needs classical causal inference (use `causal-inference` skill)
When to Use Bayesian Estimation
Advantages
**Small samples**: Priors act as regularization. With N < 100 observations and several parameters, MLE can overfit or fail to converge. A weakly informative prior is often equivalent to several additional observations of prior knowledge.
**Hierarchical structure**: When data have natural groupings (markets, countries, firms), Bayesian partial pooling is more efficient than either pooling all groups (ignores variation) or fitting each group separately (ignores shared structure). Random effects Bayesian models borrow strength across groups.
**Uncertainty propagation**: The posterior is a full distribution. Downstream quantities (elasticities, welfare changes, counterfactuals) inherit full uncertainty without a delta method approximation.
**Natural model comparison**: Posterior predictive checks and LOO-CV are cleaner than frequentist test-based model selection, especially for non-nested models.
**Constrained parameters**: Parameters with domain restrictions (discount factors in [0,1], positive variances, simplex probability vectors) are handled naturally via transformed parameter blocks and appropriate priors.
When to Prefer Frequentist
- Large N (N > 10,000): Priors become irrelevant as the likelihood dominates; MLE or GMM is faster
- Simple models where MLE is efficient (OLS, logit, Poisson): No benefit from Bayesian approach
- Publication venues requiring classical standard errors and p-values (some applied micro journals)
- Models requiring solving equilibrium constraints (NFXP/MPEC) at each draw — computationally prohibitive
Comparison Table
| Scenario | Bayesian | Frequentist | |----------|----------|-------------| | N = 50, 10 parameters | Preferred — priors regularize | MLE may not converge | | N = 100,000, 5 parameters | Either works; MLE faster | Preferred — priors irrelevant | | Hierarchical / multi-group | Preferred — partial pooling | Mixed effects via ML is comparable | | Uncertainty in counterfactuals | Preferred — natural propagation | Delta method or bootstrap | | Structural model, large state space | Difficult — MCMC over full model | Preferred — NFXP/MPEC more tractable | | Non-standard likelihood | Either — depends on differentiability | GMM often more flexible | | Model comparison, non-nested | LOO-CV / WAIC | AIC/BIC, Vuong test | | Publication: applied micro top-5 | Use sparingly; justify carefully | Standard expectation |
---
Prior Elicitation
The core task: encode genuine prior knowledge without overwhelming the likelihood.
Weakly Informative Defaults
These encode vague knowledge — parameters are unlikely to be astronomically large — without strongly influencing the posterior when data are informative. These follow Gelman et al. (2008, 2017) recommendations:
| Parameter type | Recommended prior | Rationale | |----------------|-------------------|-----------| | Location / intercept (raw scale) | Normal(0, 10) | Very diffuse; most applications won't have effects > 10 SDs | | Location (standardized predictors) | Normal(0, 2.5) | Rules out extreme effects; standard for logistic regression | | Scale / variance | HalfNormal(1) or Exponential(1) | Positive, concentrates near zero but with wide right tail | | Log-scale parameters (elasticities) | Normal(0, 1) on log scale | Implies elasticity plausibly between 0.14 and 7.4 | | Correlation matrices | LKJ(2) | Shrinks toward identity; LKJ(1) is uniform on correlations | | Simplex (probability vectors) | Dirichlet(1, ..., 1) | Uniform over simplex |
Informative Priors from Calibration Targets
When the literature provides benchmark values, use them as prior means with SD reflecting plausible variation:
1. Use the `meth
📌 文档结构(2026-07-22 起): 本文件是中文默认入口 —— banner + badges + 信任面 + 9 阶段流水线速览 + 76 行合集总表。 每个合集的完整描述、按用途分组、精确数字、验证方法在 docs/CONTENT_ZH.md(扩展正文,总表行内的 → 直接跳转到对应锚点)。 English version: README-en.md · 中文扩展正文:docs/CONTENT_ZH.md · README-zh-CN.md 已弃用(重定向占位) 🌐 语言: English |
Other skills on auto-empirical-research-skills.
- /pipeline
Classical end-to-end empirical analysis workflow in the traditional Python econometric stack — pandas + numpy + scipy + statsmodels + linearmodels + pyfixest + rdrobust + econml + causalml + matplotlib/seaborn. **Defaults to economics empirical-paper style** (AER / QJE / AEJ) —
Open skill - /pipeline
Classical end-to-end empirical analysis workflow in the modern tidyverse + econometrics R ecosystem — dplyr + tidyr + haven + fixest + sandwich + lmtest + clubSandwich + AER + ivreg + did + bacondecomp + HonestDiD + eventstudyr + rdrobust + rddensity + Synth + gsynth + synthdid
Open skill - /pipeline
Classical end-to-end empirical analysis workflow in the traditional Stata ecosystem — native Stata + reghdfe + ivreg2 + csdid + did_imputation + eventstudyinteract + sdid + rdrobust + rddensity + synth + synth_runner + psmatch2 + teffects + ebalance + coefplot + esttab + asdoc +
Open skill - /00-Full-empirical-analysis-skill_StatsPAI
Use when the user asks to run a full empirical / causal analysis in Python — by default in the style of an applied economics paper (AER / QJE / JPE / ReStud / AEJ) with DID / RD / IV / SCM / DML / matching, written-out estimating equation + identifying assumption, Table 1 /
Open skill - /00.1-Full-empirical-analysis-skill_Python
Classical end-to-end empirical analysis workflow in the traditional Python econometric stack — pandas + numpy + scipy + statsmodels + linearmodels + pyfixest + rdrobust + econml + causalml + matplotlib/seaborn. **Defaults to economics empirical-paper style** (AER / QJE / AEJ) —
Open skill - /00.2-Full-empirical-analysis-skill_Stata
Classical end-to-end empirical analysis workflow in the traditional Stata ecosystem — native Stata + reghdfe + ivreg2 + csdid + did_imputation + eventstudyinteract + sdid + rdrobust + rddensity + synth + synth_runner + psmatch2 + teffects + ebalance + coefplot + esttab + asdoc +
Open skill

