Corrections to BCWR, 2nd edition February 10, 2016 1. Page 3, lines 10-11. According to the instructions in the second paragraph, the R output should be > t = table(Drink) > barplot(t, xlab="Drink",ylab="Count") 2. Page 27. In the two curve functions, there should be a xlab="p" in the arguments of both functions to obtain Figures 2.5 and 2.6. Also, the vertical scale on Figure 2.6 does not correspond to the scale one obtains by using the command curve(histprior(x,midpt,prior) * dbeta(x,s+1,f+1), from=0, to=1, ylab="Posterior density") 3. Page 42, line 9 from bottom. p(y) should be f(y). 4. Page 66, line 15-16. Should be "independently distributed" 5. Page 67, line 4 from bottom. Should be ... "proportions favoring candidates in the ith state, (theta_Oi, theta_Mi, 1 - theta_Oi - theta_Mi), have a Dirichlet distribution with parameters [Replace subscript j with i]" 6 Page 68, line 6. It should read > attach(election.2008) 7. Page 72, R code at the bottom. It should read > prior=rbind(c(-0.7, 4.68, 1.12), + c(0.6, 2.84, 2.10)) > data.new=rbind(data, prior) Also on page 73, the mycontour function at the top should have coordinates c(-2, 3, -1, 11) Since data.new was defined incorrectly, the output on pages 73-75 will be incorrect. 8. Page 84. Exercise 7. In the displayed equation, f(y_i | alpha, beta) should be replaced by f(y_i | alpha, lambda). 9. Page 94, line 18. The expression for the prior predictive density should have |-h'(theta hat)|^(-1/2). The power should be -1/2, not 1/2. 10. Page 101. In the displayed equation, the vertical line (|) between f(y|theta) and dtheta should be deleted. 11. Page 113. Exercise 5. It should be (a), (b), and (c) instead of the bulleted marks. In part (a), should read "Write an R function to compute the logarithm of the posterior density of the transformed parameter theta = log lambda." 12. Page 115. There is a small error in the coding of the function log.post.var.comp (error in computing the Jacobian). The line return(loglike+theta[2]+theta[3]) should be replaced by return(loglike+2*theta[2]+2*theta[3]) 13. Page 149. Exercise 6, part (b). rwmetrop should be indepmetrop. 14. Page 176. Exercise 1. The gamma density should be written as lambda^(alpha - 1) beta ^ alpha exp(-beta * lambda) / Gamma(alpha) 15. Page 196, line 12. "under the dependence model" should be replace by "under the independence model". 16. Page 214. The two covariate vectors should be cov2 = c(1,4,0,1) cov3 = c(1,4,1,0) 17. Page 230. In Exercise 1, part ©, it should be blinregexpected. 18. Page 229. The model in exercise 1 should be BIRTHWEIGHT_i = beta_0 + beta_1 AGE_i + beta_2 GENDER_i + epsilon_i 19. Page 247. Second paragraph in the middle of the page. ... we wish to compare the "Age, Gender" model with the "Only Gender" model In Table 10.1, the "Only Age" and "Only Gender" labels should be interchanged for both the rows and the columns. Last line in the paragraph should read ... "From the table, it is clear that Age is a more important variable than Gender in explaining the variation in the Survival variable." --------------------------------------------------------