(This article was originally published at Doing Bayesian Data Analysis, and syndicated at StatsBlogs.)
The book's prior on ν, there called tdf, is
tdf <- 1 - tdfGain*log(1-udf)
udf ~ dunif(0,1)
where tdfGain is a constant. In other words, tdf is a strange logarithmic transformation of udf, and udf has a uniform prior. Well, that's the same thing as a shifted exponential on tdf, with tdfGain being its mean.
To prove that claim, we could do some math, as suggested by the method in Section 23.4 (p. 630) regarding reparameterization. But instead I'll show a large Monte Carlo sample of tdf from the book, and superimpose a shifted exponential density, and you can see that they are identical:
In each of the above graphs, the title indicates the value of tdfGain, labelled as nuGain. A large number of values, udf, were randomly generated from a uniform distribution, and then those values were transformed to tdf (=ν) values using the formula tdf <- 1 - tdfGain*log(1-udf). The histogram plots the resulting tdf (=ν) values. The title of each graph also indicates the mean of Monte Carlo sample, which should be nuGain+1 except for randomly sampling noise. Superimposed on the histogram is a exponential density with mean set to nuGain, and shifted 1 unit to the right (because ν must be > 1). Thus, you can see that the book's prior for tdf really is a shifted exponential, as used in the BEST article.
Appendix: Here is the code for generating the graphs.
graphics.off()
source("openGraphSaveGraph.R")
for ( nuGain in c(3,30,100) ) {
# Random sample of nu from book prior:
nu = 1 - nuGain*log( 1 - runif(50000) )
# Plot histogram:
openGraph(width=7,height=5)
xMax = 5*nuGain
histInfo = hist( nu , probability=TRUE ,
col="skyblue" , border="white" ,
xlab=bquote(nu) , xlim=c(0,xMax) ,
cex.lab=1.5 , cex.main = 1.5 ,
breaks=c(0,seq(1,xMax,length=30),1E10) ,
main=bquote( list( nuGain==.(nuGain) ,
mean(nu)==.(round(mean(nu),2)) ) ) )
abline(v=1,lty="dotted")
# Superimpose shifted exponential curve with same mean-1:
x = seq( 1 , xMax , length=201 ) # Make x-axis comb.
lines( x , dexp( x-1 , 1/(nuGain) ) , lwd=2 )
text( mean(nu) , dexp( mean(nu)-1 , 1/(nuGain ) ) ,
bquote("curve: dexp( "*nu*"-1 , mean="*.(nuGain)*" )") ,
adj=c(-0.1,-0.1) , cex=1.5 )
saveGraph(file=paste0("DBDA1E_nuPrior",nuGain),type="png")
}
Please comment on the article here: Doing Bayesian Data Analysis



