-
Notifications
You must be signed in to change notification settings - Fork 0
Add Stan support as alternative Bayesian modeling backend #175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: d-morrison <2474437+d-morrison@users.noreply.github.com>
Co-authored-by: d-morrison <2474437+d-morrison@users.noreply.github.com>
Co-authored-by: d-morrison <2474437+d-morrison@users.noreply.github.com>
d-morrison
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix failing workflow checks
d-morrison
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
address workflow check failures
…s.yml Co-authored-by: d-morrison <2474437+d-morrison@users.noreply.github.com>
d-morrison
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix failing workflows
Co-authored-by: d-morrison <2474437+d-morrison@users.noreply.github.com>
Fixed in d5ad3ce. The R-CMD-check workflow was failing because the |
Convert JAGS Model to Stan ✅
This task successfully adds Stan support to the serodynamics package as an alternative to JAGS for Bayesian MCMC modeling. Both modeling backends can coexist, allowing users to choose their preferred framework.
Completed Work
Research Stan ecosystem and best practices
Create Stan model files
model.jagstoinst/extdata/model.stan(117 lines)model.dobson.jagstoinst/extdata/model.dobson.stan(19 lines)Create R infrastructure for Stan
prep_data_stan()function (75 lines) - converts data to Stan format with proper paddingprep_priors_stan()function (78 lines) - prepares Stan-compatible prior specificationsrun_mod_stan()function (197 lines) - complete Stan equivalent ofrun_mod()Update dependencies and documentation
Update README and documentation
Package validation
CI/Build improvements
*.knit.*pattern to.gitignoreto exclude intermediate knit filesREADME.knit.mdfrom git trackingcopilot-setup-steps.ymlworkflow\dontrun{}Implementation Details
Stan Model Conversion:
dnorm(mu, tau)tonormal(mu, sigma)wheresigma = 1/sqrt(tau)dwish(omega, df)toinv_wishart(df, omega_inv)whereomega_inv = inverse(omega)dgamma(a, b)parameters (same in both)Data Preparation:
prep_data_stan()handles thisnsmpl[subj]to ignore paddingIntegration:
sr_modelclass)CI Environment:
Example Code Fix:
run_mod_stan()examples in\dontrun{}to prevent execution during R CMD checkWhat Users Can Do Now
Use JAGS (existing functionality):
Use Stan (new functionality):
Both produce compatible outputs that work with the same analysis and visualization functions.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.