Download presentation

Presentation is loading. Please wait.

Published byKiera Chopin Modified over 3 years ago

1
2.4. The 95% interval of Gamma(2,1) (Optional question) Jungho Ryu

2
The situation We need to find the 95% confidence interval of Gamma distribution f(x) with one of these conditions satisfied: 1.Choose two points x0 and x1 with x0 < x1 such that I.f(x0) = f(x1) II.For all (x’ x1), f(x’) < f(x0). 2.(equivalently) Choose two points x0 and x1 with x0 < x1 such that I.f(x0) = f(x1) II.For all possible x0’ and x1’ with x0’ x1 – x0.

3
The situation We need to find the 95% confidence interval of Gamma distribution f(x) with one of these conditions satisfied: 1.Choose two points x0 and x1 with x0 < x1 such that I.f(x0) = f(x1) II.For all (x’ x1), f(x’) < f(x0). 2.(equivalently) Choose two points x0 and x1 with x0 < x1 such that I.f(x0) = f(x1) II.For all possible x0’ and x1’ with x0’ x1 – x0.

4
Pictorically Speaking Case 1: all points not belonging to the interval have lower f(x) biggest f(x) are in the 95% interval All x’s that belong to 95% interval f(x0)f(x1)

5
Conceptually Speaking Notice that x0 and x1 are on the opposite side of the peak (global maximum) – So we need to find the global maximum To always include only the biggest f(x)’s, we can start x0 and x1 from the top and go down – while f(x0) and f(x1) keeping the same! But the sides look different (function is not symmetrical!)

6
Into action! First we need to find that global maximum (easy!: Find it analytically). Gamma Distribution (scale = 2, shape = 1) f(x) = x e -x. We take the derivative and set it to 0. f’(x) = e –x – xe -x = 0 e –x = xe -x x = 1 The global maximum is at x =1. So, x0 1.

7
Ideally, We would update (decrease) x0 and then find the inverse f -1 to get x1. – Not doable analytically. Then we do it numerically: – Update (decrease) x0 calculate f(x0) slowly update (increase) x1 so that f(x1) ≈ f(x0) Actually, f(x1) + ɛ = f(x0) We lead with x0 and update with x1 because f(x1) decreases slower (therefore more accurate).

8
Describe the Update in Picture Start with x0 and x1 close to 1. Possible 95% interval candidate f(x0)f(x1) 1

9
Describe the Update in Picture Move the x0 to a new position Possible 95% interval candidate f(x0) f(x1) 1 1.Lower x0 lower f(x0)

10
Describe the Update in Picture Increase x1 little by little biggest f(x) only Possible 95% interval candidate f(x0) f(x1) 2 1.Lower x0 lower f(x0) 2.Increase x1 slowly so that f(x1) ≈ f(x0)

11
Describe the Update in Picture f(x1) ≈ f(x0) biggest f(x) only Possible 95% interval candidate f(x0) f(x1) 1.Lower x0 lower f(x0) 2.Increase x1 slowly so that f(x1) ≈ f(x0)

12
Describe the Update in Picture Check to see the interval represents 95% Possible 95% interval candidate f(x0) f(x1) 1.Lower x0 lower f(x0) 2.Increase x1 slowly so that f(x1) ≈ f(x0) 3.Check whether the interval F(x1)-F(x0) is big enough. 3

13
Describe the Update in Picture All together biggest f(x) only Possible 95% interval candidate (check) f(x0) f(x1) 1 2 3 1.Lower x0 lower f(x0) 2.Increase x1 slowly so that f(x1) ≈ f(x0) 3.Check whether the interval F(x1)-F(x0) is big enough.

14
the Algorithm To start the algorithm: f(x0) > f(x1) F(x1) – F(x0) < 0.95. Iterates by: Update x0, and then update x1. Check for F(x1) – F(x0) > 0.95. Print result of each iteration Algorithm Ends when: F(x1) – F(x0) ≈ 0.95 (actually F(x1) – F(x0)= 0.95 + ɛ’)

