2. Estimation and regression

From observations to fitted predictions

Vadim Sokolov

George Mason University

Probability and Making Decision

The secretary problem: also called the matching or marriage problem.

  • You will see TT items, one at a time, from a distribution of types F(x)F(x).
  • You want the maximum. After you pass, you cannot go back.
  • tt is the slot you are in: t=1,…,Tt=1,\ldots,T.
  • Strategy: skip a prefix, then take the next candidate who is better than everyone you have seen.
  • For large TT the prefix is a fraction 1/e1/e of the list: 1e≈0.368. \frac{1}{e} \approx 0.368.

A Simple Example

Say I have a budget to consider T=10T=10 candidates, and they have the following scores (which I do not know)

    1  7  4  5  3  8  10  3  0  11

I decide to screen 3 candidates before making a decision.

  • My best candidate from the screening pool is 7
  • Next is 5 –> dump
  • Next is 3 –> dump
  • Next is 8 –> accept

Probability and Decision - Strategy

What’s your best strategy?

  • Turns out its insensitive to the choice of distribution.
  • Although there is the random sample i.i.d. assumption lurking.
  • You’ll not doubt get married between 1818 and 6060. Waiting 1e\frac{1}{e} along this sequence gets you to age 3333. Then, pick the next best person!

If you take the best so far at tt

  • TT is the length of the list. Ten candidates, T=10T=10.
  • tt is the slot you are looking at. In the example you accepted at t=6t=6.
  • Best so far at tt means better than the first t−1t-1. Candidate 8, after a screen whose best was 7.
  • The overall best is equally likely to sit in any of the TT positions.
  • Overall best implies best of the first tt, so P(overall best∣best so far at t)=P(overall best)P(best so far at t)=1/T1/t=tT. P(\text{overall best}\mid \text{best so far at }t) = \frac{P(\text{overall best})}{P(\text{best so far at }t)} = \frac{1/T}{1/t} = \frac{t}{T}.
  • Take that candidate and you win with probability t/Tt/T. In the example, 6/106/10.
  • If tt is the overall best, it is automatically the best of the first tt. The earlier ranks do not change the ratio.
  • Being the best of the first tt has probability 1/t1/t.

Success under the rr-rule

  • Reject the first rr. Then take the first later candidate who is the best so far.
  • You win only if you take the overall best. Put that person at slot aa. Probability 1/T1/T.
  • You never take them if a≤ra\le r: still screening.
  • If a>ra>r you still miss them whenever someone in r+1,…,a−1r+1,\ldots,a-1 was the best so far. That happens when the best of the first a−1a-1 sits after rr. You would have taken that person and gone home.

Success under the rr-rule

  • So you need the best of the first a−1a-1 to sit in the skipped prefix. Those a−1a-1 ranks are in random order, so their max is equally likely in any of those a−1a-1 slots: ra−1. \frac{r}{a-1}.
  • In the example, r=3r=3. If the overall best is at a=6a=6, the first five are 1,7,4,5,31,7,4,5,3. Their max is 77, in the prefix. Chance 3/53/5.
  • Denominator a−1a-1, not aa: slot aa is already the overall best. The comparison is among the others. P(success)=1T∑a=r+1Tra−1=rT∑b=rT−11b. P(\text{success}) = \frac{1}{T}\sum_{a=r+1}^{T}\frac{r}{a-1} = \frac{r}{T}\sum_{b=r}^{T-1}\frac{1}{b}.
  • Need r≥1r\ge 1. If r=0r=0 you take the first candidate and win with probability 1/T1/T.
  • If nobody after rr is the best so far, you take the last one. That path never wins.

