@@ -23,7 +23,31 @@ pdfplots <- FALSE # default: FALSE; set this to TRUE only if you like pdf figure
2323``` {r, include = FALSE}
2424par(mgp = c(1.6, .6, 0), mar = c(2.6, 2.6, 2.6, .4), lwd = 1)
2525```
26+
2627# Section 6.4
28+ ## Figure 6.1
29+ We start with a visualization of the normal and the horseshoe prior.
30+
31+ ``` {r, echo = -(1:2)}
32+ if (pdfplots) {
33+ pdf("6-4_1.pdf", width = 8, height = 5)
34+ par(mar = c(2.5, 1.5, .1, .1), mgp = c(1.6, .6, 0))
35+ }
36+ beta <- seq(from=-4, to=4, by=0.01)
37+
38+ # Horseshoe prior
39+ # approximated by the result of Theorem 1 in Carvalho/Polson (2010)
40+ c <- 1/sqrt(2*pi^3)
41+ l <- c/2*log(1+4/beta^2)
42+ u <- c*log(1+2/beta^2)
43+
44+ plot(beta,(u+l)/2, type="l",ylim=c(0,0.55), xlab=expression(beta),
45+ ylab="",lty=1, col="blue")
46+ lines(beta,dnorm(beta),lty=2) # Standard Normal Prior
47+ legend('topright', legend=c("Horseshoe", "Standard Normal"),
48+ bty="n",lty=1:2, col=c("blue", "black"))
49+ ```
50+
2751## Example 6.1/6.2: Movie data
2852
2953We use movie data provided within the package to illustrate Bayesian analysis
0 commit comments