Hello Discourses,
I wanted to overlay the priors of my custom model onto the posterior distributions after running the rstan
function. However, I have not found a way to plot the priors of a Stan model (class object stanfit). There are functions for S3 objects generated using rstanarm
but I could not apply them to a stanfit object (e.g., posterior_vs_prior()
). I have also tried to access prior information in the same manner as for the extraction of the posterior draws (e.g., extract()
) but I have not been successful.
Questions:
-
Is there a R function that can be used to extract prior distributions and/or plot prior distributions on top of the posteriors of a stanfit object?
-
If there is not such a function, can I just use the following R code to recreate the beta distribution that I have defined in Stan?
grid = seq(0, 1, .01)
plot(grid,dbeta(grid, shape1 = 6, shape2 = 10), type="l", xlab="x", ylab="f(x)")
Cheers,
Sam