Then r=T/er=T/e

  • For large TT the harmonic sum is a log: rT∑b=rT−11b≈rTlogTr. \frac{r}{T}\sum_{b=r}^{T-1}\frac{1}{b} \approx \frac{r}{T}\log\frac{T}{r}.
  • Differentiate in rr and set the derivative to zero: 1TlogTr−1T=0⇒r=Te. \frac{1}{T}\log\frac{T}{r}-\frac{1}{T}=0 \qquad\Rightarrow\qquad r=\frac{T}{e}.
  • Plug back in: P(success)≈1eloge=1e. P(\text{success})\approx\frac{1}{e}\log e=\frac{1}{e}.
  • About 3737 percent for large TT, approached from above.
  • This rr is best among skip-then-take-the-next-best-so-far rules. The Bellman step says the optimum is of that form.
  • The distribution of the scores never entered. Only the random order of the ranks.

Bellman check

  • p*(xt−1=0)p^*(x_{t-1}=0): chance of eventual success if you have not hired by t−1t-1.
  • At tt the candidate is the best so far with probability 1/t1/t. Take them if t/Tt/T beats the value of continuing.
  • Continuing after you pass on a best-so-far has the same value as continuing after a weaker candidate: the remaining permutation is still uniform. $$ p^(x_{t-1}=0) = ,p^(x_t=0)
  • (t/T,,p^*(x_t=0)). $$
  • Once t/Tt/T wins the max it keeps winning: the hire payoff rises, continuation falls.
  • The recursion telescopes from the end, p*(xT=0)=0p^*(x_T=0)=0, to p*(xt−1=0)=t−1T∑τ=t−1T−11τ, p^*(x_{t-1}=0)=\frac{t-1}{T}\sum_{\tau=t-1}^{T-1}\frac{1}{\tau},
  • That is the success probability of the rule that starts accepting at t−1t-1. Same rr.
  • Bellman: after the first decision the rest of the policy is still optimal.

1/e1/e in a sample of 10001000

The peak is near T/eT/e and height 1/e1/e (Monte Carlo, so the top wiggles).

  • Average quality, not shown, peaks much earlier.
  • Maximizing the chance of the absolute best is not the same as maximizing expected rank.

Decision Trees

Decision Tree

Catastrophe Modeling

You live in a house that is somewhat prone to mud slides.

  • Each rainy season there is a 1% chance of a mud slide occurring.
  • You estimate that a mud slide would do $1 million in damage.
  • You have the option of building a retaining wall that would help reduce the chance of a devastating mud slide. The wall costs $40,000 to build, and if the slide occurs, the wall will hold with a 95% probability.
  • You also have the option of a Geologist’s opinion.

Should you build the wall? Should you use the Geologist’s Test and Bayes Rule?

Decision Tree Setup

Let’s formally solve this as follows:

  • Build a decision tree.
  • The tree will list the probabilities at each node. It will also list any costs there are you going down a particular branch.
  • Finally, it will list the expected cost of going down each branch, so we can see which one has the better risk/reward characteristics.

There’s also the possibility of a further test to see if the wall will hold.

Decision Tree

Mudslide Decision Tree

Testing Option

Let’s include the testing option

  • You also have the option of having a test done to determine whether or not a slide will occur in your location.
  • The test costs $3000 and has the following accuracies. P(T∣Slide)=0.90andP(T‾∣No Slide)=0.85P(T \mid \text{Slide}) = 0.90 \quad \text{and} \quad P(\bar{T} \mid \text{No Slide}) = 0.85

If you choose the test, then should you build the wall?

Bayes Rule for Testing

Bayes Rule is as follows:

  • The initial prior probabilities are P(Slide)=0.01andP(No Slide)=0.99P(\text{Slide}) = 0.01 \quad \text{and} \quad P(\text{No Slide}) = 0.99
  • Therefore P(T)=P(T∣Slide)P(Slide)+P(T∣No Slide)P(No Slide)P(T)=0.90×0.01+0.15×0.99=0.1575\begin{align*} P(T) &= P(T \mid \text{Slide}) P(\text{Slide}) + P(T \mid \text{No Slide}) P(\text{No Slide}) \\ P(T)&= 0.90 \times 0.01 + 0.15 \times 0.99 = 0.1575 \end{align*}

