homework3-fall2010-1

homework3-fall2010-1 - Stat 180 / C236 Homework 3-key J....

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Stat 180 / C236 Homework 3-key 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 e-mail). Problem 1. Exercise 1-chapter 3-Hopf. 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)*(1-theta)(43) prob [1] 0.000000e+00 4.107157e-31 3.738459e-16 1.306895e-08 2.285792e-04 [6] 3.006864e-02 6.672895e-02 1.853172e-03 1.003535e-07 9.395858e-18 [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

Page1 / 9

homework3-fall2010-1 - Stat 180 / C236 Homework 3-key J....

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

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