An R package containing helper functions for Stan.
This package contains code I develop through my teaching and personal use of Stan/RStan to make some common tasks easier. It's very much a work in progress and probably won't ever be on CRAN.
devtools::install_github('mike-lawrence/ezStan') #requires devtools to be installed, which is achieved via install.packages("devtools")
Optionally, for better warning & error message handling, install loggr:
devtools::install_github('mike-lawrence/loggr') #temporarily necessary until smbache/loggr is updated and uploaded to CRAN
#compile a model; shouldn't block the RStudio UI like rstan::stan_model() my_mod = build_stan(my_stan_file) #start the model sampling start_stan( data = my_data_for_stan , mod = my_mod # can add other arguments to rstan::sampling() here if nessary, for example: , iter = 4e3 ) #now watch the sampling (see ?watch_stan for options, like killing when post-warmup divergences are encountered) watch_stan() #it's ok to stop the watcher; you can resume watching by simply running watch_stan() again #if anything goes awry with the sampling, you can call kill_stan() to stop all chains #when the sampling is done, collect results my_post = collect_stan() #once collected, you can recover some disk space by running: clean_stan() #slightly cleaner looking summary table: stan_summary( post = my_post , par = 'some_parameter' )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.