mu = 1
sigma = 2
y = rgumbel(n=100, loc=mu, scale=sigma)
mean(y)
mu - sigma * digamma(1) # population mean
var(y)
sigma^2 * pi^2 / 6 # population variance
x = seq(-2.5, 3.5, by=0.01)
loc = 0; sigma = 1
plot(x, dgumbel(x, loc, sigma), type="l", col="blue", ylim=c(0,1),
main="Blue is density, red is cumulative distribution function",
sub="Purple are 5,10,...,95 percentiles", ylab="", las=1)
abline(h=0, col="blue", lty=2)
lines(qgumbel(seq(0.05,0.95,by=0.05), loc, sigma),
dgumbel(qgumbel(seq(0.05,0.95,by=0.05), loc, sigma), loc, sigma),
col="purple", lty=3, type="h")
lines(x, pgumbel(x, loc, sigma), type="l", col="red")
abline(h=0, lty=2)
Run the code above in your browser using DataLab