Another knitr case study


#1

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?


#2

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


#3

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

#4

set.seed(12345)


#5

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.


#6

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 https://bookdown.org/yihui/bookdown/

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