introduction to random variables
DESCRIPTION
TRANSCRIPT
Hadley Wickham
Stat310Random variables
1. Feedback
2. Recap
3. Introduction to random variables
4. Expectation
Feedback
Reading through text
Did homework early
Did homework
Taking good notes
Attending class
0 4 8 12 16 20
Reading through text
Did homework early
Did homework
Taking good notes
Attending class
0 4 8 12 16 20
Start homework earlier
More work outside of class
Read book
Recaps
Powerpoints
Website
Clear presentation/explanations
Interactivity & Feedback
Examples
0 5 10 15 20 25
Recaps
Powerpoints
Website
Clear presentation/explanations
Interactivity & Feedback
Examples
0 5 10 15 20 25
T shirts
Accent
Improvements
Board skills: mistakes, more details & structure, straight lines
Pace: 5 good, 5 too fast, 2 too slow
Office hours. Homework answers online.
Connection to text/more practice.
Class mailing list / forums?
Notation
!
i!{1,...,k}
xi
k!
i=1
xi
!xi
Recap
What is the law of total probability?
What is the multiplication rule?
What is Bayes rule?
Recap
A, B and C are independent events.
What is P(A ∪ B ∪ C)?
Random variables
Why?
Probability is a set function. Kind of tricky to deal with. Easier to deal with functions of numbers.
Want to ignore details of problem (e.g. specific events) and focus on essence.
Real world ➙ mathematical world
Definition
A random variable is a function from the sample space to the real line
Usually given a capital letter like X, Y or Z
The space (or support) of a random variable is the range of the function (analogous to the sample space)
(Usually just call the result a random variable)
Discrete vs. continuous
Space of X is countable = can be mapped to integers = discrete
Space of X is uncountable = can be mapped to real numbers = continuous
(We’ll focus on discrete to start with)
Example
Select a family at random and observe their children. What is the sample space?
What random variables could we create from this experiment?
Example
Pick someone at random out of this class. Measure their height.
What random variables could we create from this experiment?
Random variables
For a countable sample space, usually a count. (But many things we could count)
For a uncountable sample space, usually just the value. (Typically fewer logical possibilities)
Random event Random variable
Anything Numbers
ProbabilityProbability mass
function
Discrete pmf
f(x) > 0 !x " S
!
x!S
f(x) = 1
P (X ! A) =!
x!A
f(x)
Example
• If X=1, f(x) = 0.9
• If X=2,3,4,5 or 6, f(x) = c/x
• (How to write and read more mathematically)
• Is this function is a pmf? What is c?
Why?
Once we have random variable + pmf, we don’t need any more information about the original experiment.
Means we can apply the same tools to completely different types of experiments.
Example
Draw two cards (with replacement) out of a shuffled pack. Let X be the number of hearts and clubs. What is the pmf of X?
Pick two people at random. Let Y be the number of males. What is the pmf of Y?
How are these pmfs related?
Expectation
E[u(X)] =!
x!S
u(x)f(x)
Summarises a function of a random number with a single number
Properties
E[c] = c
E[cu(X)] = cE[u(X)]E[au1(X) + bu2(X)] = aE[u1(X)] + bE[u2(X)]
What are c and u?
All conditions together imply E is a linear operator