We’ll use this to find our optimal course of action.

Bayes Probabilities - Positive Test

The Bayes probability given a positive test is P(Slide∣T)=P(T∣Slide)P(Slide)P(T)=0.90×0.010.1575=0.0571\begin{align*} P(\text{Slide} \mid T) &= \frac{P(T \mid \text{Slide}) P(\text{Slide})}{P(T)} \\ &= \frac{0.90 \times 0.01}{0.1575} = 0.0571 \end{align*}

Bayes Probabilities - Negative Test

The Bayes probability given a negative test is P(Slide∣T‾)=P(T‾∣Slide)P(Slide)P(T‾)=0.1×0.010.8425=0.001187\begin{align*} P(\text{Slide} \mid \bar{T}) &= \frac{P(\bar{T} \mid \text{Slide}) P(\text{Slide})}{P(\bar{T})} \\ &= \frac{0.1 \times 0.01}{0.8425} \\ &=0.001187 \end{align*}

Compare this to the initial base rate of a 11% chance of having a mud slide.

Probability Lose Everything - Without Testing

You build the wall without testing, what’s the probability that you lose everything?

With the given situation, there is one path (or sequence of events and decisions) that leads to losing everything:

  1. Build without testing (given)
  2. Slide (0.010.01)
  3. Doesn’t hold (0.050.05)

P(losing everything∣build w/o testing)=0.01×0.05=0.0005P(\text{losing everything} \mid \text{build w/o testing}) = 0.01 \times 0.05 = 0.0005

Probability Lose Everything - With Testing

You choose the test, what’s the probability that you’ll lose everything?

There are two paths that lead to losing everything:

  1. First Path: There are three things that have to happen to lose everything Test +ve (P=0.1575P=0.1575), Build, Slide (P=0.0571P= 0.0571), Doesn’t Hold (P=0.05P=0.05)
  2. Second Path: Now you lose everything if Test -ve (P=0.8425P=0.8425), Don’t Build, Slide given negative (P=0.001187P=0.001187)

Conditional Probabilities

For the first path P(first path)=0.1575×0.0571×0.05=0.00045P(\text{first path}) = 0.1575 \times 0.0571 \times 0.05 = 0.00045

For the second path P(second path)=0.8425×0.001187=0.00101P(\text{second path}) = 0.8425 \times 0.001187 = 0.00101

Hence putting it all together P(losing everything∣testing)=0.00045+0.00101=0.00146P(\text{losing everything} \mid \text{testing}) = 0.00045 + 0.00101 = 0.00146

Risk and Reward

Risk-Return Trade-off

Choice Expected Cost Risk P
Don’t Build $10,000 0.01 1 in 100
Build w/o testing $40,500 0.0005 1 in 2000
Test $10,760 0.00146 1 in 700

Expected Cost: Fee + Build + Loss

Expected cost: 3+40×0.1575+1000×0.001463 + 40\times 0.1575+ 1000\times 0.00146 or $10,760

What do you choose?

Estimation

Three situations

Map for the hour

    1. No data
  • No sample. You post a price.
  • Coin, a bet, coherence.
  • Secretary. Mudslide prior.
    1. Good data
  • n/N you can trust.
  • More of the same sample, tighter around the right number.
  • Alpha particles: the worked example.
    1. Bad data
  • Looks like 2. Most dangerous.
  • Tiny interval, wrong sample.
  • Literary Digest, WHI, Spirit.
  • The trap is mixing 2 and 3. The machine sounds like 2.

1. No data

  • No sample from the process you will decide for.
  • Probability is a language for uncertainty. Usually lack of information, not a property of the coin.
  • Operational answer: a price you would bet at.
  • The number has to cohere. Otherwise someone books you.

How many coins in my pocket?