Learn R Programming

mixAK (version 2.2)

summaryDiff: Posterior summary statistics for a difference of two quantities

Description

It calculates (posterior) summary statistics for a difference of two quantities supplied as (MCMC) samples Within mixAK package it is primarily used to calculate posterior summary for the difference of the deviances of two competing models.

Usage

summaryDiff(x, y, prob=c(0.025, 0.5, 0.975), cut=c(-2*log(9), 0), na.rm=TRUE)

Arguments

x
a numeric vector with the sample of the first quantity.
y
a numeric vector with the sample of the second quantity to be subtracted from x.
prob
a numeric vector of probabilities for quantiles to be calculated from the sample of differences.
cut
numeric value(s) which specify the cutoff(s) we are interested in estimating $\mbox{P}(x - y < \mbox{cut})$ from the sample. The default values are motivated by the arguments given in Section 4 of Aitkin, Liu and Chadwick (2009) and in Section
na.rm
logical indicating on how to handle NA's.

Value

  • A list with the components
  • summarya named vector with the (posterior) summary statistics based on the differences.
  • Pcutestimated (posterior) probabilities that the difference lies below the cut values.

References

Aitkin, M. (2010). Statistical Inference: An Integrated Bayesian/Likelihood Approach. Boca Raton: CRC Press. Aitkin, M., Liu, C. C., and Chadwick, T. (2009). Bayesian model comparison and model averaging for small-area estimation. Annals of Applied Statistics, 3, 199-221.

Examples

Run this code
set.seed(16336886)
x <- runif(100, 0, 100)
y <- runif(100, 0, 100)
sdiff <- summaryDiff(x, y)

Run the code above in your browser using DataLab