postPriorOverlap: Overlap between posterior and prior probability...

Description Usage Arguments Value Author(s) References Examples

View source: R/postPriorOverlap.R

Description

Calculates and displays the overlap between a posterior distribution (as a vector of samples, typically from an MCMC process) and a prior distribution (as a vector of samples or as a function). Unidentifiable parameters will have high overlap: Gimenez et al (2009) suggest that overlap greater than 35% indicates weak identifiability.

Usage

1
2
3
4
postPriorOverlap(paramSampleVec, prior, ..., yaxt="n", ylab="",
           xlab="Parameter", main="", cex.lab=1.5, cex=1.4,
           xlim=range(paramSampleVec), breaks=NULL,
           mainColor="skyblue", priorColor="yellow", overlapColor="green")

Arguments

paramSampleVec

a vector of samples drawn from the target distribution.

prior

either a vector of samples drawn from the prior distribution or the name for the density function of the distribution; standard R functions for this have a d- prefix, eg. dbeta. Arguments required by the function must be specified by their (abbreviated) names in the ... argument; see the examples.

...

named parameters to be passed to prior when it is a function.

yaxt

a character which specifies the y axis type; the default, "n", suppresses plotting.

ylab

text to use as the label of the y axis.

xlab

text to use as the label of the x axis.

cex.lab

the magnification to be used for x and y labels relative to the current setting of cex

cex

a numerical value giving the amount by which plotting text and symbols should be magnified relative to the default

xlim

a vector of length 2 giving the limits for the x axis.

main

text to use as the main title of the plot

breaks

controls the histogram break points or the number of bars; see hist.

mainColor

an optional color name such as "skyblue" or a RGB specification such as "#87CEEB" that controls the color of the histogram representing the posterior.

priorColor

an optional color name such as "yellow" or a RGB specification such as "#FFFF00" that controls the color of prior, both if it is data and when it is a function.

overlapColor

an optional color name such as "green" or a RGB specification such as "#00FF00" that controls the color of the overlap area.

Value

Returns the overlap, the area lying under the lower of the two density curves.

Author(s)

Mike Meredith

References

Gimenez, Morgan and Brooks (2009) Weak identifiability in models for mark-recapture-recovery data. pp.1055-1068 in Thomson, Cooch and Conroy (eds) Modeling demographic processes in marked populations Springer

Examples

1
2
3
4
5
6
7
8
# Generate some data
tst <- rbeta(1e6, 5, 7)

# check overlap with a Beta(0.2, 0.2) prior:
postPriorOverlap(tst, dbeta, shape1=0.2, shape2=0.2)

# check overlap with a Uniform(0, 1) prior:
postPriorOverlap(tst, runif(1e6))

mikemeredith/BEST documentation built on Oct. 15, 2021, 1:19 p.m.