Description Usage Arguments Value References Examples
Calls mcmc_hist
from the bayesplot
package to display histograms of the posterior
1 2 |
x |
an object of class |
burnin |
optional numeric parameter for the number of initial MCMC samples to omit from the summary |
... |
optional additional arguments to pass to the |
Calls mcmc_hist
from the bayesplot
package, which returns a list including a ggplot2
object.
Gabry, Jonah and Mahr, Tristan (2019). bayesplot: Plotting for Bayesian Models. https://mc-stan.org/bayesplot/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # poisson regression example
set.seed(7363)
X <- cbind(1, matrix(rnorm(40), ncol=2))
betavals <- c(0.8, -0.5, 1.1)
lmu <- X %*% betavals
y <- sapply(exp(lmu), FUN = rpois, n=1)
f <- hmc(N = 1000,
theta.init = rep(0, 3),
epsilon = c(0.03, 0.02, 0.015),
L = 10,
logPOSTERIOR = poisson_posterior,
glogPOSTERIOR = g_poisson_posterior,
varnames = paste0("beta", 0:2),
param = list(y=y, X=X),
parallel=FALSE, chains=2)
plot(f, burnin=100)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.