Another knitr case study

This time one on weakly informative priors, https://github.com/betanalpha/knitr_case_studies/tree/master/weakly_informative_shapes. Again any comments on the use of RStan, or the content itself, are welcome.

One particular problem I just realized is that when simulating data I need to set the R seed to ensure replicability. What’s the best way for doing that?

1 Like

So cool. Right now I am deep in trying to finish Regression and Other Stories but I hope to be able to look at this soon.
A

This looks great. I can’t help with the R. I think set.seed(N) is
all you need for the R seeds, but there may be a better way to do it.

  • Bob

set.seed(12345)

Nice set of case studies Michael,

I would definitely add a chunk

devtools::session_info()

at the bottom of each Rmd so you can provide your overall environment/package versions for future reproducibility.

Also, given this seems to be a series of case studies, you might want to consider https://bookdown.org/yihui/bookdown/

It will give you an easier structure to publish, as well as some handy things like pre-render hooks (where, for example, you can set the seed if you want a consistent global seed)

It can give you a nicer mechanism for generating github pages docs to host as well. For example, https://github.com/dpastoor/bayesiantutorial/blob/master/lab-notebook/_bookdown.yml I define the output directory as the docs/ folder, which you can then set on the github settings for the repo to serve, so you end up automatically getting an indexed, searchable, chapterized webpage.

If you have any bookdown specific questions feel free to ask away.

dpastoor
January 30
Nice set of case studies Michael,

I would definitely add a chunk

devtools::session_info()
at the bottom of each Rmd so you can provide your overall environment/package versions for future reproducibility.

Thanks. That’s a great idea and we should definitely do that.
In fact, I appended that to the bottom of our instructions.

Also, given this seems to be a series of case studies, you might want to consider bookdown: Authoring Books and Technical Documents with R Markdown

We’re using something like that for the books we’re writing for CRC.
Hadley Wickham has examples with his books. He managed to produce
passable LaTeX and HTML output, which is more than I can say for
base knitr (the built-in styles are a disaster).

It will give you an easier structure to publish, as well as some handy things like pre-render hooks (where, for example, you can set the seed if you want a consistent global seed)

It can give you a nicer mechanism for generating github pages docs to host as well. For example, https://github.com/dpastoor/bayesiantutorial/blob/master/lab-notebook/_bookdown.yml I define the output directory as the docs/ folder, which you can then set on the github settings for the repo to serve, so you end up automatically getting an indexed, searchable, chapterized webpage.

If you have any bookdown specific questions feel free to ask away.

Thanks. We may take you upon this because none of us are experts
(at least as far as I know).

  • Bob