My problem is as follows: Firstly, I have to create 1000 bootstrap samples of size 100 of a "theta hat". I have a random variable X which follows a scaled t_5-distribution. The following code creates 1000 bootstrap samples of theta hat:
library("metRology", lib.loc="~/R/win-library/3.4")
# Draw some data
data <- rt.scaled(100, df=5, mean=0, sd=2)
thetahatsq <- function(x){(3/500)*sum(x^2)}
sqrt(thetahatsq(data))
n <- 100
thetahat <- function(x){sqrt(thetahatsq(x))}
thetahat(data)
# Draw 1000 samples of size 100 from the fitted distribution, and compute the thetahat
tstar<-replicate(1000,thetahat(rt.scaled(n, df=5, mean=0, sd=thetahat(data))))
mean(tstar)
hist(tstar, breaks=20, col="lightgreen")
Now I want to compare the accuracy of coverage probabilities and the widths of 95% bootstrap confidence intervals constructed using the percentile method. I want to repeat the code above 1000 times, and in each case, check if the true value of the parameter belongs to the corresponding bootstrap confidence interval and calculate the length of each interval. Then average the resulting values.