Skip to content

Instantly share code, notes, and snippets.

@sieste sieste/mth3028_1_8.R

Created Jan 31, 2020
Embed
What would you like to do?
n = 10
theta = 1
alpha = 0.05
lo = up = numeric(10000)
for (i in 1:10000) {
x = rexp(n, 1/theta)
lo[i] = ((1-alpha)^(-1/n) - 1) * sum(x)
up[i] = (alpha^(-1/n) - 1) * sum(x)
}
xo = rexp(10000, 1/theta)
mean(x0 < lo) # "outlier" low
mean(x0 > up) # "outlier" high
mean(x0 > lo & x0 < up) # coverage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.