In the last video we talked about the situation where I'm
taking 9 shots on a goal.
We knew my probability of making any given shot, and what
we wanted to do is figure out the probability distribution of
me making k shots, in general.
We defined our random variable, x, as the number
of shots I make out of 6.
So I realized in that last example and that example is
right back here, that the math gets a little hairy.
You're dealing with 0.7 then times 0.3 to the fifth
and all of that.
So it got a little complicated and what better thing to do if
you have numbers like this, even better than the
calculator than to use Excel.
And you'll see that Excel is a fairly powerful tool for
probability and statistics.
And in general, for a lot of types of simulations.
If you don't want to actually write serious code you can
actually do fairly serious things with something as
seemingly not so simple, or not so serious as Excel.
But it's actually quite serious.
So let's see.
So let's say that I'm going to take-- let's define n.
I'm going to say that that is, I'm going to take 6 shots.
The probability of me making any shot I'll say is 0.3.
That's what we did in the last video.
The probability of a miss, let me actually write it a
little bit more explicitly.
Probability of a make is equal to 0.3 and the probability of a
miss I'm going to write-- and instead of just writing 0.7
there because we know it is, let's just it a little bit
dependent on the first one.
So write out the formula, we'll say that's equal to 1 minus--
and then we'll select this cell right here.
It's equal to 1 minus the probability that I make a
shot, And notice it just calculated it for us, 0.7.
Let me zoom in a little bit.
There you go.
That might be easier for you to read.
Because I know it gets really small on YouTube.
And this is neat because now if we wanted to see what happens
when this becomes 0.2 that automatically
calculates to 0.8.
So that's neat.
Let's just put it back to 0.3.
And now let's do a bunch of rows so that we can calculate
the probability that our random variable, x, could be 0
shots or 1 shot or whatever.
So let's say that k-- let me make a row called k.
So that's the number of shots we need to make.
So 0, 1, 2, 3, 4, 5, 6.
You can't see the sixth one right now, let me just go
up here and now you can see everything.
And then we need to figure out the binomial coefficient.
Well actually, let's do it first.
Let's say the probability of making any one of those,
any one way of getting no shots, or any one way of
getting exactly 3 shots.
So that's going to be the probability of a make.
So you're going to make it.
You're going to make k shots times the probability
of a miss.
So if you make k shots, how many do you miss?
You miss n minus k.
And I'm not doing anything fancy in Excel right here.
I'm just kind of writing a label that hopefully is a
little intuitive for you.
So this is the probability-- this column is going to be-- in
this cell right here is going to be the probability that any
one particular way of making 3 shots and missing 3 shots.
It's going to go in that cell eventually.
And then you need to know that you needed the
binomial coefficient.
It's going to look a little bit messy now.
So you want n choose k.
So essentially this row is going to say, what's the
probability for example, in this cell right here we'll have
the probability of making the first and missing the next 5,
or missing the first 5 and making the last 1.
They're all going to be the same probability.
You're going to have 1 make and 5 misses.
And then, this cell we're going to say, well, how
many different ways can I make just 1 out of 6?
And that's why I'm going to choose 1 out of 6.
k is 1 and n is 6.
That's going to go there.
And then we can calculate what the probability that our random
variable is equal to k, is equal to this value.
And it looks all fancy, but it's exactly what we did in
the last video with my little doodle tool that I use.
Which is actually just Microsoft Paint for those of
you wondering because I get a lot of e-mails and I'm tired
of saying it's just Microsoft Paint.
All right, so what's the probability that I make 0
and I miss 6 because that's what they're saying here.
So this is going to be the probability of me making a
shot-- and I'll put those dollar signs.
That kind of fixes it on this cell.
The probability that I make a shot to the kth power.
So I make 0 shots times the probability that I miss a shot.
Put those dollar signs there so that it fixes on that cell--
to the n minus k power.
In this case it would be the sixth power.
I miss 6 six shots, so to the-- let me put it
in parentheses-- n.
Let me fix on that cell.
n minus k power.
And there you go there.
That's the probability for example, of me making the
first and missing the next 5.
Or this could be the probability of me getting the
first shot, then missing the second, and getting
the last 4 missed.
So any of one of those situations.
And how many of those situations are there?
Well that's n choose k.
So that's equal to-- n choose k-- that's the
same thing we did before.
That's all this factorial stuff here.
That's n choose k.
So I'm just going to express the binomial coefficient
expression in Excel.
So it's a factorial of how many we're choosing from, how many
shots we're taking, and the Excel function for
that is fact.
So we'll take the factorial of 6 and we'll divide it by--
put a parentheses here.
The factorial of k times the factorial of n.
Let me fix that n.
Minus k.
And I know it fell off.
n minus k.
You put some parentheses there, so the parentheses match up.
Actually, this what fixes on this cell Let me
put an F4 there.
And then there you go.
There's only one way to choose 0 things out of 6 things.
That's what that tells us.
And then the probability that my random variable is equal to
k, or in this case, that I make exactly 0 shots is equal to the
probability of any of the specific ways of making 0 shots
times the number of those ways there are times that.
So that's the probability of making 0 shots.
And this is a cool thing about Excel, we can now
select these cells.
And just go into this right hand corner, just drag it
down, and it'll do that calculation for all of them.
And this is neat because it calculated the
binomial coefficients.
This is 6 choose 3.
n is 6, k is 3.
This is 6 choose 3 is 20.
It's nice and symmetric like you would expect.
But the probabilities aren't that symmetric because
we have 0.3 and 0.7.
So it's not like the flipping a coin example that was
0.5 on either side.
Sorry, these aren't symmetric and then when you multiply
these, of course, these don't looks symmetric.
But it's hard to look at these numbers, so actually, let's
just use the powers of Excel to graph this probability
distribution.
So let's say insert chart.
I'm always, I'm clumsy at inserting charts,
so let me see.
The data-- I think this is how I do it.
I select the data.
There you go.
And then I need to select the label, the category x labels.
OK, that's going to be that right there.
And then let's see.
Next, that looks good.
I don't want to have anything.
I don't need a legend.
I don't want to show a legend.
There you go.
All right.
Now I think I'm finished.
Data labels-- yeah, that's fine.
OK, finish.
I don't want to get too fancy.
Don't want the letters [INAUDIBLE].
Let me make this bigger for you.
So this is neat and I wish they didn't make the font so
big, but you get the point.
This is a discreet probability distribution of me making, in
this case, k shots out of 6.
And this was based on the fact that my probability of making
any given shot was 0.3.
Let me see if it'll actually-- and I'm not making any promises
here-- let me see if I can actually make it so
that it changes.
If I make it 0.2 does it change?
Oh, it changed!
Look at that.
That was neat.
Let me bring this up a little bit.
So what's neat is if I have a 30% chance of making a free
throw, that is my probability distribution, my discrete
probability distribution of making k shots.
This is my probability of making no shots.
I think it was like roughly-- oh, it even gives us it.
Tell us it's 0.12% or it's 12% chance of making no shots.
My probability of making 4 shots is only 6%.
I know you can't see it but that little window that
shows up right under my pointer says 0.06.
So this is neat.
And since the way we set it up we can actually change it,
so that if I have a higher probability of making a shot,
now it looks pretty symmetric.
Now my chances of making 4 shots is the same as my
chances of making 2 shots.
And if I'm really good at making baskets, I have
an 80% probability of making any given shot.
Now, all of a sudden, the whole distribution has
shifted to the right.
But I just wanted to show you one, this is, I think, a
pretty neat way to use Excel.
And hopefully, it's not too daunting.
The other thing is, these are all examples of binomial
distributions and I wanted to give you an example that might
be a little bit more relevant to your everyday life.
The probabilities of making and missing aren't the
same, they change.
If they are the same then you end up with a
situation like that.
Let's say you're a horrible basketball player and you
only have a 10% chance of making any given shot.
So there's a very high probability that
you make no shots.
There's a 53% chance you make no shots and then there's a
35% chance you make one shot, and so forth and so on.
But this is pretty neat.
This by itself is kind of a fun little toy and hopefully you
have enough information to do it yourself, or maybe
experiment with more.
What happens if you have more than n?
Actually, maybe I'll do that in the next video.
Anyway, see you soon.