00:01
Hey there, welcome to numerate.
00:03
We are asked to use r in order to generate a binomial random variable and then plot the estimated probability density function.
00:15
All right, so what we're going to first do is generate our random variable here.
00:26
So this is going to be generate binomial random variable.
00:40
All right, so let's start here.
00:44
So we're going to define our terms over here.
00:51
So n will basically equal 50.
00:57
Our probability here would equal the 0 .2 and x becomes the random binomial variable in which we're going to use sample sizes of 10 ,000 samples.
01:23
Okay? so it's just a really large sample.
01:28
Given n and given p so we're really defined them above so we don't have to write them in so with this now we're going to estimate our probability density function estimate probably probability density function using the histogram function so there's other ways you can do um depiction here for the pdf you can do a gg plot two but in this case let's do the straightforward way which is doing histogram and then overlaying a curve.
02:10
So we have probability density function using the histogram function.
02:23
All right.
02:24
So let's draw a line here.
02:31
So what we have first is writing our histogram.
02:37
So histogram we are given x and our probability, where we have to define whether it's true, where it basically is based off our above the binomeroomeroom.
03:01
Random variable.
03:03
So our main, we're going to set it equal to the estimated pdf of binomial, filling our values here, which is 50 and 0 .2.
03:36
All right.
03:41
All right.
03:41
So moving on here, we're going to use x lab in which we can make it equal to x.
03:50
And y lab, we're going to make it into density.
03:54
So these are our axes here.
04:09
All right...