marginal_posterior {BayesTools}R Documentation

Model-average marginal posterior distributions

Description

Creates marginal model-averages posterior distributions for a given parameter based on model-averaged posterior samples and parameter name (and formula with at specification).

Usage

marginal_posterior(
  samples,
  parameter,
  formula = NULL,
  at = NULL,
  prior_samples = FALSE,
  use_formula = TRUE,
  transformation = NULL,
  transformation_arguments = NULL,
  transformation_settings = FALSE,
  n_samples = 10000,
  ...
)

Arguments

samples

model-averaged posterior samples created by mix_posteriors()

parameter

parameter of interest

formula

model formula (needs to be specified if parameter was part of a formula)

at

named list with predictor levels of the formula for which marginalization should be performed. If a predictor level is missing, 0 is used for continuous predictors, the baseline factor level is used for factors with contrast = "treatment" prior distributions, and the parameter is completely omitted for for factors with contrast = "meandif",

prior_samples

whether marginal prior distributions should be generated contrast = "orthonormal", and contrast = "independent" levels

use_formula

whether the parameter should be evaluated as a part of supplied formula

transformation

transformation to be applied to the prior distribution. Either a character specifying one of the prepared transformations:

lin

linear transformation in form of a + b*x

tanh

also known as Fisher's z transformation

exp

exponential transformation

, or a list containing the transformation function fun, inverse transformation function inv, and the Jacobian of the transformation jac. See examples for details.

transformation_arguments

a list with named arguments for the transformation

transformation_settings

boolean indicating whether the settings the x_seq or x_range was specified on the transformed support

n_samples

number of samples to be drawn for the model-averaged posterior distribution

...

additional arguments

Value

marginal_posterior returns a named list of mixed marginal posterior distributions (either a vector of matrix). #'


[Package BayesTools version 0.2.17 Index]