Description Usage Arguments Value Author(s) References Examples
View source: R/postPriorOverlap.R
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.
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")
|
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 |
... |
named parameters to be passed to |
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 |
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 |
mainColor |
an optional color name such as |
priorColor |
an optional color name such as |
overlapColor |
an optional color name such as |
Returns the overlap, the area lying under the lower of the two density curves.
Mike Meredith
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
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))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.