Upcoming SlideShare
×

# 08 Continuous

423 views
330 views

Published on

Published in: Education
0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
423
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
5
0
Likes
0
Embeds 0
No embeds

No notes for slide

### 08 Continuous

1. 1. Stat310 Continuous random variables Hadley Wickham Thursday, 4 February 2010
2. 2. 1. Finish off Poisson 2. New conditions & deﬁnitions 3. Uniform distribution 4. Exponential and gamma Thursday, 4 February 2010
3. 3. Challenge If X ~ Poisson(109.6), what is P(X > 100) ? What’s the probability they score over 100 points? (How could you work this out?) Thursday, 4 February 2010
4. 4. 1.0 ●● ●●●●●●●●●●●●●●●●●● ● ●●● ● ●● ● ● ● ● ● ● ● ● 0.8 ● ● ● ● ● ● ● 0.6 ● cumulative ● ● ● ● 0.4 ● ● ● ● ● ● 0.2 ● ● ● ● ● ● ● ● ● ● ● ●● ●● 0.0 ●●●●●●●●●●●●● 80 100 120 140 grid Thursday, 4 February 2010
5. 5. Multiplication X ~ Poisson(λ) Y = tX Then Y ~ Poisson(λt) Thursday, 4 February 2010
6. 6. Continuous random variables Recall: have uncountably many outcomes Thursday, 4 February 2010
7. 7. f (x) For continuous x, f(x) is a probability density function. Not a probability! (may be greater than one) Thursday, 4 February 2010
8. 8. b P (a X b) = f (x)dx a b P (a ≤ X ≤ b) = f (x)dx a What does P(X = a) = ? Thursday, 4 February 2010
9. 9. Conditions f (x) ≥ 0 ∀x ∈ R f (x) = 1 R Thursday, 4 February 2010
10. 10. E(u(X)) = u(x)f (x)dx R MX (t) = e f (x)dx tx R Thursday, 4 February 2010
11. 11. Aside Why do we need different methods for discrete and continuous variables? Our deﬁnition of integration (Riemanian) isn’t good enough, because it can’t deal with discrete pdfs. Can generalise to get Lebesgue integration. More general approach called measure theory. Thursday, 4 February 2010
12. 12. Cumulative distribution function x F (x) = P (X ≤ x) = f (t)dt −∞ b P (X ∈ [a, b]) = f (x)dx = F (b) − F (a) a Thursday, 4 February 2010
13. 13. f (x) Integrate Differentiate F(x) Thursday, 4 February 2010
14. 14. Uniform distribution Thursday, 4 February 2010
15. 15. The uniform Assigns probability uniformly in an interval [a, b] of the real line X ~ Uniform(a, b) What are F(x) and f(x) ? b f (x)dx = 1 a Thursday, 4 February 2010
16. 16. Intuition X ~ Unif(a, b) How do you expect the mean to be related to a and b? How do you expect the variance to be related to a and b? Thursday, 4 February 2010
17. 17. 1 f (x) = x ∈ [a, b] b−a F (x) = 0 xa F (x) = x−a b−a x ∈ [a, b] F (x) = 1 xb Thursday, 4 February 2010
18. 18. b 1 MX (t) = E[e Xt ]= ext dx a b−a integrate e^(x * t) 1/(b-a) dx from a to b Thursday, 4 February 2010
19. 19. Mean variance Find mgf: integrate e^(x * t) 1/(b-a) dx from a to b Find 1st moment: d/dt (E^(a_1 t) - E^(b_1 t))/ (a_1 t - b_1 t) where t = 0 Find 2nd moment d^2/dt^2 (E^(a_1 t) - E^ (b_1 t))/(a_1 t - b_1 t) where t = 0 Find var: simplify 1/3 (a_1 b_1+a_1^2+b_1^2) - ((a_1 + b_1)/2) ^ 2 Thursday, 4 February 2010
20. 20. a+b E(X) = 2 (b − a) 2 V ar(X) = 12 Thursday, 4 February 2010
21. 21. Write out in a similar way when using wolfram alpha in homework Thursday, 4 February 2010
22. 22. Exponential and gamma distributions Thursday, 4 February 2010
23. 23. Conditions Let X ~ Poisson(λ) Let Y be the time you wait for the next event to occur. Then Y ~ Exponential(β = 1 / λ) Let Z be the time you wait for α events to occur. Then Z ~ Gamma(α, β = 1 / λ) Thursday, 4 February 2010
24. 24. LA Lakers Last time we said the distribution of scores looked pretty close to Poisson. Does the distribution of times between scores look exponential? (Downloaded play-by-play data for all NBA games in 08/09 season, extracted all point scoring plays by Lakers, computed times between them - 4660 in total) Thursday, 4 February 2010
25. 25. 8 are exponential. 1 is real. 1 2 3 0.030 0.025 0.020 0.015 0.010 0.005 0.000 4 5 6 0.030 0.025 Proportion 0.020 0.015 0.010 0.005 0.000 7 8 9 0.030 0.025 0.020 0.015 0.010 0.005 0.000 0 50 100 150 200 250 300 0 50 100 150 200 250 300 0 50 100 150 200 250 300 value Thursday, 4 February 2010
26. 26. 0.030 What causes this spike? 0.025 0.020 Proportion 0.015 0.010 0.005 0.000 0 50 100 150 200 250 300 dur Thursday, 4 February 2010
27. 27. 0.030 β = 44.9 s 0.025 0.020 Proportion 0.015 0.010 0.005 0.000 0 50 100 150 200 250 300 dur Thursday, 4 February 2010
28. 28. Why? Why is it easy to see that the waiting times are not exponential, when we couldn’t see that the scores were not Poisson? Thursday, 4 February 2010
29. 29. Next Remove free throws. Try using a gamma instead (it’s a bit more ﬂexible because it has two parameters, but it maintains the basic idea) Thursday, 4 February 2010
30. 30. 8 are gamma. 1 is real. 1 2 3 0.020 0.015 0.010 0.005 0.000 4 5 6 0.020 0.015 Proportion 0.010 0.005 0.000 7 8 9 0.020 0.015 0.010 0.005 0.000 0 100 200 300 400 0 100 200 300 400 0 100 200 300 400 value Thursday, 4 February 2010
31. 31. 0.020 0.015 Proportion 0.010 0.005 0.000 0 100 200 300 400 dur Thursday, 4 February 2010
32. 32. 0.020 β = 28.3 α = 2.28 0.015 Out of 6611 shots, 3140 made it: 1 went in for every Proportion 0.010 2.1 attempts 0.005 0.000 0 100 200 300 400 dur Thursday, 4 February 2010
33. 33. Exponential Gamma 1 −x/θ 1 pdf f (x) = e f (x) = Γ(α)θα xα−1 e−x/θ θ 1 1 mgf M (t) = M (t) = (1 − θt)α 1 − θt Mean θ αθ 2 2 Variance θ αθ Thursday, 4 February 2010
34. 34. Another derivation Find mgf: integrate 1 / (gamma(alpha) theta^alpha) x^(alpha - 1) e^(-x / theta) e^ (x*t) from x = 0 to inﬁnity Find mean: d/dt theta^(-alpha) (1/theta - t) ^(-alpha) where t = 0 Rewrite: d/dt x_2^(-x_1) (1/x_2 - t)^(-x_1) where t = 0 Thursday, 4 February 2010
35. 35. Your turn Assume the distribution of offensive points by the LA lakers is Poisson(109.6). A game is 48 minutes long. Let W be the time you wait between the Lakers scoring a point. What is the distribution of W? How long do you expect to wait? Thursday, 4 February 2010
36. 36. Next week Normal distribution: Read 3.2.4 Calculating probabilities Transformations: Read 3.4 up to 3.4.3 Thursday, 4 February 2010