"Setting the seed at 747, generate m=500 samples of dimension n=880 from a population X, with Exponential distribution of expected value 1/λ=1/0.52, i.e. X∼Exp(λ=0.52).
For each of the generated samples, construct an approximate confidence interval for λ. Consider the confidence level 1−α=0.99.Indicate the mean of the amplitude of the m=500 confidence intervals obtained"
In this exercise I did:
m_ic <- function(seed, m, n, lambda, gama) {
set.seed(seed)
return(mean(replicate(m, (2*(qnorm((1+gama)/2)/sqrt(n)))/(mean(rexp(n ,lambda))))))
}
m_ic(seed=747, m=500, n=880, lambda=0.52, gama=0.99)
But what if n∈{100,200,300,…,4000} for example, how could i do the loop and put it in a data frame? And how could i after represent it in a plot like geom_line() or geom_point()?