15
Setting up BEFORE the algorithm Positions of f(x0) and f(x1) Definitely smaller than 95% f(x0) f(x1) f(x0) < 1 < f(x1) f(x0) < f(x1) F(x1) – F(x0) < 0.95

16
Our Algorithm Conceptually Initiate x0 = 0.7, x1 = 1.3 ( f(x0) = 0.3476 and f(x1) = 0.3543. F(x1) – F(x0) = 0.21737) while (F(x1) – F(x0) < 0.95)

17
Our Algorithm Conceptually Initiate x0 = 0.7; x1 = 1.3; define f(x) while (F(x1) – F(x0) < 0.95) x0 = x0 - 0.001 while ( f(x1) – f(x0) > 0) x1 = x1 + 0.001 (UPDATE)

18
Our Algorithm Conceptually Initiate x0 = 0.7; x1 = 1.3; define f(x) while (F(x1) – F(x0) < 0.95) interval = F(x1) – F(x0) print x0, x1, f(x0), f(x1), interval x0 = x0 - 0.001 while ( f(x1) – f(x0) > 0) x1 = x1 + 0.001 (UPDATE)

19
Everything Correct (Final) x0 = 0.7; x1 = 1.3; f = function(x){p = x*exp(-x) return(p)} while (pgamma(x1, shape =2) – pgamma(x0, shape=2) < 0.95){ x0 = x0 – 0.001 while (f(x1) – f(x0) > 0){ x1 = x1 + 0.001} interval = pgamma(x1, shape =2) – pgamma(x0, shape=2) print(c(x0, x1, f(x0), f(x1), interval))}

20
The Output … x0, x1, f(x0), f(x1), interval

21
Optional: Improving the algorithm We saw epilson ɛ twice. This implies that the algorithm is biased! The algorithm will always have the right point a little too far out and the interval slightly too big!

22
Ideally, We would update (decrease) x0 and then find the inverse f -1 to get x1. – Not doable analytically. Then we do it numerically: – Update (decrease) x0 calculate f(x0) slowly update (increase) x1 so that f(x1) ≈ f(x0) Actually, f(x1) + ɛ = f(x0) We lead with x0 and update with x1 because f(x1) decreases slower (therefore more accurate).

23
the Algorithm To start the algorithm: f(x0) > f(x1) F(x1) – F(x0) < 0.95. Iterates by: Update x0, and then update x1. Check for F(x1) – F(x0) > 0.95. Print result of each iteration Algorithm Ends when: F(x1) – F(x0) ≈ 0.95 (actually F(x1) – F(x0)= 0.95 + ɛ’)

24
Correcting Bias We can correct the bias by adding or subtracting a small amount to negate ɛ. How much? Look at the output and take the average Where? Right after the updates are done BUT ON NEXT TIME!

Similar presentations

OK

Test Topics 1)Notation and symbols 2)Determining if CLT applies. 3)Using CLT to find mean/mean proportion and standard error of sampling distribution 4)Finding.

Test Topics 1)Notation and symbols 2)Determining if CLT applies. 3)Using CLT to find mean/mean proportion and standard error of sampling distribution 4)Finding.

© 2018 SlidePlayer.com Inc.

All rights reserved.

To ensure the functioning of the site, we use **cookies**. We share information about your activities on the site with our partners and Google partners: social networks and companies engaged in advertising and web analytics. For more information, see the Privacy Policy and Google Privacy & Terms.
Your consent to our cookies if you continue to use this website.

Ads by Google

Ppt on information technology and values Ppt on line drawing algorithm Ppt on history of badminton sport Ppt on x-ray tube Ppt on db2 mainframes vs servers Ppt on preservation of public property Ppt on limits and derivatives tutorial Ppt on osteosarcoma Ppt on bionics Ppt on automobile topics