welcome to part 4 of our short introduction to extreme value analysis using the
extRemes package in R.
In the recent posts about the block maxima method and the threshold excess method, we have simply assumed that all assumptions for extreme value analysis are fulfilled. However, this is most likely not the case when dealing with environmental variables. Especially the assumption of stationarity may be violated in many cases. Against the background of global climate change, it is likely that there is a a considerable trend in the time series of meteorological or other environmental variables. Of course, this trend has to be incorporated into the analysis, as the resulting return levels change over time.
The following code shows a short practical example of fitting a generalized pareto distribution to a time series of precipitation data using the
extRemes package in R. The sample data set features precipitation data of Bärnkopf (Lower Austria) from 1971 through 2013 and is provided by the hydrographic services of Austria via via eHYD.
# load required packages library(extRemes) library(xts) library(ggplot2) # get data from eHYD ehyd_url <- "http://ehyd.gv.at/eHYD/MessstellenExtraData/nlv?id=107540&file=2" precipitation_xts <- read_ehyd(ehyd_url) # derive AMS for maximum precipitation ams <- apply.yearly(precipitation_xts, max) # check stationarity within AMS: # Mann-Kendall trend test Kendall::MannKendall(ams) # simple linear model ams_df <- fortify(ams) colnames(ams_df) <- "date" summary(lm(ams~date, data=ams_df)) p <- ggplot(ams_df, aes(x = date, y = ams)) + geom_point() + geom_line() p + stat_smooth(method = "lm", formula = y ~ x, size = 1)
Both the results of the fitted linear model and the graphical impression given by the plot indicate an upward trend of annual maximum precipitation amounts. The Mann-Kendall trend test returns a very small p-value, confirming this trend. Hence, trend correction has to be applied in order to account for changing return levels over time.
# maximum likelihood estimation mle_trend <- fevd(x = ams, data = ams_df, location.fun=~date, method = "MLE", type="GEV") rl_trend <- return.level(mle_trend, conf = 0.05, return.period= c(2,5,10,20,50,100)) # return level plot plot(mle_trend, type="rl", main="Return Level Plot for Bärnkopf w/ MLE")
Reference: Coles, Stuart (2001). An Introduction to Statistical Modeling of Extreme Values. Springer Series in Statistics. London: Springer.