n <- 10000; a <- 1; i <- c(1:n)
z <- 1/rexp(n+1)   # independent Frechet variables
x <- pmax(a*z[i],z[i+1])/(a+1)  # moving maximum series
par(mfrow=c(1,2))  # two adjacent panels for figures
plot(i,x,log="y",pch=20)  # should see clustering of high values, but need log axes
qqplot(z,x,log="xy") # compare the marginal distributions of x and z


tl <- quantile(z, probs = c(0.1,0.95))
evd::exiplot(z,tl)  # plots estimated theta between the limits given by tl 
abline(h=1,col="red")
tl <- quantile(x, probs = c(0.1,0.95))
evd::exiplot(x,tl)
abline(h=max(a,1)/(a+1),col="red")
