GaryBAYLOR / R-code

A collection of algorithms written by myself for solving statistical problems
0 stars 0 forks source link

X1 to Xn ~ Gumbel(0, theta), max(X1, ..., Xn) - theta log(n) distribution #24

Open GaryBAYLOR opened 8 years ago

GaryBAYLOR commented 8 years ago

Purpose: do simulation to prove the distribution of max(X1, ..., Xn) - theta log(n) is Gumbel(0, theta).

## mu= 0, sigma = 1
a <- expression(
n <- 50000,
x <- rgumbel(n, 0, 1),
xmax <- max(x - log(n))
)

res <- replicate(5000, eval(a))

plot(density(res))

xseq <- seq(-2, 6, by = 0.01)
yseq <- dgumbel(xseq, 0, 1)
lines(xseq, yseq, col = "red")

image