I'm trying to write a function in R which produces a set of n i.i.d Bernoulli random variables X1,X2,...,Xn ∼ B(1,π).
To generate M = 1000 random samples. When n = 10 and pi = 0.4.
I'm having trouble starting the code. If anyone could help out that would be greatly appreciated.
Here is what I have run to this point:
rbinom(n=10,prob=.4,size=1)
Now I want to assemble those variables into a matrix of 1000 of those samples run through the rbinom
function.