homework5-fall2010 - Stat 180/C236 Homework 5 Instructions...

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

View Full Document Right Arrow Icon
Stat 180 / C236 Homework 5 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. 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). Homework 5: Do problems 1, 2, 3 of Hopf’s Chapter 5. Can be found in the back matter. Problem 1. 5.1 Studying: The files school1.dat, school2.dat and school3.dat contain data on the amount of time students from three high schools spent on studying or homework during an exam period. Analyze data from each of these schools separately, using the normal model with a conjugate prior distribution, in which { μ 0 = 5 , σ 2 0 = 4 , κ 0 = 1 , ν 0 = 2 } and compute or approximate the following: (a) posterior means and 95% confidence intervals for the mean θ and standard deviation σ from each school; Answer: The joint posterior distribution for θ and σ is (from our notes and Hopf Chapter 5) p ( θ, σ 2 | y 1 , .... , y n ) = p ( θ | σ 2 , y 1 , ..., y n ) P ( σ 2 | y 1 , .... y n ) = Normal μ n , σ 2 κ n ! IG ν n 2 , ν n σ 2 n 2 ! where κ n = κ 0 + n μ n = κ 0 σ 2 μ 0 + n σ 2 ¯ y κ 0 σ 2 + n σ 2 = κ 0 μ 0 + n ¯ y κ n ν n = ν 0 + n σ 2 n = 1 ν n " ν 0 σ 2 0 + ( n - 1) s 2 + κ 0 n κ n y - μ 0 ) 2 # Posterior inference for θ and σ School E( θ ) 95% int θ E( σ ) 95% int σ n School 1 9.281 (7.756, 10.801) 3.906 (3.011 ,5.166) 25 School 2 6.946 (5.197,8.763) 4.392 (3.333,5.888) 23 School 3 7.821 (6.191, 9.431) 3.748 (2.802, 5.086) 20 As we can see in the table, kids in school 2 study less on average, but there is more variability on how many hours each kid there put than in the other two schools. See the R code at the end of this section. January 14, 2010 (Revised November 7, 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 5 J. Sanchez UCLA Department of Statistics ### For school1 #### Read the data school1.dat=read.table("http://www.stat.washington.edu/hoff/Book/Data/hwdata/school1.dat") attach(school1.dat) #### summarize the data hours1=school1.dat$V1 y1bar=mean(hours1) ; y1s2=var(hours1) y1s=sd(hours1) ; n1=length(hours1) #### Prior distribution parameters mu0=5 ; sigma02=4; k0=1; nu0=2 #### posterior distribution parameters kn.1=k0+n1 mun.1=(k0*mu0 + n1*y1bar)/kn.1 nun.1=nu0+n1
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

homework5-fall2010 - Stat 180/C236 Homework 5 Instructions...

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