stat-bayesian-estimation
Estimate model parameters using Bayesian inference (MCMC via Stan or PyMC), returning posterior distributions and credible intervals.
- License 许可
- MIT
- 最近更新
- 2026-11-03
- Stars
- ★ 4
- Forks
- 1
01 前言 Front Matter
- name
- stat-bayesian-estimation
- description
- Estimate model parameters using Bayesian inference (MCMC via Stan or PyMC), returning posterior distributions and credible intervals.
02 资源文件 6
- 参考文档agents/claude.yaml361 B
- 参考文档agents/openai.yaml362 B
- 参考文档config.yaml321 B
- 参考文档references/api-reference.md16.5 KB
- 参考文档references/examples-antipatterns.md13.3 KB
- 参考文档references/service-pattern.md9.5 KB
03 SKILL.md 正文
Skill: Bayesian Parameter Estimation
Use When
- User wants to estimate parameters with full uncertainty quantification via posterior distributions
- User wants to incorporate prior knowledge about parameters
- User needs credible intervals instead of frequentist confidence intervals
- Use cases: dose-response modeling, population parameter estimation, hierarchical biological models
Inputs
- Required:
- Data table (CSV or TSV) with observed values
- Model specification: response variable, predictor variables, model family (
normal,poisson,binomial)
- Optional:
- Prior distributions for each parameter (default: weakly informative priors — normal(0, 10) for coefficients)
- Number of MCMC chains (default:
4) - Number of samples per chain (default:
2000, warmup:1000) - Target acceptance rate (default:
0.8) - Backend:
pymc(default) orstan - Output directory (default:
./bayes_output)
Workflow
- Read data; validate response and predictor columns.
- Set up Bayesian model with specified family and prior distributions.
- Run MCMC sampling with the specified backend (PyMC or Stan).
- Check convergence: R-hat statistic (should be < 1.01 for all parameters), effective sample size (ESS > 400).
- Extract posterior samples; compute posterior mean, median, standard deviation, and 94% credible interval (HDI) for each parameter.
- Generate trace plots (one per parameter) to visually assess convergence.
- Generate posterior distribution plots (one per parameter).
- Generate posterior predictive check plot (observed vs. simulated data).
- Write posterior summary (TSV), trace plots (PDF), and posterior plots (PDF) to output directory.
- Report convergence diagnostics; flag any parameters with R-hat ≥ 1.01 or ESS < 400.
- Save the executable analysis script (
analysis_code.pyoranalysis_code.R) and software version manifest (session_info.txt) used to produce results.
Output Contract
- Posterior summary table (TSV): parameter, mean, sd, median, hdi_lower_94, hdi_upper_94, r_hat, ess_bulk, ess_tail
- Trace plots (PDF)
- Posterior distribution plots (PDF)
- Posterior predictive check plot (PDF)
- Convergence warnings (printed to stdout if any)
- Reproducibility artifacts:
analysis_code.pyoranalysis_code.R, plussession_info.txt
Limits
- Requires PyMC or CmdStanPy to be installed; check environment before running.
- MCMC can be slow for complex models or large datasets; variational inference (ADVI) is faster but approximate.
- Weakly informative default priors may be inappropriate for constrained parameters (e.g., probabilities must be [0,1]) — specify priors explicitly when needed.
- R-hat ≥ 1.01 indicates non-convergence; increase warmup or reparameterize model.
- Common failure: identifiability issues (collinear predictors) causing MCMC to fail to mix.
04 同仓库更多 Skills
structured-intelligence-skill-creator
Create or update repository skills that conform to local templates, provider metadata requirements, registry rules, and validation workflows.
stat-survival-analysis
Estimate and compare survival functions using Kaplan-Meier curves and log-rank test, with optional Cox proportional hazards regression.
stat-pca
Perform PCA on a numeric data matrix to reduce dimensionality, visualize sample structure, and identify top contributing features.
stat-pairwise-correlation
Compute pairwise correlations and significance tests across all numeric variables, and produce a correlation heatmap.
stat-nonlinear-embedding
Embed high-dimensional data into 2D using t-SNE or UMAP for exploratory visualization of sample or cell relationships.
stat-logistic-regression
Fit a logistic regression model for binary outcomes, report odds ratios and model performance (AUC-ROC, confusion matrix).