# NOT RUN {
y <- rnorm(100, mean=40, sd=20)
y <- apply(cbind(y[1:99], y[2:100]), 1, max)
bl <- rep(1:3, each=33)
ydc <- decluster(y, quantile(y, probs=c(0.75)), r=1, groups=bl)
ydc
plot(ydc)
# }
# NOT RUN {
look <- decluster(-Tphap$MinT, threshold=-73)
look
plot(look)
# The code cannot currently grab data of the type of above.
# Better:
y <- -Tphap$MinT
look <- decluster(y, threshold=-73)
look
plot(look)
# Even better. Use a non-constant threshold.
u <- -70 - 7 *(Tphap$Year - 48)/42
look <- decluster(y, threshold=u)
look
plot(look)
# Better still: account for the fact that there are huge
# gaps in data from one year to another.
bl <- Tphap$Year - 47
look <- decluster(y, threshold=u, groups=bl)
look
plot(look)
# Now try the above with intervals declustering and compare
look2 <- decluster(y, threshold=u, method="intervals", groups=bl)
look2
dev.new()
plot(look2)
# Looks about the same,
# but note that the run length is estimated to be 5.
# Same resulting number of clusters, however.
# May result in different estimate of the extremal
# index.
#
fit <- fevd(look, threshold=u, type="GP", time.units="62/year")
fit
plot(fit)
# cf.
fit2 <- fevd(-MinT~1, Tphap, threshold=u, type="GP", time.units="62/year")
fit2
dev.new()
plot(fit2)
#
fit <- fevd(look, threshold=u, type="PP", time.units="62/year")
fit
plot(fit)
# cf.
fit2 <- fevd(-MinT~1, Tphap, threshold=u, type="PP", time.units="62/year")
fit2
dev.new()
plot(fit2)
# }
Run the code above in your browser using DataLab