00:02
All right, so we're gonna do a little simulation here.
00:05
So what we're doing is we're taking 90 slips of paper and then on the 90 slips of paper we're gonna write down the numbers 1 to 9 and we're gonna do that 10 times and then so essentially we're gonna have 90 numbers and we're gonna have 1 through 9 10 times which means we're gonna have 10 ones 10 twos 10 threes 10 fours 2 fives etc all the way to minus.
00:35
And then we're gonna do three things.
00:37
A.
00:38
Part a.
00:39
The first thing we do is we're gonna take out a slip, get the number, put it back and do this 20 times.
00:44
So our sample size n was gonna be 1.
00:48
So n is the number of samples we're gonna draw.
00:51
We're gonna take n and we're gonna do this big n 20 times.
00:55
N is 20.
00:58
And then we're gonna record the mean and the variance of the the result.
01:04
All right.
01:05
And let's go ahead and do that.
01:08
We're going to use python to help us out with this.
01:10
There's other programs you can use, but here's the code that we're going to do and use.
01:21
And so slips of paper, this is the code to get the 90 slips of paper, val or blank in range 10.
01:30
This is zero through how many times they're gonna do it.
01:39
This is going from zero to nine which is ten times but then the value in range one to ten because the way the python works it doesn't include the upper bound so this is this is the val in range one to nine.
01:51
This is those numbers one through nine this is doing ten times.
01:55
So we run it and we get it we see the length of the slips of paper is 90 and if we print them out we see indeed we got one two three four five five, six, seven, eight, nine, one, two, three, four, five, six, seven, eight, nine, all so on and so forth.
02:08
So there's our one through nine, 10 times.
02:13
Okay, now we're gonna go ahead and do the sampling piece.
02:15
And this is how you set up your import and mpi as mp.
02:19
Here's your, you could do the set the seed to recreate the same sample every time.
02:26
We don't need to do that.
02:27
We've already done our vector here.
02:28
So that was just a little note for me to talk about that.
02:31
You've already created the vector.
02:34
Now we're going to, this is the number of items to select, so we want 20.
02:40
You can call this big n.
02:41
I put numitems just to be like, how many items are we taking? 20.
02:45
Selected items, select 20 items with replacement because we're gonna put them back and then place them again.
02:50
So and we're gonna select again, so np .random .choice and then slipsopaper and you're gonna choose it 20 times and then and then replace true.
02:58
And then we're gonna calculate the mean of the selected items, and the variance of the selected items.
03:05
Let's do it and then let's run it.
03:07
And then this code prints it out as well as the selected items and then it creates the histogram.
03:12
Run it and here we go.
03:14
And it chose to print out the selected item just so you can see how there's a gap at seven because we didn't select a seven.
03:22
But the mean's 5 .45 and 6 .5 plus 7 .99...