plot.evpost {revdbayes} | R Documentation |
Plot diagnostics for an evpost object
Description
plot
method for class "evpost". For d = 1
a histogram of the
simulated values is plotted with a the density function superimposed.
The density is normalized crudely using the trapezium rule. For
d = 2
a scatter plot of the simulated values is produced with
density contours superimposed. For d > 2
pairwise plots of the
simulated values are produced.
An interface is also provided to the functions in the bayesplot
package that produce plots of Markov chain Monte Carlo (MCMC)
simulations. See MCMC-overview for details of these
functions.
Usage
## S3 method for class 'evpost'
plot(
x,
y,
...,
n = ifelse(x$d == 1, 1001, 101),
prob = c(0.5, 0.1, 0.25, 0.75, 0.95, 0.99),
ru_scale = FALSE,
rows = NULL,
xlabs = NULL,
ylabs = NULL,
points_par = list(col = 8),
pu_only = FALSE,
add_pu = FALSE,
use_bayesplot = FALSE,
fun_name = c("areas", "intervals", "dens", "hist", "scatter")
)
Arguments
x |
An object of class "evpost", a result of a call to
|
y |
Not used. |
... |
Additional arguments passed on to |
n |
A numeric scalar. Only relevant if
|
prob |
Numeric vector. Only relevant for d = 2. The contour lines are drawn such that the respective probabilities that the variable lies within the contour are approximately prob. |
ru_scale |
A logical scalar. Should we plot data and density on the scale used in the ratio-of-uniforms algorithm (TRUE) or on the original scale (FALSE)? |
rows |
A numeric scalar. When |
xlabs , ylabs |
Numeric vectors. When |
points_par |
A list of arguments to pass to
|
pu_only |
Only produce a plot relating to the posterior distribution
for the threshold exceedance probability |
add_pu |
Before producing the plots add the threshold exceedance
probability |
use_bayesplot |
A logical scalar. If |
fun_name |
A character scalar. The name of the bayesplot function,
with the initial |
Details
For details of the bayesplot functions available when
use_bayesplot = TRUE
see MCMC-overview and
the bayesplot vignette
Plotting MCMC draws.
Value
Nothing is returned unless use_bayesplot = TRUE
when a
ggplot object, which can be further customized using the
ggplot2 package, is returned.
References
Jonah Gabry (2016). bayesplot: Plotting for Bayesian Models. R package version 1.1.0. https://CRAN.R-project.org/package=bayesplot
See Also
summary.evpost
for summaries of the simulated values
and properties of the ratio-of-uniforms algorithm.
MCMC-overview
,
MCMC-intervals
,
MCMC-distributions
.
Examples
## GP posterior
u <- stats::quantile(gom, probs = 0.65)
fp <- set_prior(prior = "flat", model = "gp", min_xi = -1)
gpg <- rpost(n = 1000, model = "gp", prior = fp, thresh = u, data = gom)
plot(gpg)
# Using the bayesplot package
plot(gpg, use_bayesplot = TRUE)
plot(gpg, use_bayesplot = TRUE, pars = "xi", prob = 0.95)
plot(gpg, use_bayesplot = TRUE, fun_name = "intervals", pars = "xi")
plot(gpg, use_bayesplot = TRUE, fun_name = "hist")
plot(gpg, use_bayesplot = TRUE, fun_name = "dens")
plot(gpg, use_bayesplot = TRUE, fun_name = "scatter")
## bin-GP posterior
u <- quantile(gom, probs = 0.65)
fp <- set_prior(prior = "flat", model = "gp", min_xi = -1)
bp <- set_bin_prior(prior = "jeffreys")
npy_gom <- length(gom)/105
bgpg <- rpost(n = 1000, model = "bingp", prior = fp, thresh = u,
data = gom, bin_prior = bp, npy = npy_gom)
plot(bgpg)
plot(bgpg, pu_only = TRUE)
plot(bgpg, add_pu = TRUE)
# Using the bayesplot package
dimnames(bgpg$bin_sim_vals)
plot(bgpg, use_bayesplot = TRUE)
plot(bgpg, use_bayesplot = TRUE, fun_name = "hist")
plot(bgpg, use_bayesplot = TRUE, pars = "p[u]")