06 mean var
DESCRIPTION
TRANSCRIPT
Hadley Wickham
Stat310Mean, Variance and Distributions
Saturday, 24 January 2009
1. Recap: random variables & pmf
2. Expectation
3. Mean & variance
4. Meet some random variables
Saturday, 24 January 2009
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.
Random variable
Saturday, 24 January 2009
Discrete r.v.
A discrete random variable has a countable sample space, typically a subset of the integers.
Saturday, 24 January 2009
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
To be a pmf
A function must satisfy two properties:
• f(x) ≥ 0, for all x
• ∑ f(x) = 1
Saturday, 24 January 2009
x f(x)
1 0.35
2 0.25
3 0.2
4 0.1
5 0.1
x f(x)
10 -0.1
20 0.9
30 0.2
x f(x)
-1 0.3
0 0.3
2 0.3
x f(x)5 1
x f(x)
10 0.1
20 0.9
30 0.2
Saturday, 24 January 2009
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
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
x
f(x)
0.0
0.1
0.2
0.3
0.4
1 2 3 4 5x
f(x)
−0.1
0.0
0.1
0.2
0.3
0.4
0.5
1 2 3 4 5
x
f(x)
0.0
0.2
0.4
0.6
0.8
1.0
1.0 1.5 2.0 2.5 3.0x
f(x)
0.0
0.2
0.4
0.6
0.8
1.0 1.5 2.0 2.5 3.0
a) b)
c) d)
Saturday, 24 January 2009
Expectation
• Allows us to summarise a pmf with a single number
• Definition
• Properties
Saturday, 24 January 2009
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
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
Meet the distributions
Discrete uniform
Bernoulli
Binomial
Saturday, 24 January 2009
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
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
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
Transformations
If X ~ Bernoulli(p)
What is 1 - X?
What is X2?
(Think about X, not f(x))
Saturday, 24 January 2009
Binomial distributionn 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