I need to generate 50000 samples from a certain distribution and for each sample calculate several confidence intervals for a certain parameter and check whether the true value of the parameter falls in the confidence intervals and the width of the intervals, then at the end compute the coverage probability and the average width for each method, and i need to replicate this for various sample sizes
I know how to do this with for loop but it's painfully slow considering one of the method is bootstrap and there is a for loop even there.
I have three for loops one for sample sizes one for the 50000 reps and one for bootstrap, i know for loop is slow in r but i don't know any other alternatives
How can i optimize my code ?