10 Computing

594 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
594
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
6
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

10 Computing

  1. 1. Quiz • Pick up quiz on your way in. • Start at 1pm • Finish at 1:10pm • Bonus: no homework this week. Homework help sessions -> review sessions. Tuesday, 16 February 2010
  2. 2. Stat310 Transformations & CDF Hadley Wickham Tuesday, 16 February 2010
  3. 3. 1. Transformations 2. CDF (again) 1. Exact computation 2. Tables Tuesday, 16 February 2010
  4. 4. Transformations Distribution Change of function variable technique technique Much more useful for 2+ rvs Tuesday, 16 February 2010
  5. 5. Remember: it’s the sample space that changes, not the probability Tuesday, 16 February 2010
  6. 6. Distribution function technique Y = u(X) 1. Find region in X such that g(X) < y 2. Find cdf with integration 3. Find pdf by differentiating Tuesday, 16 February 2010
  7. 7. Finish the proof X = Uniform(-1, 1) Y = X2 P(Y < y) = P(X2< y) = ... Tuesday, 16 February 2010
  8. 8. Change of variables If Y = u(X), and v is the inverse of u, X = v(Y) then fY(y) = fX(v(y)) |v’(y)| Transformation must have an inverse! Tuesday, 16 February 2010
  9. 9. Your turn X = Uniform(-1, 1) Y= X2 Can you use the change of variables technique here? Why/why not? If not, how could you modify X to make it possible? Tuesday, 16 February 2010
  10. 10. Your turn X ~ Exponential(β) Y = exp(X) Find fY(y). Does y have a named distribution? Tuesday, 16 February 2010
  11. 11. Relationship to uniform Important connection between the uniform and every other random variable through the cdf. Tuesday, 16 February 2010
  12. 12. Uniform to any rv IF Y ~ Uniform(0, 1) F a cdf THEN X= F -1(Y) is a rv with cdf F(x) (Assume F strictly increasing for simplicity) Tuesday, 16 February 2010
  13. 13. Any rv to uniform IF X has cdf F Y = F(X) THEN Y ~ Uniform(0, 1) (Assume F strictly increasing for simplicity) Tuesday, 16 February 2010
  14. 14. CDF Tuesday, 16 February 2010
  15. 15. F (x) = P (X ≤ x) discrete F (x) = f (t) tx x continuous F (x) = f (t)dt −∞ Tuesday, 16 February 2010
  16. 16. f (x) Integrate Differentiate F(x) Tuesday, 16 February 2010
  17. 17. lim F (x) = 0 x→−∞ lim F (x) = 1 x→∞ monotone increasing right-continuous Tuesday, 16 February 2010
  18. 18. lim F (x) = 0 x→−∞ lim F (x) = 1 x→∞ monotone increasing right-continuous Tuesday, 16 February 2010
  19. 19. Using the cdf P (a X ≤ b) = F (b) − F (a) Exact computation Tables Computer Tuesday, 16 February 2010
  20. 20. Exact computation For some distributions we can write the cdf in closed form. For example: the exponential distribution has cdf: 1−e −λx , x ≥ 0, F (x; λ) = 0, x 0. Tuesday, 16 February 2010
  21. 21. Exact computation Many, however cannot: http://en.wikipedia.org/wiki/ Binomial_distribution http://en.wikipedia.org/wiki/ Gamma_distribution integrate 1/(sqrt(2 pi)) e ^ (-t^2 / 2) from - infinity to x Tuesday, 16 February 2010
  22. 22. Closed form Neither the CDF of the normal distribution nor erf can be expressed in terms of finite additions, subtractions, multiplications, and root extractions, and so both must be either computed numerically or otherwise approximated. i.e. can’t be expressed in closed form http://mathworld.wolfram.com/NormalDistribution.html Tuesday, 16 February 2010
  23. 23. Two approaches Look up the number in a table. Problem: you need a table for every combination of the parametes Use a computer. Problem: you need a computer Tuesday, 16 February 2010
  24. 24. Tables Tuesday, 16 February 2010
  25. 25. Standard normal Fortunately, for the normal distribution, we can convert any random variable with a normal distribution to a standard normal. This means we only need one table for any possible normal distribution. (For other distributions there will be multiple tables, and typically you will have to pick one with similar values to your example). Tuesday, 16 February 2010
  26. 26. P (Z z) = Φ(z) Φ(−z) = 1 − Φ(z) P (−1 Z 1) = 0.68 P (−2 Z 2) = 0.95 P (−3 Z 3) = 0.998 Tuesday, 16 February 2010
  27. 27. Using the tables Column + row = z Find: Φ(2.94), Φ(-1), Φ(0.01), Φ(4) Can also use in reverse: For what value of z is P(Z z) = 0.90 ? i.e. What is Φ-1(0.90)? Find: Φ-1(0.1), Φ-1(0.5), Φ-1(0.65), Φ-1(1) Tuesday, 16 February 2010
  28. 28. Next time Using the computer instead Generating random values and simulation Tuesday, 16 February 2010

×