Hi! I'm relatively inexperienced with R so I made this post to seek out help with this problem I'm currently having.
So essentially I've been asked to see how the standard error and bias of a Cauchy distribution vary with n (sample size). I've produced the following code that outputs values of standard error and bias for n varying from 10 to 90 with intervals of 10.
What I now need to do is, instead of just seeing this information as a vector, plot the bias and standard error against n so I can analyse the results. Here is the code I currently have.
p <- 1/2
set.seed(1)
for (n1 in seq(1,9)) {
for (i in 1:1000) {
x<-rcauchy(10n1,0)
estimators[i] = quantile(x,p) - tan(pi(p-1/2))
}
print(c(mean(estimators), sd(estimators)/sqrt(n)))
biases[n1] = mean(estimators)
}
where mean(estimators) are the biases of each n, and the standard error is sd(estimators)/sqrt(n).