jointMode: Approximate the maximum joint posterior density estimate

Description Usage Arguments Value Examples

Description

This function calculates the density estimate for each column of a joint posterior distribution, then takes the logarithm of the estimate densities. The log- densities are then summed to give the row-wise log-posterior probability function. The row with the highest log-posterior density is returned which corresponds to the monte carlo sample with the highest joint probability, or MAP estimate. Note, however, this is an approximation to the MAP in the sense that MAP estimation proper is done through optimization.

This function calculates the kernel density estimate for each column of a joint posterior distribution, then takes the logarithm of the estimate densities. The log- densities are then summed to give the row-wise log-posterior probability function. The row with the highest log-posterior density is returned which corresponds to the monte carlo sample with the highest joint probability, or MAP estimate. Note, however, this is an approximation to the MAP in the sense that MAP estimation proper is done through optimization.

Frankly this function is included largely for didactic purposes. MAP estimation, whether by approximating via finding the MCMC iteration with the highest joint log-probability or directly optimizing an objective function, will be often poor with higher dimensional problems. This is due to the fact that the mode of a multidimensional function may be no where near the expected values of the marginal distributions. This stems from the curse of dimensionality.

Usage

1
2
3
4
5
jointMode(x, keeppars = NULL, droppars = c("ySim", "log_lik",
  "Deviance", "delta", "BIC"))

jointMode(x, keeppars = NULL, droppars = c("ySim", "log_lik",
  "Deviance", "delta", "BIC"))

Arguments

x

the set of posterior samples to be summarized in an runjags or stanfit object.

keeppars

the list of specific variables to keep. Defaults to NULL.

droppars

list of parameters to exclude from the calculation of the density. The default is c("ySim", "log_lik", "lp__", "Deviance", "BIC", "delta"), but this should be adjusted to make sure that derived and generated quantities such as predictions, deviance, indicator variables, and so forth – anything not directly part of the posterior distribution of the model parameters – are removed. Note, however, that the function will still return all quantities in the model. The droppars argument only applies to the density estimation itself.

x

the set of posterior samples to be summarized in an runjags or stanfit object.

keeppars

the list of specific variables to keep. Defaults to NULL.

droppars

list of parameters to exclude from the calculation of the density. The default is c("ySim", "log_lik", "Deviance", "BIC", "delta"), but this should be adjusted to make sure that derived and generated quantities such as predictions, deviance, indicator variables, and so forth – anything not directly part of the posterior distribution of the model parameters – are removed. Note, however, that the function will still return all quantities in the model. The droppars argument only applies to the density estimation itself.

Value

a vector of modes

a vector of modes

Examples

1
2
jointMode(fit)
jointMode(fit)

abnormally-distributed/Bayezilla documentation built on Oct. 31, 2019, 1:57 a.m.