Exercise #1

7
Exercise #1 Check the math in the example on slide 13. un

description

Exercise #1. Check the math in the example on slide 13. uniform(max(a,c), min(b,d)). Answer #1. - PowerPoint PPT Presentation

Transcript of Exercise #1

Page 1: Exercise #1

Exercise #1

Check the math in the example on slide 13.

Page 2: Exercise #1

Answer #1

Keep in mind that we’re interested in the proportionality (not the equality) of the expressions on the right sides of the equal sign. The distributions will be normalized anyway so it doesn’t matter what values any constants have. Thus, we can neglect the quotients with in the denominators. When the binomial in θ and x is squared, you can also ignore the constant terms that emerge. This includes the 72 and also the x2 term. Do you see why? The transition in the last line from the exponential function to the normal distribution goes like this:exp((–3θ2 + 50 θ)/4)exp(–¾(θ2 – (50/3) θ))exp(–¾ (θ2 – (50/3) θ)) exp(–¾(252/32)) (ok to multiply by any constant)exp(–¾ (θ2 – (50/3) θ + 252/32))exp(–¾ (θ – (25/3))2)exp(–(θ – (25/3))2 / (4/3)) exp(–(θ – (25/3))2 / (2 * ⅔))which is, apart from the normalizing quotient involving root , a normal distribution with μ = 25/3 and σ2 = ⅔.

Page 3: Exercise #1

Exercise #2

Sketch [P,P] for

{-,B,G,B,B,G,R,G,…, (35/100)R, …, (341/1000)R}.

Page 4: Exercise #1

Answer #2// the formula is p = [nj / (N + s), (nj + s)/(N + s)]func pp() return [$1/($2+$3), ($1+$3)/($2+$3)]

s = 2for n = 0 to 5 do say tab, n, tab, pp(0, n, s)

0 [ 0, 1]1 [ 0, 0.66667]2 [ 0, 0.5]3 [ 0, 0.4]4 [ 0, 0.33334]5 [ 0, 0.28572]

pp(1,6,s) [ 0.125, 0.375] pp(1,7,s) [ 0.11111, 0.33334] pp(35,100,s) [ 0.34313, 0.36275] pp(341,1000,s) [ 0.34031, 0.34232]

// Walley's (1996) bag of marbles

// the data is {-,B,G,B,B,G,R,G,…,(35/100)R,…(341/1000)R

// the formula is p = [nj / (N + s), (nj + s)/(N + s)]func pp() return [$1/($2+$3), ($1+$3)/($2+$3)]

s = 2

for n = 0 to 5 do say n, tab, pp(0, n, s)0 [ 0, 1]1 [ 0, 0.66667]2 [ 0, 0.5]3 [ 0, 0.4]4 [ 0, 0.33334]5 [ 0, 0.28572]pp(1,6,s) [ 0.125, 0.375] pp(1,7,s) [ 0.11111, 0.33334] pp(35,100,s) [ 0.34313, 0.36275] pp(341,1000,s) [ 0.34031, 0.34232]

//could also do it for another s

s = 1

for n = 0 to 5 do say n, tab, pp(0, n, s)0 [ 0, 1]1 [ 0, 0.5]2 [ 0, 0.33334]3 [ 0, 0.25]4 [ 0, 0.2]5 [ 0, 0.16667]pp(1,6,s) [ 0.14285, 0.28572] pp(1,7,s) [ 0.125, 0.25] pp(35,100,s) [ 0.34653, 0.35644] pp(341,1000,s) [ 0.34065, 0.34166]

s = 2

0

0.2

0.4

0.6

0.8

1

0 2 4 6 8 10

Sample size N

Pre

dic

tive

pro

bab

ilit

y

100 1000

s = 1

0

0.2

0.4

0.6

0.8

1

0 2 4 6 8 10

Sample size N

Pre

dic

tive

pro

bab

ilit

y

100 1000

Page 5: Exercise #1

Exercise #3

What can be said about the posterior if the prior is uniform(a,b) and the likelihood function is an a non-zero constant for values of between c and d and zero elsewhere? Sketch the answer for a = 2, b = 14, c = 5, d = 21. What is the posterior if a [1,3], b [11,17], c [4,6], d [20,22]?

Page 6: Exercise #1

Answer #3

The posterior would be uniform(max(a,c), min(b,d)), that is, a uniform ranging from the lesser of a and c to the greater of b and d. In the first case, the posterior would be a uniform (flat density, straight line cumulative) between 5 and 14. The graphs below illustrate this case.

0

0.02

0.04

0.06

0.08

0.1

0.12

0 5 10 15 20 25

Theta

Pro

bab

ilit

y d

ensi

ty

Posterior

Prior

Likelihood

0

0.2

0.4

0.6

0.8

1

0 5 10 15 20 25

Theta

Cu

mu

lati

ve

pro

ba

bil

ity

Prior

Likelihood

Posterior

Page 7: Exercise #1

0

0.2

0.4

0.6

0.8

1

0 5 10 15 20 25

Theta

Cu

mu

lati

ve p

rob

abil

ity

Prior

Likelihood

Posterior

Answer #3 (continued)

In the second case, the posterior would be the class of uniforms whose minima are within the interval [4,6] and whose maxima are within the interval [11,17], i.e., any straight line inside the gray bounds from zero to one is a possible posterior from this analysis.

Notice that the same formula uniform(max(a,c), min(b,d)) works when a, b, c and d are intervals.