Successfully reported this slideshow.

06 Mean Var

Upcoming SlideShare
Cg
×

1 of 19 Ad

06 Mean Var

More Related Content

06 Mean Var

1. 1. Stat310 Mean, Variance and Distributions Hadley Wickham Saturday, 24 January 2009
2. 2. 1. Recap: random variables & pmf 2. Expectation 3. Mean & variance 4. Meet some random variables Saturday, 24 January 2009
3. 3. Random variable A random variable is a random experiment with a numeric sample space. (Can make many different random variables from a single random experiment) More formally, a random variable is a function that converts elements of non- numeric sample space to numbers. Saturday, 24 January 2009
4. 4. Discrete r.v. A discrete random variable has a countable sample space, typically a subset of the integers. Saturday, 24 January 2009
5. 5. pmf Every random variable has an associated probability mass function (pmf). The random variable says what is possible. (the sample space) The pmf says how likely each possibility is. (the probability) Saturday, 24 January 2009
6. 6. To be a pmf A function must satisfy two properties: • f(x) ≥ 0, for all x • ∑ f(x) = 1 Saturday, 24 January 2009
7. 7. x f(x) x f(x) x f(x) -1 0.3 10 -0.1 1 0.35 0 0.3 20 0.9 2 0.25 2 0.3 30 0.2 3 0.2 4 0.1 x f(x) x f(x) 5 0.1 5 1 10 0.1 20 0.9 30 0.2 Saturday, 24 January 2009
8. 8. Notation Normally call pmf f If we have multiple rv’s and want to make clear which pmf belongs to which rv, we write: fX(x) fY(y) fZ(z) for X, Y, Z f1(x) f2(x) f3(3) for X1, X2, X3 Saturday, 24 January 2009
9. 9. Notation Can give pmf in two ways: • List of numbers (for small n) • Function (for large n) These are equivalent! Also useful to display visually, with a bar plot (not a histogram: the book is wrong!) Saturday, 24 January 2009
10. 10. a) b) 0.8 1.0 0.6 0.8 0.6 0.4 f(x) f(x) 0.4 0.2 0.2 0.0 0.0 1.0 1.5 2.0 2.5 3.0 1.0 1.5 2.0 2.5 3.0 x x c) d) 0.5 0.4 0.4 0.3 0.3 0.2 f(x) f(x) 0.2 0.1 0.1 0.0 0.0 −0.1 1 2 3 4 5 1 2 3 4 5 x x Saturday, 24 January 2009
11. 11. Expectation • Allows us to summarise a pmf with a single number • Deﬁnition • Properties Saturday, 24 January 2009
12. 12. Mean • Summarises the “middle” of the distribution • If you imagine the number line as a beam with weights of f(x) at position x, the balance point is the mean • mean = E(X) Saturday, 24 January 2009
13. 13. Variance • Summarises the “spread” of a distribution • Var[X] = E[ (X - E[X])2] = ... • Expected squared distance from centre • sd[X] = Var[X]0.5 Saturday, 24 January 2009
14. 14. Meet the distributions Discrete uniform Bernoulli Binomial Saturday, 24 January 2009
15. 15. Discrete uniform Equally likely events f(x) = 1/m x = 1, ..., m X ~ DiscreteUniform(m) What is the mean? What is the variance? Saturday, 24 January 2009
16. 16. Useful facts Sum of integers from i = 1 to m is Sum of squared integers from i = 1 to m is Saturday, 24 January 2009
17. 17. Bernoulli distribution Single binary event: either happens (with probability p) or doesn’t happen X ~ Bernoulli(p) What is the mean of X? What is the variance of X? Saturday, 24 January 2009
18. 18. Transformations If X ~ Bernoulli(p) What is 1 - X? What is X2? (Think about X, not f(x)) Saturday, 24 January 2009
19. 19. Binomial distribution n independent Bernoulli trials with the same probability of success. X is the number of success X ~ Binomial(n, p) What is the mean? What is the variance? Better tools? Saturday, 24 January 2009