BAM!
Mr. Tarrou.
Ok, let's try and run through few pages of notes here, or chalk board notes.
I am going to attempt to help you understand how to set up simulations in Statistics and
give you an idea of how they are used.
I am not going to do hardly any examples.
As you know from these videos, they are basically a conceptual set of notes.
But there will be a couple of examples thrown in.
Ok, still trying to get over a cold so excuse the throat here.
Simulations, they help to answer very complex or costly questions about the probability
of certain events give that we know or accept some probabilities about another real event.
As an example, what I am talking about here, we can find the probability of getting head
4 times in a row when we flip a coin 10 times.
That actually is surprisingly...
well it is not super likely like a 90 percent chance.. but it is higher than you would think,
if we accept the chance for heads as being 50%.
Now if you wanted to do this simulation with your calculator, you would just simple do
randint(0,1... the minimum number you want to create randomly and the maximum number
you want to create randomly... and you want to look at 10 numbers to represent that simulation
of 10 flips.
And you can store those into list one.
Then just scroll through those numbers.
You don't really have to store them.
It is only 10 numbers and they are just zeros and one.
You could just look left and right on your calculator screen and probably just scroll
back and forth and see if you have a run of 4... or at least four outcomes in that simulation
of ten flips.
Now that one simulation will not even be close to being able to answer your question.
You would not flip a coin once and go [yelling], "I got heads!"
So the chance of heads is 100%.
No, you have to flip that coin many many many many times before you could actually say that,
you know I have observed coin flip a couple of hundred times and I believe the chance
of heads is blank.
Well, if you want to answer this question with a simulation you will not enter this
into your calculator once and analyze whether you got a success or failure.
You will repeat that process....
well in a textbook you could just say repeat it 20 times just to illustrate you understand
the concept.
But in real life you might want to run that simulation a couple of hundred times, or maybe
even more, to get a very accurate estimation of that actual answer that you did just a
simulation as opposed to doing some kind real mathematical equation.
Ok.
By the way, this command is under Math...
Probability... in your calculator.
What simulations cannot do is actually find out if that coin is fair.
We had to assume that it was 50-50.
It cannot find out what percent of manufactured pieces in a factory are actually defective.
Now if you assume that maybe 1 percent are defective, then you could answer questions
like "What is the probability in a batch of 20 I get more than 3 defective one?"
But you would have to assume that 1 percent are defective.
But if you want to find out what percent are defective, that would have to be learned through
observation and not simulation.
Or.. you know...
What percent of students love my class?
Now of course my opinion must be everybody.
But I am sure that is not really the case!
Alright, so a little introduction to simulation.
Let's keep this introduction going!
[nananana] Ok.
We can find out the probability of 2 people in a room share the same birthday.
That is actually a complex question.
Oh!
When you write a simulation, it is off the screen now, but the very first step in simulation
is to assign numerical values... if that is what you are going to randomly generate...
assign numerical value, or whatever values you are going to generate, to represent resent
real events in the population.
So the zero up there for heads and one for tails was of course to let that zero and one
represent the real outcome of heads or tails.
Now that simple zero and one is not going to fly, not going to work, if we don't have
a 50-50 percent likelihood.
If it was 40% tails and 60% heads, then I might want to say that 1 through 40 represents
a heads....
Did I just get that backwards?
And 41 through 100 would represent tails.
You would need to have a more complicated number assignment for those real life events.
So if I want to run a simulation to find out the probability that 30 in a room, that two
of those 30 people share the same birthday.
Now not the birth year, just the birthday day like October 17th, October 30th, or January
1st, or whatever.
Um...
Well then I let number assignments of 1 through 365 be... that every number that I am going
generate, let those be the day of the year.
I know there is leap year and the 1/4 thing.
But there is basically 365 days in the year.
So I could do RandInt...
1 through 365... generate 30 numbers to represent my 30 people in a room.
Now that is a lot of numbers with a lot of spread.
Again this is under Math...
Probability.
So I might want to store those numbers in a list.
This colon command, or this symbol, is above the decimal on your TI-83 or TI-84.
Honestly I am not sure where it is on an INSPIRE yet, I should.
It might be in the same place, but probably not.
And then put in a second command of Sort Ascending list 1.
Or you could do it descending.
This is under the List command of your calculator.
You do second Stat, you go into the List menu, and choose...
I don't know if it is Ops or Math, but you can find this in there.
So generate your numbers of 1 to 365.
Generate 30.
Store them in a list.
Sort them.
You can do all of that in one single step.
And the sorting will be nice because I don't care about the sequence of events, not like
my previous example where I wanted to find the chance of a run of four heads out of ten.
I would definitely not want to sort that data.
Because I would not be able to analyze if there was a run of four outcomes or more.
But I could sort them here and just scroll down the list 1 and see if there are any repeat
numbers.
You will be surprised how high that probability is.
It is actually about 50-50 in a room of 23.
So if you are in a room with more 23 people and you want to win a bet, maybe gamble a
little bit, you can say "I bet there are two people in this room that have the same birthday."
And if there is...
I think it is more than 23... the chances start to come into the favor there is probably
two people with the same birthday.
It is more than 50 percent.
Ok.
In Statistics we have three ways of analyzing the probability of an event.
Such as flipping a coin and getting four heads in a row, or seeing if the probability of
two people having the same birthday.
Or what percent of the population go to church or shop at a store, have a certain political
opinion.
We can estimate the probability of an event by doing an actual observation.
That is called an empirical probability, but the definition of empirical is in a set of
later notes.
We can estimate the probability of an event by observing the random phenomenon many times
and calculating the relative frequency.
The random phenomenon could be flipping a coin, it could be asking people what their
birthday is assuming those people are randomly chosen, randomly choosing people and asking
them a political question.
Something like that.
Your random phenomenon many times and calculating the relative frequency.
Hey I flipped this coin 500 times and I got heads 47 percent of the time, so I estimate
the choice of this coin landing heads as 47%.
That is only 500 observations, or whatever number I just said, so I know it is not exactly
right.
But it is about correct.
And the larger your sample is, the larger your trial is, the closer you will... should
be to the actual true probability.
But now I am getting into variability and sample size, and I am kind of getting off
topic a little bit.
Because most of this section I a want to talk about simulations.
So moving on.
Develop a probability model and use it to calculate a theoretical answer.
Ok.
This is more like your discrete random variable which we have not studied yet.
I am going to move on from that.
But we are going to be talking about this very very shortly.
In chapter, well in my book it will be chapter 7.
Discrete random variables and setting up a probability model.
And actually..
I will be setting up a probability model with you when we talk about the very section of
notes.
That will be tomorrow:)
And of course if you are in the internet, there is no air date.
It is whenever you play the video.
Whatever!
Finally start with a model that in some fashion reflects the truth about the random event,
and then develop a plan for simulating the number of repetitions of the practice.
And now this is what we are talking about.
Simulations.
Assign numerical values, if that is what you are randomly generating, to real life events.
And make sure those number assignments match the probability of that event occurring.
If something has a 67 percent probability, I am going to say that values of 1through
67 is a success and 68 through 100 is not a success.
If I am just flipping a coin however like the previous example, well that is 50-50.
So I can just say zero is head and one is tails, because that is a 50-50 outcome.
Two possibilities total, 0 heads, 1 tails, 50-50 probability.
Great.
Then you generate those numbers like your birthday situation here.
And you repeat that simulation many many times.
Law of Large Numbers.
I don't believe I have thoroughly covered that yet, but it will be coming up in the
next set of notes.
Or you can look it up in your textbook.
And then you go, well, you know based on my number of simulations the probability of this
event is blank.
So this could be...
If I were to run this in my calculator, that would be one simulation.
I would record whether there was two birthdays shared or not since that is what the question
is about.
Then I would repeat that many many times.
Maybe just for textbook use 20 or 30 times.
And then based on those 30 simulations estimate the probability of two people in a room having
the same birthday out of 30.
Alright.
One more page of notes.
I am probably getting close on time, so moving on!
[nananana] Yes, I only have about 3 1/2 minutes left.
So I better talk quickly.
Ok.
Trials, the number of times you run a simulation.
We are using the Law of Large Numbers to estimate the probability of an event.
So we must run many many trials.
If you look in your Statistics book you will probably find a diagram about tracking the
probability of heads over many many trials.
It was an actual experiment that was run.
It actually did not really come close to a consistent 50 percent until close to 1000
trials were run.
Even 300 to 400 trials came up with a probability of heads of like 45 or 46... like in the 40's
percent.
Down to 42 or maybe up to 57%.
Something like that.
So many many trials before the Law of Large Numbers kicks in.
Think of the lottery.
You can spend a dollar and win hundreds of millions of dollars.
But that state selling them knows, if you live in a state with a lottery, they sell
millions if not....
I cannot even imagine how many tickets they sell.
They know based on the Law of Large Numbers they are going to make a certain average amount
per ticket sold even though some people spend a dollar and win millions.
Independence, one outcome does not influence another.
Such as a rolling a die and getting a 3, does not mean that when you pick that die up the
next time you roll it...
It is a piece of, I don't know what it is made of... plastic, it is not going to know
it just landed on 3.
It is going to be random the next time.
If you flip a coin eight times in a row and... well you flip it 8 times in a row getting
heads 8 times in a row.
That coin is not going, "Hey man, I better land on tails soon.
I just landed on heads 8 times."
That next trial is going to be independent.
We will be talking about independent trials and independent events.
There is a little bit of a difference.
Right now I am just referring to the trials being independent.
Getting a random number from a calculator.
We have RandInt, RandBin, and RandNorm.
RandNorm is when you want to randomly generate numbers out of a theoretical Normal distribution.
RandBin is when we are simulating an event that only has two outcomes, but all we care
about is not the sequence of those outcomes but the number of successes out of a certain
number of trials.
So...
How many times do you want to do something?
Like let's say free throws.
You want to make 20 free throws?
What is your chance of success?
Then how many times do you want to run this simulation?
If you put a one here, then you put in RandBin...Maybe I make 60 percent of my free throws.
N is a number, say a number of like 12.
That number of 12 would be the number of success out of my n number of trials.
Excuse me, N is the size of my simulation, and this how many simulations I want to run.
Now you will notice with the previous two examples I referenced RandInt.
That works for an event that has more than just two outcomes and because you can store
them in a list, you can analyze the sequence of that random behavior.
Then your summary statement, Based on my blank number of simulations the estimated probability
of an event is blank.
I am out of time.
I am Mr. Tarrou.
Go read your book, go do your homework.
Thank you very very much for watching my videos.
I am out.