0:03 simulations are an incredibly powerful
0:06 tool for calculating probabilities and
0:07 they're used a lot when the
0:10 probabilities are either too tedious or
0:12 time-consuming or difficult to find by hands
0:13 hands
0:15 um there's you see them everywhere in
0:17 statistics especially because nowadays
0:19 you can just have a computer calculate
0:21 it for you and give you the answer
0:23 without having to design it and take the
0:25 time to do it yourself technology makes
0:28 doing simulations so easy um when I was
0:30 working on my master's in statistics my
0:32 big end of master's project that I was
0:34 doing I had to calculate a bunch of
0:35 probabilities and figure out the
0:38 theoretical side of things but then to
0:39 make sure I had actually done my work
0:41 correctly I ran it through a computer
0:43 simulation so they have all sorts of
0:45 uses and they're really really valuable
0:48 in the concepts in the realm of
0:51 statistics and in probability so what
0:54 actually is a simulation good definition
1:01 of a simulation is an imitation of a
1:17 probability essentially you try to
1:20 recreate whatever it is you're studying
1:23 and use your recreated model to figure
1:24 out the probability where it would be
1:27 like either impractical or tinea sir
1:29 impossible to do it in real life
1:31 we've done several examples of
1:34 simulations already in this class and
1:36 we'll do a lot more on before the end of
1:38 the year on the very first day of school
1:41 we did that pilot discrimination example
1:45 that was an example of a simulation
1:47 I didn't bring 15 pilots into our
1:49 classroom and start picking them I used
1:52 like a little bag with the color tubes
1:54 in it and we picked the estimated
1:57 probability that way so you can use some
1:59 other sort of objects to represent your
2:01 situation where it's easier to handle
2:02 you can also use a computer or
2:05 technology just in our last lesson we
2:08 did that thing with the textbook slash
2:13 baby um thing
2:15 five point one a that was a simulation
2:17 and we've done others over the course
2:19 this semester already as well very
2:22 common concepts so let's talk about how
2:24 you actually go about designing a
2:28 simulation yourself in real life you're
2:30 going to use a you're gonna use the
2:32 technology computers probably just gonna
2:34 do it for you but even though that's
2:36 true you need to have an appreciation
2:38 for what it is the computer is doing I
2:41 understand how to like a simulation may
2:42 work even though I don't want to do it myself
2:43 myself
2:45 I can at least use that information to
2:47 help me when it gives me my results you
2:49 want to be able to appreciate what is
2:51 going on behind the scenes so ap
2:53 statistics makes you guys design nice
2:57 basic simulations or do small-scale ones
3:00 by hand to give you an idea of how they
3:01 work even though in real life you would
3:03 probably just use a computer and do a
3:06 hundred thousand trials so the four-step
3:08 process that you'll use for this kind of
3:10 problem is a four step profit process
3:12 I've referenced before it's our books
3:14 then and we do it second semester too
3:20 but the four steps are States plan do
3:24 and conclude and it talks about what
3:26 each of these steps are gonna be
3:28 basically you set up your problem you
3:31 plan out how one trial is gonna work in
3:34 lots of detail then you do it a lot of
3:36 times and you estimate the probability
3:38 so we'll walk through an example and you
3:40 guys will see how that works but this
3:42 basically when you write these out
3:44 you're gonna have to give lots and lots
3:46 of very specific detail so they know
3:48 that you really understand what's going
3:52 on so first thing we're gonna do is look
3:54 at the textbook example that we did just
3:57 last time I think with this one well I
3:58 will talk through it and I'll just have
4:00 the answer flash up there so you guys
4:02 can see what's going on first thing you
4:05 would do is state what probability
4:07 you're trying to find kind of set the
4:09 stage so I would talk about for our
4:11 textbook problems what's the probability
4:13 that if you have four people who all
4:15 randomly shuffled their textbooks in
4:17 grab one that none of them get their
4:19 same textbook back you're basically just
4:22 setting the stage for your problem then
4:24 in the plan step what you would do is
4:26 you would talked in a lot a lot of the
4:29 about how you're gonna work your
4:31 simulation how does a trial work it
4:33 could be where we do something with
4:35 random numbers we use like randant on
4:37 our calculator we could use a random
4:39 table we could actually put index cards
4:41 and deal them out and that might not be
4:43 a bad way to do it so I think for this
4:45 one what I'm gonna say and what I'll end
4:47 up writing about in two seconds is I'm
4:50 gonna have four pieces of paper one two
4:52 three four and then what I'm gonna do is
4:54 I'm gonna have four smaller index cards
4:58 also numbered one two three four my four
5:00 pieces of paper will be out what I'm
5:01 gonna do is I'm gonna shuffle those four
5:03 index cards up little index cards and
5:06 deal them facedown on each piece of
5:09 paper and I'm gonna see if any of them
5:11 match so I do a trial where I dish out a
5:14 card to all four I see if any of them
5:17 matched and if they do or they don't I
5:19 keep track of that so I write down if
5:20 there were zero matches or if there was
5:22 something else going on okay that would
5:25 be like one trial and then I would do
5:27 that same thing lots of times over and
5:30 over deal at four deal out for a lot for
5:32 and after I do it like a hundred a
5:34 thousand ten thousand times I would look
5:37 at what proportion of the time I got
5:38 zero matches so I think the number of
5:41 zeros out of the total number of trials
5:44 and that's basically how that work so
5:46 I'll put up an answer that gives
5:48 sufficient detail for my explanation
5:50 right there you very easily could have
5:51 done this a different way with like
5:52 randant or something like that and
5:54 that's totally fine but I'll do the
5:57 index card way when I write this one up
6:00 alright so you can see below it's kind
6:01 of a lots you have to write out for one
6:03 of these people don't usually enjoy
6:05 doing simulation style questions
6:07 thinking about them isn't so bad but
6:09 writing them out is a little bit tedious
6:11 but in the blue I have my original
6:13 question purple here is talking in
6:15 detail about how one trial would work
6:18 the orange is really easy you just say
6:20 you repeat many times and then in theory
6:23 you would actually do some trials um I
6:25 just remembered from our last video that
6:27 they probably was around 38 so I made
6:29 this up I didn't do 100 trials myself in
6:31 like practice like for a quiz or
6:33 something you would probably use
6:35 something like 5 trials or 10 trials and
6:37 it'll tell you how many to do will get
6:39 practice with that towards the end
6:43 this video but you just do your process
6:45 and then you estimate the probability
6:47 that there wasn't before that's how you
6:50 set up a simulation so this one I think
6:52 wasn't that bad to write out like you
6:53 can kind of just logic it and be like
6:56 okay yeah four people four books and
6:57 then you can make something that works
6:59 pretty well but naturally probability
7:02 can be tougher to wrap your head around
7:04 depending on how complicated the
7:06 situation is that you're talking about
7:08 so we have a brand new problem right
7:10 here there's a basketball player and
7:13 apparently that player is considered a
7:15 very streak need by the announcer they
7:18 justify saying that their streak lead by
7:20 saying wow they make a lot of their
7:23 shots in a row um and in this most
7:25 recent game the player took 30 shots and
7:28 had a streak of seven in a row where
7:30 they made them okay so with sports
7:33 examples in general you have to make an
7:34 assumption that's maybe or maybe not
7:37 realistic which is that like one shot is
7:40 independence of next so if you air ball
7:42 on your first shot that's not gonna get
7:44 in your head and influence how you do on
7:46 your next shot each shot is considered
7:48 independent that may or may not be
7:51 realistic for certain players but it's
7:52 usually considered an okay assumption to
7:55 make so basically this announcer is
7:57 saying this guy is a streaky shooter
8:00 because in 30 shots he got seven in a
8:03 row and that seems like a lot that seems
8:04 like a big deal getting seven and rip
8:07 the player makes 47% of their shots
8:09 overall but that's not like that's not
8:11 why they're saying the personal streets
8:13 they're streaky because they made seven
8:15 out of a set of thirty so we want to
8:17 figure out is that a big deal
8:20 could you be a forty seven percent sugar
8:22 and get seven in a row in a set of
8:24 thirty pretty easily or is that kind of
8:27 hard to do so we have to think and wrap
8:29 her head around how we would like
8:32 recreate this tougher situation with a
8:34 simulation so maybe even pause me it'd
8:36 be good if you did on to think about
8:38 like what you would do and I'll give you
8:44 some thoughts or ideas on this so the
8:46 first thing is that you need to have
8:48 thirty trials in whatever you're doing
8:51 so if you're using randoms if you're
8:53 gonna like do I don't know
8:55 something with coin a coin or whatever a
8:58 die you need to roll 30 times for one
9:00 trial so you have to have 30 shots
9:03 representing just for one trial and then
9:05 we would do that a bunch of times if you
9:07 said something like flip a coin see if
9:08 it's heads or tails from making a shot
9:11 that wouldn't work out because they're a
9:14 47% shooter if they were a 50 percent
9:15 shooter they'd be perfect we can just
9:17 very easily flip quarters and look at
9:20 like common unit heads in row we got but
9:23 because this probability is a little bit
9:25 more off-the-wall the best thing to do
9:28 here is to use some sort of random
9:29 number generator and do it that way
9:31 instead it's gonna make it so you can
9:33 actually get that 47 percent that you
9:36 need so again what I'm gonna do here is
9:38 talk you through what I would do and
9:40 then after that I'll write up a nicer
9:42 explanation for you guys to copy down so
9:44 you can see what a full credit answer
9:47 would look like for this problem I
9:49 wanted you randint on the calculator and
9:52 when you do ran dints your digits don't
9:55 need to be the same size so I'm gonna go
9:58 randant and i'm gonna do one through a
10:00 hundred right here I'm basically trying
10:02 to recreate a forty-seven percent
10:05 shooter so what I would do if I do a
10:07 randant one through a hundred is I would
10:09 get look and let's say the number is one
10:12 through forty-seven means that you made
10:16 the shot so I'll put yes for that and
10:19 then I would have 48 all the way up to a
10:21 hundred meaning that they missed the
10:26 shots okay now do you have to have the
10:27 labels the same as me
10:32 no if you did 1 through 53 you miss and
10:33 then the rest of them make that's fine
10:35 too as long as it appropriately
10:38 represents the problem so what I would
10:40 need to do now once I have these labels
10:42 right here is I would hit randant
10:45 and I would do that 30 times oh I got 30
10:47 i got 37 for my first number that's a
10:50 make oh I got 42 that's a make oh I got
10:54 74 that's a miss oh I got a 91 miss etc
10:56 and you would do that until you have 30
10:59 trials altogether so you would do that
11:02 for all 30 of these after you get your
11:05 30 actually before I get to that let's
11:07 think really quick about whether
11:11 kids would be okay do we want repeated
11:13 numbers to be allowed so like if I get
11:15 the number one for my first trial could
11:19 I get the number one again the answer is
11:21 yes I would want to be able to repeat a
11:23 number because these aren't actual like
11:26 objects that I'm saying these are meant
11:28 to represent probability and if I take
11:30 out the number one well then it's not a
11:32 47% chance I'll make it any more you're
11:33 messing with the probabilities so you
11:35 would want to allow repeats and I'll
11:37 talk about that when I write my answer
11:40 so anyway you get your 30 trials right
11:41 here a lot of times we do this in class
11:43 with randant and then we go around the
11:44 room because everybody has a different
11:48 trial after you do this though what you
11:50 care about is not how many you made we
11:51 just want to see how likely it is that
11:53 you get seven in the row that's the
11:55 probability that we cared about so I
11:57 would look through all my yeses and noes
12:00 right here and see if I got seven yeses
12:04 in a row at some point in my process if
12:07 I did then that's a success for my trial
12:09 I got it at seven in a row and if I
12:12 didn't be enough after you do that a
12:13 bunch of times you would just count the
12:15 proportion or find the proportion of
12:17 times you've got seven or more and then
12:18 you would calculate a probability so I
12:20 will write up a little explanation of
12:24 what that looks like okay so here is a
12:26 long kind of written out answer here
12:28 that would get full credit for a problem
12:31 like this again I know it's not fun to
12:33 write this down and it's like these
12:35 problems take a little bit of time to
12:36 write them out but you have to be very
12:38 very specific in what you say
12:40 I basically recap everything we talked
12:42 about right here and I made sure I
12:44 mentioned that repeats were okay for
12:47 this problem oh and then I just made up
12:49 a probability usually when I do this in
12:51 class we get something pretty low like
12:54 nobody or one person gets seven or more
12:56 in a row so I set out of twenty people
12:57 in class because like what we would have
13:00 done is had each of us into it and then
13:02 we'd get our trials that way because it
13:03 takes a long time to do thirty numbers
13:07 that's just for one trial so yeah you
13:08 get a probability and it would be fine
13:11 so simulations the trick is mostly just
13:14 wrapping your head around how to design
13:15 the problem and then taking the time to
13:17 actually write the thing outs we're
13:19 going to talk about one more example in
13:19 this way
13:21 and we're gonna do it with a random
13:24 number table which we've used before
13:26 back in our first chapter when we talked
13:28 about chapter four we were talking about
13:29 like random assignment and that sort of thing
13:30 thing
13:33 when you use a table you need to make
13:35 sure Green doesn't show up very well
13:40 let's change colors here so make sure
13:49 all labels are the same size so we've
13:50 talked about like if we were doing that
13:52 same problem we just did we could go
13:56 zero one two I guess if we did here oh
13:58 one Oh that'd be weird I'd have to go
14:02 zero zero one to 100 or I can go zero
14:06 zero zero two zero nine nine either of
14:07 these would have been okay since I had a
14:10 hundred numbers I need three digits of
14:13 peace that I would look at oh and also
14:19 talk about rejected numbers so you gotta
14:21 talk about any numbers you're not going
14:22 to use and we'll see how that plays out
14:24 in our next example so those are just
14:27 two things to watch out for here this
14:29 one I want to do a shorthand for so I'm
14:31 not gonna make you write the whole thing
14:33 again hopefully you wrote the last two
14:35 out we'll just talk like highlights and
14:37 actually work out the simulation on the
14:40 table on the next page so I want a
14:43 sample of size six and I have 60 seniors
14:46 and I have thirty juniors so I put
14:47 everybody's name on a paper I put in a
14:49 bag and I pull amounts but somebody
14:51 pointed out well you should do a
14:53 stratified sample instead and make it
14:54 representative to that population
14:56 weights because I have way more I've
14:58 doubled the seniors that I viewed unions
15:01 but I just shuffled all the papers up so
15:02 I don't really want to have to separate
15:04 them and then put 60 and 30 if I did
15:06 have 60 and 30 separate it would be kind
15:08 of easy I pick four from here two from
15:11 here but they're all in one bag and I
15:13 don't want to fix that so what I'm gonna
15:15 do is I'm gonna pick and if I run out
15:17 like I get too many seniors I'll just
15:18 throw the number out I'll pick something
15:20 else don't keep going like that until I
15:26 actually gets my sample so we are going
15:29 to design a simulation using a table to
15:31 estimate the probability that it must
15:33 take eight or more
15:37 to get for seniors to juniors so I'm
15:38 going to show you how this process works
15:40 but we're not actually to do a ton of
15:42 trials with this year that's the basic
15:45 set so I need eight or more picks is the
15:47 probability I care about to get 14 years
15:49 to juniors out of this so I'm not
15:50 writing out the whole thing let's just
15:52 talk labels and what I would need to do
15:55 first step is assign labels and get the
15:56 things set up well actually first step
15:58 is say the probability what's the
16:00 probability that in a set of 60 senior
16:02 started Union just takes a term or picks
16:05 to get this just restating that next
16:07 thing you do is get your labels ready to
16:12 go so I have 90 people who are in this
16:13 problem right here
16:15 so if I have 90 of them I got to do two
16:17 digits I'm gonna go I like starting with
16:20 zero zero that way I don't forget to
16:21 like rule it out later
16:25 so zero zero through fifty nine are
16:30 gonna equal seniors and then that would
16:36 make number sixty through 89 juniors one
16:37 of the more common errors on this is
16:39 people doing like the wrong meds on that
16:41 saying 0 to 60 which would be actually
16:43 61 numbers so just make sure you're
16:46 careful with that so if I was writing
16:48 this out I would say a sign unique
16:55 number to each students and I've got my
16:58 labels right here so now what I'm gonna
16:59 do in this problem
17:03 do I want repeats I do not because that
17:04 would be taking the same person twice
17:07 for my committee here so I would need to
17:10 make sure that I reject two repeats and
17:13 I also need to make sure that I reject
17:15 the numbers nine year through ninety
17:17 nine those don't correspond to an
17:19 individual so let me just walk through
17:21 how that work and show you a trial right
17:25 here my first number is a 19 so if I do
17:27 this usually when they give you a table
17:28 like this they want you to mark it up
17:31 and show what you did number 19
17:33 represents a senior so I have a senior
17:36 then I have 22 another senior that I
17:41 have thirty-nine another senior 50 is
17:43 another senior I was supposed to have
17:45 four seniors so now I'm gonna shut it
17:46 down anymore
17:47 seniors that I get I would want to throw
17:51 away 34 is another senior I think I'm on
17:53 34 it's kind of hard to see you right
17:55 here yeah 34 is a senior so they're out
17:58 five is a senior so they're out double
18:03 zero five I have 75 that's a junior and
18:06 I have 62
18:10 that's a junior so if I look at my
18:11 number of trials right there
18:14 I had the four seniors I had two that I
18:16 threw away five six then I had Junior
18:19 junior that was eight trials right there
18:22 so it took me eight okay so I would have
18:25 eight or more up that's a trial for that
18:28 and then I'd have less than eight which
18:30 obviously didn't happen so then I can
18:32 either pick up like just go like this
18:33 and pick up right there or I can start
18:35 on a new line I'm gonna start on a new
18:38 line just because it's gonna be a little
18:41 less crowded here um you also have to
18:43 pay attention to repeated numbers I
18:44 wasn't super careful about that in the
18:46 last one because it's so small here but
18:48 I don't think I had anything repeats so
18:52 I'll show you one more trial 73 73 is a
18:57 junior PS if I were to say I got a 73 in
19:01 my last trial up here that's okay if I
19:03 get 73 in my new trial because it's like
19:05 a fresh start every trial is like a new
19:07 beginning right here so if I was gonna
19:09 write that out I would talk about a new
19:13 trial is like you start fresh so I have
19:17 a junior then I have a 67 67 is also a
19:19 junior so just like that I am full of
19:22 you I'm done with my juniors then I have
19:27 a 64 that's a reject 71 is reject 50 is
19:33 a senior 99 is a rejects 40 is a senior
19:41 uh zero zero is a senior this is really
19:42 hard to do with this tiny table here so
19:44 sorry if I'm making a mess of this I
19:45 don't know what I have right now I have
19:48 three senior 19 as a senior so I'd stop
19:50 right there then I count my trials one
19:55 two three four five six and that's at
19:57 least eight so that would be another
19:58 tally mark right here
20:00 my next time I do it in five trials I
20:04 put a tally over here etc now on a quiz
20:05 there aren't going to be very many
20:08 trials because it takes forever to do so
20:09 I'm gonna make you do like five trials
20:12 so say I did two trials right here I
20:14 would estimate the probability to be a
20:15 hundred percent because I only did two
20:18 out of two obviously that's not an
20:20 accurate probability but these problems
20:22 care a lot more about the fact that you
20:23 can actually understand and carry one of
20:25 these out rather than that you can get a
20:28 good accurate probability so just go
20:29 with the number of trials they tell you
20:32 to even if it's small your quiz will
20:33 have a problem something like this where
20:35 you guys set up a simulation and carry
20:37 out a small number of trials so that is