View source: R/summarizePosterior.R
summarizePosterior | R Documentation |
This function summarizes the distribution of parameter
estimates from the posterior of an ABC analysis using the
doRun
functions in TreEvo
, for all
freely varying parameters. Only the final
generation is considered. This summary includes
the mean, standard deviation and Highest Posterior
Density (at a 0.8 alpha) for each parameter.
summarizePosterior(
particleDataFrame,
alpha = 0.8,
coda = FALSE,
verboseMultimodal = TRUE,
stopIfFlat = TRUE,
...
)
particleDataFrame |
A |
alpha |
The threshold used for defining the highest density frequency cut-off. If the highest density interval is applied to a Bayesian MCMC posterior sample, then the interval is effectively calculated for this value as a posterior probability density. |
coda |
Default is |
verboseMultimodal |
If |
stopIfFlat |
If |
... |
Additional arguments passed to |
Returns a list, wherein each element of the list is secondary list containing
the weighted mean, standard deviation, and a matrix giving the highest density
intervals (e.g. the highest posterior density intervals). Because posterior
estimates of parameter values may be multimodal, multiple sets of bounds
may be reported for complex posterior distributions, which each constitute one
row of the output matrix. See highestDensityInterval
for details.
David W Bapst
This function is essentially a wrapper for independently applying
a few summary statistics and applying
highestDensityInterval
to multiple parameter estimates, taken from
the last generation of an ABC analysis in TreEvo
. As each parameter
is handled independently, the returned HPD intervals may not properly account
for covariation among parameter estimates from the posterior. If testing
whether a given observation is within a given density of the posterior or
not, please look at function testMultivarOutlierHDR
.
# example with output from doRun_prc
data(simRunExample)
# alpha = 0.95
summarizePosterior(
resultsBMExample[[1]]$particleDataFrame,
alpha = 0.95)
# you might be tempted to use alphas like 95%,
# but with bayesian statistics
# we often don't sample the distribution well enough to know
# its shape to exceeding detail.
# alpha = 0.8 may be more reasonable.
summarizePosterior(
resultsBMExample[[1]]$particleDataFrame,
alpha = 0.8)
# or even better, for coverage purposes, maybe 0.5
summarizePosterior(
resultsBMExample[[1]]$particleDataFrame,
alpha = 0.5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.