View source: R/compute_posterior_intervals.R
compute_posterior_intervals | R Documentation |
Compute posterior intervals of parameters of interest.
compute_posterior_intervals(model_fit, ...)
## S3 method for class 'BayesMallows'
compute_posterior_intervals(
model_fit,
parameter = c("alpha", "rho", "cluster_probs"),
level = 0.95,
decimals = 3L,
...
)
## S3 method for class 'SMCMallows'
compute_posterior_intervals(
model_fit,
parameter = c("alpha", "rho"),
level = 0.95,
decimals = 3L,
...
)
model_fit |
A model object. |
... |
Other arguments. Currently not used. |
parameter |
Character string defining which parameter to compute
posterior intervals for. One of |
level |
Decimal number in |
decimals |
Integer specifying the number of decimals to include in
posterior intervals and the mean and median. Defaults to |
This function computes both the Highest Posterior Density Interval (HPDI), which may be discontinuous for bimodal distributions, and the central posterior interval, which is simply defined by the quantiles of the posterior distribution.
Other posterior quantities:
assign_cluster()
,
compute_consensus()
,
get_acceptance_ratios()
,
heat_plot()
,
plot.BayesMallows()
,
plot.SMCMallows()
,
plot_elbow()
,
plot_top_k()
,
predict_top_k()
,
print.BayesMallows()
set.seed(1)
model_fit <- compute_mallows(
setup_rank_data(potato_visual),
compute_options = set_compute_options(nmc = 3000, burnin = 1000))
# First we compute the interval for alpha
compute_posterior_intervals(model_fit, parameter = "alpha")
# We can reduce the number decimals
compute_posterior_intervals(model_fit, parameter = "alpha", decimals = 2)
# By default, we get a 95 % interval. We can change that to 99 %.
compute_posterior_intervals(model_fit, parameter = "alpha", level = 0.99)
# We can also compute the posterior interval for the latent ranks rho
compute_posterior_intervals(model_fit, parameter = "rho")
## Not run:
# Posterior intervals of cluster probabilities
model_fit <- compute_mallows(
setup_rank_data(sushi_rankings),
model_options = set_model_options(n_clusters = 5))
burnin(model_fit) <- 1000
compute_posterior_intervals(model_fit, parameter = "alpha")
compute_posterior_intervals(model_fit, parameter = "cluster_probs")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.