Powerpoint slides

advertisement
Gambles in Your Life
Andre Dabrowski
Mathematics and Statistics
Pick the Prize!
One Chance in Three
Prob[Winner]
=#(winning choices) / #(all possible choices)
=
= 1/ 3
/ #(
)
Prob[event]
Gambles in your Life
• P[winner]
• =#(winning choices)/#(all choices)
• =1/#(all choices)
“Lottery 216”
1. Everyone has a sample ticket.
2. Every ticket has 3 numbers, each number
chosen from {1,2,3,4,5,6}.
E.G. 136 or 524 or 652, but not 744.
3. Is 222 more or less likely to win than 452?
4. What is your chance of winning?
Is 222 more or less likely to win
than 452?
•
•
•
•
Put one marker in the box for each ticket.
Mix them up.
Draw one out.
All tickets have the same chance at
winning!
• So 222 has the same chance as 452 of
winning.
What is your chance of winning?
• P[winner]=1/#(all possible choices)
• #(all possible choices)
• = #(choices for first digit)
X #(choices for second digit)
X #(choices for third digit)
• = 6 X 6 X 6 = 216
• P[winner]=1/216.
Lotto 6/49
• P[win by matching all 6 numbers]
• =1/#(all possible choices)
• #(all possible choices)
• = 49 x 48 x 47 x 46 x 45 x 44 / 720
• 1 in 13,983,816 chances!
Which is more likely?
• Matching all
6 numbers in
a 6/49 lottery
• Being struck
by lightning
sometime
during the
year.
1/ 13,983,816
About 1/ 1,000,000
UO Xmas Lottery!
1. Everyone has a ticket.
2. We will draw from a box to
choose the winner.
3. P[winning]=1/216.
Now that we know
HOW to calculate
probabilities, we can
look for interesting
ones to compute.
The Birthday Problem
• There are 365 days in the year.
• The chance that any one person shares your
birthday is 1/365. Pretty small!
• What is the chance at least two people in
this room share birthdays?
P[no matching birthdays]
• P[no match for 2 people]
• =
#(ways of choosing 2 without matching)
#(ways of choosing 2 birthdays)
• = 365 X 364 / 365 X 365 = 364/365.
• P[no match in 5 people]=
#(ways of choosing 5 without matching)
=
#(ways of choosing 5 birthdays)
365 X 364 X 363 X 362 X 361
=
365 X 365 X 365 X 365 X 365
= .97 approximately
• P[no match in 25 people]=
#(ways of choosing 25 without matching)
=
#(ways of choosing 25 birthdays)
365 X 364 X … X 342 X 341
=
365 X 365 X … X 365 X 365
= 0.43 approximately
There is about a 57% chance a class of 25
will have at least two sharing a birthday.
• P[birthday match in k people]
Gambles in your Life
• Small
probabilities can become large if we
do many simultaneous experiments.
• Coincidences are not really coincidences in
large groups.
Yell “Hey Pete” in a crowd and someone will answer!
• How reliable are complex systems?
A system can survive one component failing, but what is the
chance two fail at once?
UO Xmas Birthday Giveaway!
First two birthdays to
match win!
We know
• How to compute
probabilities for simple
games
•How do we compute
probabilities for more
complicated problems?
Simple --8 Heads in a Row
in 8 tosses
• Chance of 8 heads in a row
•= ½  ½  …  ½  ½  ½
• =1/256
• Pretty small!
Harder -- 8 Heads in a Row
somewhere in 100 tosses
• Toss a fair coin 100 times.
• What is the chance of at least 8 heads
in a row somewhere in the string of
100?
• HHTHTTHTTTHTHHTHTHTH
TTTHTHTHTHHTHHHHHHHH
TTHHHTHTHTHHHTTHTHTH
HHTHTHHTHTHTTTHTTTTHT
THTTHTHTHHHTHTHTHTHTT
Monte Carlo Methods
• “Toss” a coin 100 times
• Find the longest string of H’s
• Repeat this 100,000 times
--- 10,000,000 tosses!
• P[at least 8 H’s in a row] is
approximately
• #( at least 8 H’s in a row)/100,000
Monte Carlo Methods
• “Toss” a coin 100 times
using a computer
• Find the longest string of H’s
Repeat this 100,000 times --- 10,000,000 tosses!
using a computer
• P[at least 8 H’s in a row] is
approximately
#(at least 8 H’s in a row)/100,000
Monte Carlo Methods
•
•
•
•
•
•
•
libname here 'h:/XmasLecture';
libname there 'c:/tmp';
%macro dupit;
%do ii=1 %to 100;
x_&ii=(ranuni(0)<.5);
%end;
%mend;
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
data there.runs;
do i=1 to 100000 by 1;
output;
end;
data there.runs; set there.runs;
%dupit;
run;
%macro runs;
%do ii=2 %to 100;
%let iii=%eval(&ii-1);
a=0+run_&iii;
b=0+x_ⅈ
run_&ii=a*(a>0)*(b=1)+(b=1);
runmax=max(runmax,run_&ii);
%end;
%mend;
•data there.runs; set there.runs;
•run_1=0+(x_1=1);
•runmax=0;
•%runs;
•data here.runs; set there.runs;
•keep runmax;
•run;
•data there.runs; run;
•proc gchart data=here.runs;
•axis1 value=(height=10);
•vbar runmax / midpoints = 1 to 15 by 1
type=percent caxis=axis1;
•run;
•proc freq data=here.runs;
•table runmax / nofreq nocumulative;
•run;
•quit;
100,000 Simulations
The FREQ Procedure
runmax
Frequency
Percent
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
2
23
0.02
3
2709
2.71
4
16421
16.42
5
26184
26.18
6
23039
23.04
7
14645
14.65
>7
16979
16.98
100000
100.00
All
P[run of 8 H or more]
= .17 approx.,
= 1/6 >> 1/256.
The chance of 4 or more heads in a row is about 97%.
We can use this to pick out which sequences on the sheet
are unlikely to really have been generated at random.
Gambles in your Life
•
•
•
•
•
“good” days and “bad” days.
Long lineups for no reason.
Design of bridges, power plants.
Weather prediction.
Biological evolution.
Thanks for coming!
Download