homework4fall2010-key

homework4fall2010-key - Stat 180/C236 Homework 4...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Stat 180 / C236 Homework 4 J. Sanchez UCLA Department of Statistics Instructions (1) Homework part with R code must be typed and all homework must be answered in the order given (problem 1(a)(b)(c)(d) first, problem 2(a)(b). .. second, etc. ..) (2) Undergrads and grads will answer all questions. (3) Include in each part of the homework only the answer. R code and R output (without mistakes), must be included in the appendix to the question. For example, for question 1.a, write only the answer and your comments. The code and output for that part of the question will be in the appendix (the last part of question 1). (4) No late homework under any circumstances. (5) Write your name and ID this way: Last name, first name, UCLA ID, date, Homework number. (6) Do not just give a number as an answer. For example, if asked for probability that posterior proportion is larger than 0.7, write Prob ( p > 0 . 7) = 0 . 3, say and write comments or explanations if needed. (7) The homework must be turned in in lecture (no mail box, no e-mail). Problem 1. Suppose your prior distribution for θ , the proportion of Californians who support the death penalty, is beta with mean 0.6 and standard deviation 0.3. (a) Determine the parameters a and b of your prior distribution. Sketch the prior density function (may use R) 0.0 0.2 0.4 0.6 0.8 1.0 1 2 3 4 5 theta dbeta(theta, 1, 2/3) Figure 1: Beta(1,2 / 3) prior distribution for the the proportion of Californians who support the death penalty. The prior θ Beta ( a , b ), so p ( θ ) = Γ ( a + b ) Γ ( a ) Γ ( b ) θ a - 1 (1 - θ ) b - 1 We know that the mean and variance for θ is respectively E ( θ ) = a a + b Var ( θ ) = ab ( a + b ) 2 ( a + b + 1) = E ( θ ) × E (1 - θ ) ( a + b + 1) Then we have a + b = E ( θ )(1 - E ( θ )) Var ( θ ) - 1 . Therefore: a = E ( θ 2 )(1 - E ( θ )) Var ( θ - E ( θ ) = 1 b = E ( θ )(1 - E ( θ )) 2 Var ( θ ) - 1 + E ( θ ) = 2 3 October 13 (Revised October 21, 2010) 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Stat 180 / C236 Homework 4 J. Sanchez UCLA Department of Statistics The prior distribution is shown in figure ?? pdf("hwk4fall2010p1.pdf") theta=seq(0,1,length=500) plot(theta,dbeta(theta,1,2/3),type="l") dev.off() (b) A random sample of 1000 Californians is taken, and 65% support the death penalty. What are your posterior mean and variance for θ ? We can write down the likelihood as: p ( y | θ ) = n y ! θ y (1 - θ ) n - y and the posterior density as p ( θ | y ) Beta ( a + y , n + b - y ) = Beta (1 + 650 , 350 + 2 / 3) Then the posterior mean and variance of θ are E ( θ | y ) = 651 1000 + 1 + 2 / 3 = 0 . 65 Var ( θ | y ) = E ( θ | y )(1 - E ( θ | y )) a + b + n + 1 = 0 . 0002 The graph in figure ?? is the posterior distribution 0.0 0.2 0.4 0.6 0.8 1.0 0 5 10 15 20 25 theta dbeta(theta, 1 + 650, 350 + 2/3) Figure 2: Posterior distribution for the the proportion of Californians who support the death penalty. pdf("hwk4fall2010p1b.pdf")
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/24/2010 for the course STAT 201a taught by Professor Wu during the Spring '10 term at Pasadena City College.

Page1 / 6

homework4fall2010-key - Stat 180/C236 Homework 4...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online