path <- commandArgs()[6] ############################## f.mnorm <- function(x) { 0.5 * exp(-(x-0)^2/2)/sqrt(2 * pi) + 0.5 * exp(-(x-8)^2/2)/sqrt(2 * pi) } postscript( file=paste(path, "grp2.3-1.eps", sep=""), width = 16, height = 6, pointsize = 24, horizontal = FALSE, onefile = FALSE, paper = "special", family="Palatino" ) par(mar=c(0, 0, 2, 0)) par(mfrow=c(1, 2)) ############################## curve( f.mnorm, -4, 12, n = 1001, lty = 1, col = "#E64B6B", lwd = 3, axes = FALSE, main = "central posterior interval" ) xvals <- seq(-1.645, 9.645, length=100) dvals <- f.mnorm(xvals) polygon(c(xvals,rev(xvals)), c(rep(0,100),rev(dvals)), col="#E64B6B", border = NA) text(-3.8, 0.02, expression(alpha/2), pos = 4, offset = 0) text(11.8, 0.02, expression(alpha/2), pos = 2, offset = 0) ############################## curve( f.mnorm, -4, 12, n = 1001, lty = 1, col = "#E64B6B", lwd = 3, axes = FALSE, main = "highest posterior density region" ) xvals <- seq(-1.96, 1.96, length=50) dvals <- f.mnorm(xvals) polygon(c(xvals,rev(xvals)), c(rep(0,50),rev(dvals)), col="#E64B6B", border = NA) xvals <- seq(8-1.96, 8+1.96, length=50) dvals <- f.mnorm(xvals) polygon(c(xvals,rev(xvals)), c(rep(0,50),rev(dvals)), col="#E64B6B", border = NA) lines(c(-4, 12), rep(f.mnorm(1.96), 2), lty = 1) arrows(seq(-3, 11), f.mnorm(1.96)+0.01, seq(-3, 11), f.mnorm(1.96), length=0.1) text(4, 0.15, expression(paste("100(1-", alpha, ")%")), pos = 1, offset = 0) dev.off()