06 mean var

19
Hadley Wickham Stat310 Mean, Variance and Distributions Saturday, 24 January 2009

Upload: hadley-wickham

Post on 05-Dec-2014

1.050 views

Category:

Education


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: 06 Mean Var

Hadley Wickham

Stat310Mean, Variance and Distributions

Saturday, 24 January 2009

Page 2: 06 Mean Var

1. Recap: random variables & pmf

2. Expectation

3. Mean & variance

4. Meet some random variables

Saturday, 24 January 2009

Page 3: 06 Mean Var

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

Page 4: 06 Mean Var

Discrete r.v.

A discrete random variable has a countable sample space, typically a subset of the integers.

Saturday, 24 January 2009

Page 5: 06 Mean Var

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

Page 6: 06 Mean Var

To be a pmf

A function must satisfy two properties:

• f(x) ≥ 0, for all x

• ∑ f(x) = 1

Saturday, 24 January 2009

Page 7: 06 Mean Var

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

Page 8: 06 Mean Var

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

Page 9: 06 Mean Var

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

Page 10: 06 Mean Var

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

Page 11: 06 Mean Var

Expectation

• Allows us to summarise a pmf with a single number

• Definition

• Properties

Saturday, 24 January 2009

Page 12: 06 Mean Var

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

Page 13: 06 Mean Var

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

Page 14: 06 Mean Var

Meet the distributions

Discrete uniform

Bernoulli

Binomial

Saturday, 24 January 2009

Page 15: 06 Mean Var

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

Page 16: 06 Mean Var

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

Page 17: 06 Mean Var

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

Page 18: 06 Mean Var

Transformations

If X ~ Bernoulli(p)

What is 1 - X?

What is X2?

(Think about X, not f(x))

Saturday, 24 January 2009

Page 19: 06 Mean Var

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