path <- commandArgs()[6] ############################## y <- NULL; m <- 1000; d <- c(-2.5, -1, 0, 1.5, 2.5) u <- seq(0, 1, 1/m) for (i in u) { y <- append(y, prod(dcauchy(d, i, 1))) } postscript( file=paste(path, "Ex11-1.eps", sep=""), width = 9, height = 9, pointsize = 24, horizontal = FALSE, onefile = FALSE, paper = "special", family="Palatino" ) par(mar=c(3.2, 3.2, 1.5, 0.5), mgp=c(2.0, 0.7, 0)) par(bty="l") plot( u, (m+1)*y/sum(y), type = "l", col = "#E64B6B", ylim = c(0, 1.2), xlab = expression(theta), lwd = 6, ylab = expression(paste(p, "(", theta, " | ", y, ")")), main = "normalized posterior density" ) dev.off() ############################## y <- NULL; m <- 1000; d <- c(-2.5, -1, 0, 1.5, 2.5) u <- seq(0, 1, 1/m) for (i in u) { y <- append(y, prod(dcauchy(d, i, 1))) } set.seed(11451355); z <- sample(u, m, replace = TRUE, prob = y/sum(y)) postscript( file=paste(path, "Ex11-2.eps", sep=""), width = 9, height = 9, pointsize = 24, horizontal = FALSE, onefile = FALSE, paper = "special", family="Palatino" ) par(mar=c(3.2, 0.5, 1.5, 0.5), mgp=c(2.0, 0.7, 0)) par(bty="l") hist( z, col = "#E64B6B", border = "white", yaxt = "n", ylab = NA, main = "posterior simulations", xlab = expression(theta) ) dev.off() ############################## y <- NULL; m <- 1000; d <- c(-2.5, -1, 0, 1.5, 2.5) u <- seq(0, 1, 1/m) for (i in u) { y <- append(y, prod(dcauchy(d, i, 1))) } set.seed(45687993); y6 <- rcauchy(m, z, 1) postscript( file=paste(path, "Ex11-3.eps", sep=""), width = 9, height = 9, pointsize = 24, horizontal = FALSE, onefile = FALSE, paper = "special", family="Palatino" ) par(mar=c(3.2, 0.5, 1.5, 0.5), mgp=c(2.0, 0.7, 0)) par(bty="l") hist( y6, breaks = 50, col = "#E64B6B", border = "white", yaxt = "n", ylab = NA, main = "posterior predictive simulations", xlab = expression(y[6]) ) dev.off()