plot_several_posterior_stan {makemyprior}R Documentation

Plotting several posterior distributions

Description

Function for plotting the posterior distributions of the random effect variances on the scale of the tree parameterization.

Usage

plot_several_posterior_stan(
  objs,
  param = c("prior", "variance", "stdev", "precision", "logvariance")
)

Arguments

objs

A names list with objects of class mmp_stan from inference_stan, can be any length (but typically length two for one prior (use_likelihood = FALSE) and posterior, or two posteriors).

param

A string indicating parameterization of plot. "prior" for scale of parameters, "variance", "stdev", "precision" and "logvariance" are also possible.

Details

We cannot sample from a Jeffreys' prior since it is improper. If Jeffreys' prior is used for the total variance, the prior will be changed to a Gaussian(0,1) prior on the log total variance. This means that it does not make sense to look at the variances/standard deviations/precisions, but the variance proportions will be correct. See also makemyprior_plotting.

Value

A ggplot with the posterior distributions.

Examples


if (interactive() && requireNamespace("rstan")){
  ex_prior1 <- makemyprior_example_model(seed = 1)
  ex_prior2 <- makemyprior_example_model(seed = 2)
  # Note: For reliable results, increase the number of iterations (e.g., 'iter = 2000')
  res_stan1 <- inference_stan(ex_prior1, iter = 100)
  res_stan2 <- inference_stan(ex_prior2, iter = 100)
  plot_several_posterior_stan(list(One = res_stan1, Two = res_stan2))
}


[Package makemyprior version 1.2.1 Index]