This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Stat 180 / C236 Homework 3key J. Sanchez UCLA Department of Statistics Instructions (1) Homework must be typed and 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. (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 > . 7) = . 3, say and write comments or explanations if needed. (7) The homework must be turned in in lecture (no mail box, no email). Problem 1. Exercise 1chapter 3Hopf. Sample survey: Suppose we are going to sample 100 individuals from a county (of size much larger than 100) and ask each sampled person whether they support policy Z or not. Let Y i = 1 if person i in the sample supports the policy, and Y i = 0 otherwise. (a) Assume Y 1 , ..., Y 100 are, conditional on θ , i.i.d. binary random variables with expectation θ . Write down the joint distribution of Pr ( Y 1 = y 1 , ..., Y 100 = y 100  θ ) in a compact form. Also write down the form of Pr ( ∑ Y i = y  θ ). P ( Y 1 , ....., Y 100  θ ) = θ ∑ 100 i = 1 y i (1 θ ) 100 ∑ 100 i = 1 y i Pr X Y i = y  θ = 100 y ! θ y (1 θ ) 100 y (b) For the moment, suppose you believed that θ ∈ { . , . 1 , ..., . 9 , 1 . } . Given that the results of the survey were ∑ 100 i = 1 Y i = 57, compute Pr ( ∑ Y i = 57  θ ) for each of these 11 values of θ and plot these probabilities as a function of θ . We could do this by hand, using a calculator and plugging into the following formulas each value of θ Pr X Y i = 57  θ = 100 57 ! θ 57 (1 θ ) 43 Or we could just do it with R . You can see the plot in figure 1. The maximum likelihood estimate is θ = . 6 . Note that the likelihood function does not have to add up to 1. pdf("hopfex3b.pdf") #do not type this and dev.off() below theta=seq(0,1,by=0.1) prob=(choose(100,57))*(theta)ˆ(57)*(1theta)ˆ(43) prob [1] 0.000000e+00 4.107157e31 3.738459e16 1.306895e08 2.285792e04 [6] 3.006864e02 6.672895e02 1.853172e03 1.003535e07 9.395858e18 [11] 0.000000e+00 plot(theta,prob,type="h", ylab="Prob(y=57  theta, n=100)") dev.off() # do not type (c) Now suppose you originally had no prior information to believe one of these θ values over another, and so Pr ( θ = . 0) = Pr ( θ = . 1) = = Pr ( θ = . 9) = Pr ( θ = 1 . 0). Use Bayes rule to compute p( θ  ∑ 100 i = 1 Y i = 57) for each θ value. Make a plot of this posterior distribution as a function of θ ....
View
Full
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.
 Spring '10
 wu
 Statistics

Click to edit the document details