RStan/knitr Best Practices


#1

I put together my first RStan/knitr case study: https://github.com/betanalpha/knitr_case_studies/tree/master/divergences_and_bias. Comments on the case study itself are welcome, but I mostly wanted to solicit comments about the RStan and knitr coding. Except for the graphics – I’m not touching ggplot, so base graphics it will be.

Thanks.


#2

I can definitely take a look at the RStan and knitr coding. Probably not until after the conference though.


#3

I’m new to knitr, so I just comment the case study itself as it is excellent!

Aki


#4

betanalpha Developer
January 19
I put together my first RStan/knitr case study: https://github.com/betanalpha/knitr_case_studies/tree/master/divergences_and_bias. Comments on the case study itself are welcome, but I mostly wanted to solicit comments about the RStan and knitr coding. Except for the graphics – I’m not touching ggplot, so base graphics it will be.

I can help with ggplot. The doc’s terrible, but the
package is awesome, especially if you need to facet.
And it solves those problems you were having in your class
with bad scaling—ggplot is way better than base graphics
at this.

  • Bob

#5

xlabs have “Adept delta” instead of “Adapt delta”

Aki


#6

I’d be happy to help out with ggplot2 as well.


#7

Jonah fixed a bunch of my non-idiomatic R, so maybe
if he has time you can get him to look at yours.

But if R style’s the only issue, I’d say just put it up
now and if you get feedback on the R, you can change it.
Your call, but this is something I think a lot of people
would like to see sooner rather than later.

  • Bob

#8

I can definitely go over all of the R code as soon as I recover from the
past few days. I’m going to let most of my brain remain off today but I’ll
be back at it tomorrow.


#9

Do you display the stan in the article? If you are, I couldn’t see how you are doing it.

I put things like this into my .Rmd file

~~~~{.CPP include="lr-changepoint.stan"}
~~~~

and then use a custom pandoc filter to actually pull in the stan. Sadly I don’t get any syntax highlighting and I can’t intersperse text with the stan code. Here’s an example of what you get

If you have a better way of doing this I would be very interested.