predicting the outcome of an election - nyu courantcfgranda/pages/stuff/election.pdf · predicting...
TRANSCRIPT
![Page 1: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/1.jpg)
Predicting the Outcome of an Election
Carlos Fernandez-Grandawww.cims.nyu.edu/~cfgranda
cSplash 2018
![Page 2: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/2.jpg)
Acknowledgements
Support by NSF award DMS-1616340
![Page 3: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/3.jpg)
Election
I Candidate against candidate
I New York: 8 million
I Goal: Estimate fraction of people who will vote for
![Page 4: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/4.jpg)
Experiment
I True fraction is 0.547
I We ask 1000 people at random
I Outcome:
545! (estimate: 0.545)
I Did we get lucky?
![Page 5: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/5.jpg)
Experiment
I True fraction is 0.547
I We ask 1000 people at random
I Outcome: 545! (estimate: 0.545)
I Did we get lucky?
![Page 6: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/6.jpg)
Experiment
I True fraction is 0.547
I We ask 1000 people at random
I Outcome: 545! (estimate: 0.545)
I Did we get lucky?
![Page 7: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/7.jpg)
Poll of 1 000 people (repeated 10 000 times)
![Page 8: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/8.jpg)
Poll of 10 000 people (repeated 10 000 times)
![Page 9: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/9.jpg)
Poll of 100 000 people (repeated 10 000 times)
![Page 10: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/10.jpg)
Question to think about
Does the total population (8 million) matter?
![Page 11: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/11.jpg)
Interesting phenomenon
# voters in poll#people in the poll
is close to# voters# people
Aim of the talk: Understand why this happens
![Page 12: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/12.jpg)
Not so easy
# voters in poll changes every time: its value is uncertain
We need to reason probabilistically
We need mathematical tools to analyze uncertain quantities
![Page 13: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/13.jpg)
Random variable
Mathematical objects that model uncertain quantities
A random variable X has a set of possible outcomes
Sampling X results in one of those outcomes
![Page 14: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/14.jpg)
Probability
Maps outcomes to a number between 0 and 1
The probability of an outcome quantifies how likely it is
Intuitively
P (outcome i) =#samples equal to outcome i
# samples
when the number of samples is very large
![Page 15: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/15.jpg)
Events
We can group outcomes in sets called events
An event occurs if we sample an outcome belonging to the event
X ∈ {0, 1}, Y ≤ 10, Z ≥ 1.2
The probability of an event quantifies how likely it is
![Page 16: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/16.jpg)
Probability
Intuitively
P (event) =#times event happens
# samples
when the number of samples is very large
P (X ∈ {0, 3}) ≈ # samples equal to 0 or 3# samples of X
![Page 17: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/17.jpg)
Properties of probability
Probability is nonnegative, like mass or length
![Page 18: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/18.jpg)
Properties of probability
If events can’t happen simultaneously, we can add their probabilities
P (X ∈ {0, 4, 7}) = P (X = 0) + P (X ∈ {4, 7})
Makes sense:
P (X ∈ {0, 4, 7}) ≈ # samples equal to 0, 4 or 7# samples of X
=# samples equal to 0 +# samples equal to 4 or 7
# samples of X≈ P (X = 0) + P (X ∈ {4, 7})
Also like mass or length
![Page 19: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/19.jpg)
Properties of probability
If events can’t happen simultaneously, we can add their probabilities
P (X ∈ {0, 4, 7}) = P (X = 0) + P (X ∈ {4, 7})
Makes sense:
P (X ∈ {0, 4, 7}) ≈ # samples equal to 0, 4 or 7# samples of X
=# samples equal to 0 +# samples equal to 4 or 7
# samples of X≈ P (X = 0) + P (X ∈ {4, 7})
Also like mass or length
![Page 20: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/20.jpg)
Properties of probability
If events can’t happen simultaneously, we can add their probabilities
P (X ∈ {0, 4, 7}) = P (X = 0) + P (X ∈ {4, 7})
Makes sense:
P (X ∈ {0, 4, 7}) ≈ # samples equal to 0, 4 or 7# samples of X
=# samples equal to 0 +# samples equal to 4 or 7
# samples of X
≈ P (X = 0) + P (X ∈ {4, 7})
Also like mass or length
![Page 21: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/21.jpg)
Properties of probability
If events can’t happen simultaneously, we can add their probabilities
P (X ∈ {0, 4, 7}) = P (X = 0) + P (X ∈ {4, 7})
Makes sense:
P (X ∈ {0, 4, 7}) ≈ # samples equal to 0, 4 or 7# samples of X
=# samples equal to 0 +# samples equal to 4 or 7
# samples of X≈ P (X = 0) + P (X ∈ {4, 7})
Also like mass or length
![Page 22: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/22.jpg)
Properties of probability
If events can’t happen simultaneously, we can add their probabilities
P (X ∈ {0, 4, 7}) = P (X = 0) + P (X ∈ {4, 7})
Makes sense:
P (X ∈ {0, 4, 7}) ≈ # samples equal to 0, 4 or 7# samples of X
=# samples equal to 0 +# samples equal to 4 or 7
# samples of X≈ P (X = 0) + P (X ∈ {4, 7})
Also like mass or length
![Page 23: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/23.jpg)
Properties of probability
The probability of all events that can’t happen simultaneously adds to one
m∑i=1
P (X = oi ) = 1
where {o1, . . . , om} are the possible outcomes of X
Not like mass or length!
![Page 24: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/24.jpg)
Properties of probability
Makes sense:m∑i=1
P (X = oi )
≈m∑i=1
# samples equal to oi# samples of X
=# samples equal to o1 +# samples equal to o2 + · · ·+# samples equal to om
# samples of X
=# samples of X# samples of X
= 1
![Page 25: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/25.jpg)
Properties of probability
Makes sense:m∑i=1
P (X = oi )
≈m∑i=1
# samples equal to oi# samples of X
=# samples equal to o1 +# samples equal to o2 + · · ·+# samples equal to om
# samples of X
=# samples of X# samples of X
= 1
![Page 26: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/26.jpg)
Properties of probability
Makes sense:m∑i=1
P (X = oi )
≈m∑i=1
# samples equal to oi# samples of X
=# samples equal to o1 +# samples equal to o2 + · · ·+# samples equal to om
# samples of X
=# samples of X# samples of X
= 1
![Page 27: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/27.jpg)
Modeling a coin flip
When we flip a coin, it lands heads a fraction p of the time
I Possible outcomes?
0 (tails) or 1 (heads)
I Probability of outcomes?
P (X = 1) = p
P (X = 0) = 1− p
![Page 28: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/28.jpg)
Modeling a coin flip
When we flip a coin, it lands heads a fraction p of the time
I Possible outcomes? 0 (tails) or 1 (heads)
I Probability of outcomes?
P (X = 1) =
p
P (X = 0) =
1− p
![Page 29: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/29.jpg)
Modeling a coin flip
When we flip a coin, it lands heads a fraction p of the time
I Possible outcomes? 0 (tails) or 1 (heads)
I Probability of outcomes?
P (X = 1) = p
P (X = 0) =
1− p
![Page 30: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/30.jpg)
Modeling a coin flip
When we flip a coin, it lands heads a fraction p of the time
I Possible outcomes? 0 (tails) or 1 (heads)
I Probability of outcomes?
P (X = 1) = p
P (X = 0) = 1− p
![Page 31: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/31.jpg)
Election
We poll a voter at random from a population of T people
Chosen voter is a random variable X
Possible outcomes? 1, 2, . . . , T
Assumption: We are equally likely to pick any voter
Probability that we pick a specific person?
![Page 32: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/32.jpg)
Election
All possible outcomes must sum to one
T∑i=1
P (X = i) = 1
and
P (X = 1) = P (X = 2) = · · · = P (X = T )
=1T
![Page 33: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/33.jpg)
Election
All possible outcomes must sum to one
T∑i=1
P (X = i) = 1
and
P (X = 1) = P (X = 2) = · · · = P (X = T ) =1T
![Page 34: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/34.jpg)
Election
Pick a voter at random from T people from which # are voters
New random variable
V = 1 if voter is voter
otherwise V = 0
Probability that we pick a voter? P (V = 1)
![Page 35: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/35.jpg)
Election
Let’s order the voters, first # are voters
P (V = 1) = P (X ∈ {1, . . . ,# })
=
#∑i=1
P (X = i)
=#
T
Just like coin flip with p = # /T
![Page 36: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/36.jpg)
Election
Let’s order the voters, first # are voters
P (V = 1) = P (X ∈ {1, . . . ,# })
=
#∑i=1
P (X = i)
=#
T
Just like coin flip with p = # /T
![Page 37: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/37.jpg)
Election
Let’s order the voters, first # are voters
P (V = 1) = P (X ∈ {1, . . . ,# })
=
#∑i=1
P (X = i)
=#
T
Just like coin flip with p =
# /T
![Page 38: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/38.jpg)
Election
Let’s order the voters, first # are voters
P (V = 1) = P (X ∈ {1, . . . ,# })
=
#∑i=1
P (X = i)
=#
T
Just like coin flip with p = # /T
![Page 39: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/39.jpg)
Election
If T = 8 million and the fraction of voters is 0.547
What is the probability that we choose a voter?
Does this depend on T?
![Page 40: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/40.jpg)
Multiple random variables
We can consider several random variables at the same time
Every time we sample, we sample all the random variables
Events can include any of the random variables
{X = 0 and Y ≤ 10}, {Z = 1.2 or W ∈ {10, 21}}
![Page 41: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/41.jpg)
Probability
The probability of the event still quantifies how likely it is
Same intuition
P (event) =#times event happens
# samples
when the number of samples is very large
P (X = 0 and Y ≤ 10) ≈ # samples for which X = 0 and Y ≤ 10# samples of (X ,Y )
![Page 42: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/42.jpg)
Conditional probability
If we know an event B (for example Y ≤ 10)
How likely is that another event A (for example X = 0) also happened?
P (B |A), the conditional probability of B given A
![Page 43: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/43.jpg)
Conditional probability
Intuition
P (event B | event A) = #samples for which A and B happen# samples for which A happens
when the number of samples is very large
P (X = 0 |Y ≤ 10) ≈ # samples for which X = 0 and Y ≤ 10# samples for which Y ≤ 10
![Page 44: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/44.jpg)
Chain rule
P (A and B) = P (A)P (B |A)
Makes sense:
P (A)P (B |A) ≈ # A happens# samples
· # A and B happen# A happens
=# A and B happen
# samples≈ P (A and B)
![Page 45: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/45.jpg)
Chain rule
P (A and B) = P (A)P (B |A)
Makes sense:
P (A)P (B |A) ≈ # A happens# samples
· # A and B happen# A happens
=# A and B happen
# samples≈ P (A and B)
![Page 46: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/46.jpg)
Independence
If knowing that A happened does not affect how likely B is
A and B are independent
P (B |A) = P (B)
In that case
P (A and B) = P (A)P (B |A) = P (A)P (B)
![Page 47: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/47.jpg)
Modeling coin flips
When we flip a coin, it lands heads a fraction p of the time
If we flip it n times, what is the probability that k flips are heads?
Assumptions:
I Probability of heads in a single flip is p
I Flips are independent
![Page 48: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/48.jpg)
Modeling coin flips
We model the problem using random variables:
Vi = 1 if ith flip is heads, 0 if it isn’t
V1, V2, . . . , Vn are independent
S = V1 + · · ·+ Vn, number of heads
![Page 49: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/49.jpg)
Example
3 flips, probability of 2 heads?
P (S = 2) = P( {V1 = 1,V2 = 1,V3 = 0}or {V1 = 1,V2 = 0,V3 = 1}or {V1 = 0,V2 = 1,V3 = 1})
![Page 50: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/50.jpg)
Example
P (V1 = 1 and V2 = 1 and V3 = 0) = P (V1 = 1)P (V2 = 1)P (V3 = 0)
= p2 (1− p)
P (V1 = 0 and V2 = 1 and V3 = 1) ? Does not depend on order!
In general, k heads and n − k tails in fixed order
P (k heads and n − k tails) = pk (1− p)n−k
![Page 51: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/51.jpg)
Example
P (V1 = 1 and V2 = 1 and V3 = 0) = P (V1 = 1)P (V2 = 1)P (V3 = 0)
= p2 (1− p)
P (V1 = 0 and V2 = 1 and V3 = 1) ?
Does not depend on order!
In general, k heads and n − k tails in fixed order
P (k heads and n − k tails) = pk (1− p)n−k
![Page 52: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/52.jpg)
Example
P (V1 = 1 and V2 = 1 and V3 = 0) = P (V1 = 1)P (V2 = 1)P (V3 = 0)
= p2 (1− p)
P (V1 = 0 and V2 = 1 and V3 = 1) ? Does not depend on order!
In general, k heads and n − k tails in fixed order
P (k heads and n − k tails) = pk (1− p)n−k
![Page 53: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/53.jpg)
Example
P (V1 = 1 and V2 = 1 and V3 = 0) = P (V1 = 1)P (V2 = 1)P (V3 = 0)
= p2 (1− p)
P (V1 = 0 and V2 = 1 and V3 = 1) ? Does not depend on order!
In general, k heads and n − k tails in fixed order
P (k heads and n − k tails) = pk (1− p)n−k
![Page 54: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/54.jpg)
Example
3 flips, probability of 2 heads?
P (S = 2) = P( {V1 = 1,V2 = 1,V3 = 0}or {V1 = 1,V2 = 0,V3 = 1}or {V1 = 0,V2 = 1,V3 = 1})
=3p2(1− p)
![Page 55: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/55.jpg)
Modeling coin flips
In general
P (S = k) = # combinations of k heads in n flips · P (k heads in fixed order)
=
(n
k
)pk (1− p)n−k
(n
k
):=
n!
k! (n − k)!
S is a binomial random variable with parameters n and p
![Page 56: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/56.jpg)
Binomial random variable n = 100, p = 0.547
40 45 50 55 60 65 70
0
2
4
6
8
·10−2
k
P(S
=k)
![Page 57: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/57.jpg)
Binomial random variable n = 1000, p = 0.547
400 450 500 550 600 650 700
0
0.5
1
1.5
2
2.5
·10−2
k
P(S
=k)
![Page 58: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/58.jpg)
Election
Population of T people with # voters
We poll n voters at random
How many are voters? Random variable S
Assumption 1: We are equally likely to pick any voter every time we poll
Assumption 2: Picks are all independent
What kind of random variable is S?
![Page 59: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/59.jpg)
Election
S is binomial with parameters n and # /T
But we are interested in fraction of voters S/n !
P(S
n=
k
n
)=
P (S = k)
=
(n
k
)pk (1− p)n−k
We can compute exact probability of poll outcome for any n!
![Page 60: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/60.jpg)
Election
S is binomial with parameters n and # /T
But we are interested in fraction of voters S/n !
P(S
n=
k
n
)= P (S = k)
=
(n
k
)pk (1− p)n−k
We can compute exact probability of poll outcome for any n!
![Page 61: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/61.jpg)
Election
S is binomial with parameters n and # /T
But we are interested in fraction of voters S/n !
P(S
n=
k
n
)= P (S = k)
=
(n
k
)pk (1− p)n−k
We can compute exact probability of poll outcome for any n!
![Page 62: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/62.jpg)
Fraction of voters in poll, n = 100, # /T = 0.547
0.4 0.45 0.5 0.547 0.6 0.65 0.7
0
2
4
6
8
·10−2
x
P(S
/n=x)
![Page 63: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/63.jpg)
Binomial random variable n = 1000, # /T = 0.547
0.4 0.45 0.5 0.547 0.6 0.65 0.7
0
0.5
1
1.5
2
2.5
·10−2
x
P(S
/n=x)
![Page 64: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/64.jpg)
Mean
Average of a random variable
E (X ) =∑i=1
oiP (X = oi )
= o1P (X = o1) + o2P (X = o2) + · · ·+ omP (X = om)
where {o1, . . . , om} are the possible outcomes of X
![Page 65: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/65.jpg)
The mean is the center of mass of the probabilities
0 5 10 15 200
5 · 10−2
0.1
0.15
0.2
k
P(X
=k)
![Page 66: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/66.jpg)
Election
Population of T people with # voters
We poll n voters at random
S = # of voters in poll
What is the average estimate S/n?
![Page 67: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/67.jpg)
Modeling a coin flip
When we flip a coin, it lands heads a fraction p of the time
Random variable X equal to 0 (tails) or 1 (heads)
Mean
E (X ) =
0 · P (X = 0) + 1 · P (X = 1)= p
![Page 68: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/68.jpg)
Modeling a coin flip
When we flip a coin, it lands heads a fraction p of the time
Random variable X equal to 0 (tails) or 1 (heads)
Mean
E (X ) = 0 · P (X = 0) + 1 · P (X = 1)
= p
![Page 69: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/69.jpg)
Modeling a coin flip
When we flip a coin, it lands heads a fraction p of the time
Random variable X equal to 0 (tails) or 1 (heads)
Mean
E (X ) = 0 · P (X = 0) + 1 · P (X = 1)= p
![Page 70: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/70.jpg)
Mean of sum
The sum of the averages is the average of the sums
E (X + Y ) =
m∑i=1
m∑j=1
(oi + o ′j
)P(X = oi ,Y = o ′j
)=
m∑i=1
m∑j=1
oiP(X = oi ,Y = o ′j
)+
m∑i=1
m∑j=1
o ′jP(X = oi ,Y = o ′j
)=
m∑i=1
oi
m∑j=1
P(X = oi ,Y = o ′j
)+
m∑j=1
o ′j
m∑i=1
P(X = oi ,Y = o ′j
)=
m∑i=1
oiP (X = oi ) +m∑j=1
o ′jP(Y = o ′j
)
= E (X ) + E (Y )
![Page 71: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/71.jpg)
Mean of sum
The sum of the averages is the average of the sums
E (X + Y ) =m∑i=1
m∑j=1
(oi + o ′j
)P(X = oi ,Y = o ′j
)=
m∑i=1
m∑j=1
oiP(X = oi ,Y = o ′j
)+
m∑i=1
m∑j=1
o ′jP(X = oi ,Y = o ′j
)=
m∑i=1
oi
m∑j=1
P(X = oi ,Y = o ′j
)+
m∑j=1
o ′j
m∑i=1
P(X = oi ,Y = o ′j
)=
m∑i=1
oiP (X = oi ) +m∑j=1
o ′jP(Y = o ′j
)= E (X ) + E (Y )
![Page 72: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/72.jpg)
Election
S is a sum of n coin flips with p = # /T
S =n∑
i=1
Vi
E (S) = E
(n∑
i=1
Vi
)
=n∑
i=1
E (Vi )
=n #
T
What about Sn ?
![Page 73: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/73.jpg)
Election
S is a sum of n coin flips with p = # /T
S =n∑
i=1
Vi
E (S) = E
(n∑
i=1
Vi
)
=n∑
i=1
E (Vi )
=n #
T
What about Sn ?
![Page 74: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/74.jpg)
Election
S is a sum of n coin flips with p = # /T
S =n∑
i=1
Vi
E (S) = E
(n∑
i=1
Vi
)
=n∑
i=1
E (Vi )
=n #
T
What about Sn ?
![Page 75: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/75.jpg)
Election
S is a sum of n coin flips with p = # /T
S =n∑
i=1
Vi
E (S) = E
(n∑
i=1
Vi
)
=n∑
i=1
E (Vi )
=n #
T
What about Sn ?
![Page 76: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/76.jpg)
Expectation of scaled random variable
The average of a scaled random variable is just the scaled average
E (c X ) =
m∑i=1
c oiP (X = oi )
= cm∑i=1
oiP (X = oi )
= c E (X )
![Page 77: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/77.jpg)
Expectation of scaled random variable
The average of a scaled random variable is just the scaled average
E (c X ) =m∑i=1
c oiP (X = oi )
= cm∑i=1
oiP (X = oi )
= c E (X )
![Page 78: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/78.jpg)
Expectation of scaled random variable
The average of a scaled random variable is just the scaled average
E (c X ) =m∑i=1
c oiP (X = oi )
= cm∑i=1
oiP (X = oi )
= c E (X )
![Page 79: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/79.jpg)
Expectation of scaled random variable
The average of a scaled random variable is just the scaled average
E (c X ) =m∑i=1
c oiP (X = oi )
= cm∑i=1
oiP (X = oi )
= c E (X )
![Page 80: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/80.jpg)
Election
Population of T people with # voters
We poll n voters at random
S = # of voters
What is the average estimate S/n?
E (S) =n #
T
E (S/n) =
#
T(!)
![Page 81: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/81.jpg)
Election
Population of T people with # voters
We poll n voters at random
S = # of voters
What is the average estimate S/n?
E (S) =n #
T
E (S/n) =#
T(!)
![Page 82: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/82.jpg)
Fraction of voters in poll, n = 100, # /T = 0.547
0.547
0
2
4
6
8
·10−2
x
P(S
/n=x)
![Page 83: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/83.jpg)
Fraction of voters in poll n = 1000, # /T = 0.547
0.547
0
1
2
·10−2
x
P(S
/n=x)
![Page 84: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/84.jpg)
Variance
Square deviation from D := (X − E (X ))2
The variance is the mean of the square deviation
Var (X ) = E (Y )
Standard deviation σX :=√
Var (X )
![Page 85: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/85.jpg)
Standard deviation ≈ average variation around mean
0 5 10 15 200
5 · 10−2
0.1
0.15
0.2
k
![Page 86: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/86.jpg)
Election
Population of T people with # voters
We poll n voters at random
On average
E (S/n) =#
T
Standard deviation σS/n quantifies average deviation from truth
Key question: Does σS/n decrease as n grows?
![Page 87: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/87.jpg)
Coin flip
Var (X ) = E((X − E (X ))2
)
=∑
possible values of (X − E (X ))2 · corresponding probability
= (1− p)2 p + p2 (1− p)
= (1− p) p
![Page 88: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/88.jpg)
Coin flip
Var (X ) = E((X − E (X ))2
)=∑
possible values of (X − E (X ))2 · corresponding probability
= (1− p)2 p + p2 (1− p)
= (1− p) p
![Page 89: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/89.jpg)
Coin flip
Var (X ) = E((X − E (X ))2
)=∑
possible values of (X − E (X ))2 · corresponding probability
= (1− p)2 p + p2 (1− p)
= (1− p) p
![Page 90: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/90.jpg)
Coin flip
Var (X ) = E((X − E (X ))2
)=∑
possible values of (X − E (X ))2 · corresponding probability
= (1− p)2 p + p2 (1− p)
= (1− p) p
![Page 91: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/91.jpg)
Variance of a sum
Var (X + Y ) =
E((X + Y − E (X + Y ))2
)= E
((X − E (X ))2
)+ E
((Y − E (Y ))2
)+ 2E ((X − E (X )) (Y − E (Y )))
= E((X − E (X ))2
)+ E
((Y − E (Y ))2
)+ 2E (XY )− 2E (X )E (Y )
= Var (X ) + Var (Y ) + 2E (XY )− 2E (X )E (Y )
![Page 92: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/92.jpg)
Variance of a sum
Var (X + Y ) = E((X + Y − E (X + Y ))2
)= E
((X − E (X ))2
)+ E
((Y − E (Y ))2
)+ 2E ((X − E (X )) (Y − E (Y )))
= E((X − E (X ))2
)+ E
((Y − E (Y ))2
)+ 2E (XY )− 2E (X )E (Y )
= Var (X ) + Var (Y ) + 2E (XY )− 2E (X )E (Y )
![Page 93: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/93.jpg)
Variance of a sum
If X and Y are independent, then
E (XY ) =
m∑i=1
m∑j=1
oio′jP(X = oi ,Y = o ′j
)=
m∑i=1
m∑j=1
oio′jP (X = oi )P
(Y = o ′j
)= E (X )E (Y )
Variance of X + Y if Y := −X
Not true if not independent!
![Page 94: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/94.jpg)
Variance of a sum
If X and Y are independent, then
E (XY ) =m∑i=1
m∑j=1
oio′jP(X = oi ,Y = o ′j
)
=m∑i=1
m∑j=1
oio′jP (X = oi )P
(Y = o ′j
)= E (X )E (Y )
Variance of X + Y if Y := −X
Not true if not independent!
![Page 95: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/95.jpg)
Variance of a sum
If X and Y are independent, then
E (XY ) =m∑i=1
m∑j=1
oio′jP(X = oi ,Y = o ′j
)=
m∑i=1
m∑j=1
oio′jP (X = oi )P
(Y = o ′j
)
= E (X )E (Y )
Variance of X + Y if Y := −X
Not true if not independent!
![Page 96: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/96.jpg)
Variance of a sum
If X and Y are independent, then
E (XY ) =m∑i=1
m∑j=1
oio′jP(X = oi ,Y = o ′j
)=
m∑i=1
m∑j=1
oio′jP (X = oi )P
(Y = o ′j
)= E (X )E (Y )
Variance of X + Y if Y := −X
Not true if not independent!
![Page 97: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/97.jpg)
Election
S is a sum of n coin flips with p = # /T
S =n∑
i=1
Vi
Var (S) =
Var
(n∑
i=1
Vi
)
=n∑
i=1
Var (Vi )
= np (1− p)
What about S/n ?
![Page 98: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/98.jpg)
Election
S is a sum of n coin flips with p = # /T
S =n∑
i=1
Vi
Var (S) = Var
(n∑
i=1
Vi
)
=n∑
i=1
Var (Vi )
= np (1− p)
What about S/n ?
![Page 99: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/99.jpg)
Election
S is a sum of n coin flips with p = # /T
S =n∑
i=1
Vi
Var (S) = Var
(n∑
i=1
Vi
)
=n∑
i=1
Var (Vi )
= np (1− p)
What about S/n ?
![Page 100: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/100.jpg)
Election
S is a sum of n coin flips with p = # /T
S =n∑
i=1
Vi
Var (S) = Var
(n∑
i=1
Vi
)
=n∑
i=1
Var (Vi )
= np (1− p)
What about S/n ?
![Page 101: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/101.jpg)
Election
S is a sum of n coin flips with p = # /T
S =n∑
i=1
Vi
Var (S) = Var
(n∑
i=1
Vi
)
=n∑
i=1
Var (Vi )
= np (1− p)
What about S/n ?
![Page 102: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/102.jpg)
Variance
Var (c X ) = E((c X − E (c X ))2
)
= E(c2 (X − E (X ))2
)= c2E
((X − E (X ))2
)= c2 Var (X )
![Page 103: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/103.jpg)
Variance
Var (c X ) = E((c X − E (c X ))2
)= E
(c2 (X − E (X ))2
)
= c2E((X − E (X ))2
)= c2 Var (X )
![Page 104: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/104.jpg)
Variance
Var (c X ) = E((c X − E (c X ))2
)= E
(c2 (X − E (X ))2
)= c2E
((X − E (X ))2
)
= c2 Var (X )
![Page 105: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/105.jpg)
Variance
Var (c X ) = E((c X − E (c X ))2
)= E
(c2 (X − E (X ))2
)= c2E
((X − E (X ))2
)= c2 Var (X )
![Page 106: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/106.jpg)
Election
S is a sum of n coin flips with p = # /T
S =n∑
i=1
Vi
Var(S
n
)
=1n2 Var (S)
=np(1− p)
n2
=p (1− p)
n
σS/n =
√p (1− p)
n
Decreases as n grows!
![Page 107: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/107.jpg)
Election
S is a sum of n coin flips with p = # /T
S =n∑
i=1
Vi
Var(S
n
)=
1n2 Var (S)
=np(1− p)
n2
=p (1− p)
n
σS/n =
√p (1− p)
n
Decreases as n grows!
![Page 108: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/108.jpg)
Election
S is a sum of n coin flips with p = # /T
S =n∑
i=1
Vi
Var(S
n
)=
1n2 Var (S)
=np(1− p)
n2
=p (1− p)
n
σS/n =
√p (1− p)
n
Decreases as n grows!
![Page 109: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/109.jpg)
Election
S is a sum of n coin flips with p = # /T
S =n∑
i=1
Vi
Var(S
n
)=
1n2 Var (S)
=np(1− p)
n2
=p (1− p)
n
σS/n =
√p (1− p)
n
Decreases as n grows!
![Page 110: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/110.jpg)
Election
S is a sum of n coin flips with p = # /T
S =n∑
i=1
Vi
Var(S
n
)=
1n2 Var (S)
=np(1− p)
n2
=p (1− p)
n
σS/n =
√p (1− p)
n
Decreases as n grows!
![Page 111: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/111.jpg)
Fraction of voters in poll, n = 100, # /T = 0.547
0.547
0
2
4
6
8
·10−2
x
P(S
/n=x)
![Page 112: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/112.jpg)
Fraction of voters in poll, n = 1000, # /T = 0.547
0.547
0
1
2
·10−2
x
P(S
/n=x)
![Page 113: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/113.jpg)
Poll of 1 000 people (repeated 10 000 times)
![Page 114: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/114.jpg)
Poll of 10 000 people (repeated 10 000 times)
![Page 115: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/115.jpg)
Poll of 100 000 people (repeated 10 000 times)
![Page 116: Predicting the Outcome of an Election - NYU Courantcfgranda/pages/stuff/election.pdf · Predicting the Outcome of an Election Carlos Fernandez-Granda cfgranda cSplash2018](https://reader034.vdocuments.us/reader034/viewer/2022042811/5fa51853f00224734d4864ad/html5/thumbnails/116.jpg)
Some elections are difficult to predict
I It’s very hard to sample a population uniformly
I Also hard to make samples independent
I Often not interested in just popular vote (e.g. presidential election)