Description Usage Arguments Value Examples
Plots histograms of the posterior estimates. Optionally, displays the 'actual' values given a simulated dataset.
1 2 3 4 5 6 7 8 9 |
object |
an object of class |
burnin |
optional numeric parameter for the number of initial MCMC samples to omit from the summary |
plotfun |
integer 1 or 2 indicating which plots to display. 1 shows trace plots. 2 shows a histogram |
comparison.theta |
optional numeric vector of parameter values to compare to the Bayesian estimates |
cols |
optional integer index indicating which parameters to display |
... |
currently unused |
Returns a customized ggplot
object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # Linear regression example
set.seed(522)
X <- cbind(1, matrix(rnorm(300), ncol=3))
betavals <- c(0.5, -1, 2, -3)
y <- X%*%betavals + rnorm(100, sd=.2)
f <- hmc(N = 1000,
theta.init = c(rep(0, 4), 1),
epsilon = 0.01,
L = 10,
logPOSTERIOR = linear_posterior,
glogPOSTERIOR = g_linear_posterior,
varnames = c(paste0("beta", 0:3), "log_sigma_sq"),
param=list(y=y, X=X), parallel=FALSE, chains=1)
diagplots(f, burnin=300, comparison.theta=c(betavals, 2*log(.2)))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.