How to repeat generating random sample 1000 times without for loop and draw the plots of alpha estimators?

482 views Asked by At

I have to generate one random sample with n= 20, from beta distribution(alpha=5,beta=1) and calculate MLE for alpha. I did this using the function rbeta and ebeta:

alfa = 5
beta=1
n = 20
sample<- rbeta(n,alfa,beta)
mle_alfa <- ebeta(proba, method = "mle")$parameters[1]

But the I have to Repeat point it 1000 times(i.e.generate1000 samples)and draw histograms,box-plots and q-qplots for

enter image description here

I tried repeating it wihout for loop like this, but I dont know if it's correct and how to use it to draw the plots. Can you please help me? Thank you!

sample2<- sapply(1:1000, function(x) rbeta(n,alfa,beta))
sample2<- as.numeric(sample2)
0

There are 0 answers