Id trials so p 100 i1 yi y yi 1 100 100 i1

Info iconThis preview shows page 1. Sign up to view the full content.

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

Unformatted text preview: ls, so p ￿ 100 ￿ i=1 Yi = y |θ ￿ = ￿ ￿ yi (1 − θ)100− ￿100 i=1 Yi ￿100 i=1 yi . ∼ Binomial(100, θ) 100 y θ (1 − θ)100−y . y ￿ (b) Suppose 100 Yi = 57 and θ ∈ {0.0, 0.1, . . . , 0.9, 1.0}. We can use the following R code to i=1 ￿ compute and plot p( 100 Yi = 57|θ) for the 11 values of θ: i=1 theta = seq(0, 1, 0.1); n=100; sumy = 57 dbinom(sumy, n, theta) plot(theta, dbinom(sumy, n, theta), type="h", xlab=expression(theta), ylab=expression(paste("p(",sum(y),"=57|",theta,")"))) p( p( ￿100 θ i=1 Yi ￿100 0.0 = 57|θ) θ i=1 Yi 0.1 4.1 × 0.000 0.6 = 57|θ) 0.067 × 10−31 0.7 10−2 1.85 × 10−3 0.2 3.74 × 0.3 10−16 1.31 × 0.8 1.00 × 10−7 10−8 0.9 9.40 × (c) Suppose p(θ = 0.0) = p(θ = 0.1) = . . . = p(θ = 0.9) = p(θ = 1.0) = 10−18 0.4 2.29 × 10−4 1.0 0.000 1 11 . Using Bayes’ rule, p( θ = j | n ￿ Yi = 57) = i=1 = ￿ p( n Yi = 57|θ = j )p(θ = j ) i=1 ￿ ￿ p( n Yi = 57|θ = k )p(θ = k ) k i=1 ￿ ￿ 1 p( n Yi = 57|θ) × 11 p( n Yi = 57|θ) i=1 ￿ i=1 =￿ ￿ ￿n 1 p( n Yi = 57|θ = k ) k i=1 k p( i=1 Yi = 57|θ = k ) 11 You can use the following R code to evaluate the posterior distribution of θ and plot it: theta = seq(0, 1, 0.1); n=100; sumy = 57 psumy = dbinom(sumy, n, theta) post = psumy/sum(psumy) plot(theta, post, type="h", xlab=expression(theta), ylab=expression(paste("p(",theta,"|",sum(y),"=57",")"))) 2 0.5 0.030 θ p( θ | ￿100 p( θ | ￿100 i=1 Yi 0.0 = 57) θ i=1 Yi 0.000 0.1 4.1 × 0.2 10−30 3.78 × 10−15 0.3 1.32 × 10−7 0.4 2.31 × 10−3 0.6 = 57) 0.7 0.8 0.9 1.87 × 10−2 1.01 × 10...
View Full Document

This note was uploaded on 02/22/2013 for the course MATH 604 taught by Professor Tadasee during the Spring '13 term at Georgetown.

Ask a homework question - tutors are online