Skip to content

wzmli/hybridx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

121 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discrete-time Stochastic Epi-model template generator

All the code in this repo are mainly for our simulation study.

Package versions

rstan 2.19.2; stan_version 2.19.1

nimble 0.9.0

R2jags 0.5.7; JAGS 4.2.0

Other uses

Treat this as a template builder to build the BUGS and STAN scripts for the models in the paper.

  • In source.R, run the fitmod function by specifying the type of model you would like to run.

    • Please see name.R to see how to correctly specify the type of model.
    • It will generate the appropriate BUGS/STAN script in the template subfolder in jags_dir, nimble_dir, stan_dir.
  • fit.R inside fitmod will try to parse through the details and run the model. Ideally, it should build its own separate script for so user know how to set up the initial parameters, data and constants parameters, but it currently doesn't do this (maybe in the future).

General pipeline workflow

Jags:

Initialize model

  • reads in BUGS script
  • constructs the model object
  • Adapt 1000 iterations

Sampling phase

  • Takes the adaptive model object and run (n.burnin + n.iterations)

  • Keeps the last n.iterations

  • Check convergence via Rhat < 1.1 (ESS > 40 optional, currently NA)

  • If covergence test fails, sample another n.iterations from the previous chains and repeat last two steps.

Nimble and Stan

Initialize model

  • reads in BUGS script
  • construct model object

Sampling phase

  • start with 2000 iterations
  • Takes the model object and run n.iterations (half burnin)
  • If convergence test fails, redo previous step with double the amount of iterations.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors