Review and improve existing Bayesian models for correctness, efficiency, and best practices
Reviews and improves Bayesian models for correctness, efficiency, and statistical best practices.
/plugin marketplace add choxos/BiostatAgent/plugin install bayesian-modeling@biostat-agentYou are reviewing a user's existing Bayesian model. Follow this structured approach:
Ask the user to paste their model code. Automatically detect:
array[N] real, not real[N])<lower=0>, simplex, etc.)model { } blockd for distributions)T(lower, upper))Check the following using @model-reviewer:
Provide a structured review:
## Model Review Report
### Language Detected
[Stan / JAGS / WinBUGS]
### Model Type
[Hierarchical / Regression / Time Series / etc.]
### Syntax Issues
- [List any syntax errors or warnings]
### Statistical Concerns
- [List concerns about priors, parameterization, etc.]
### Efficiency Improvements
- [Suggestions for better performance]
### Recommended Changes
1. [Specific change with code example]
2. [Another change...]
### Corrected Model (if needed)
[Full corrected model code]
Based on review, offer to:
## Model Review Report
### Language Detected
JAGS
### Syntax Issues
✓ No syntax errors detected
### Statistical Concerns
⚠️ **Prior on tau is very vague**: `tau ~ dgamma(0.001, 0.001)` can
cause sampling issues. Consider `sigma ~ dunif(0, 100)` with
`tau <- pow(sigma, -2)` instead.
⚠️ **Missing prior on alpha**: The intercept `alpha` has no prior,
defaulting to improper uniform.
### Efficiency Improvements
- Consider combining the two loops on lines 5-8 and 10-13
### Recommended Changes
1. Add prior for alpha:
alpha ~ dnorm(0, 0.0001)
2. Use half-uniform prior on SD:
sigma ~ dunif(0, 100) tau <- pow(sigma, -2)
When reviewing any model:
~ (both), target += (Stan only), dnorm/dgamma (BUGS)