The Extremes Toolkit
Weather and Climate Applications for Extreme Value Analysis (EVA)
- About
- What is EVA?
- Examples
- Installation
- Tutorial
- Updates
- R basics
The Extremes Toolkit is an interactive software package for analyzing extreme value data using the R statistical programming language. In R, the package name is extRemes, and is written and maintained by Eric Gilleland with assistance from Rick Katz. Initial work was done by Greg Young. Primarily, extRemes uses functions from the R package ismev, the R port (by Alec Stephenson), of Stuart Coles' S-Plus functions; who we thank for his permission in using the ismev functions.
The Extremes Toolkit is funded by the National Science Foundation (NSF) through the NCAR Weather and Climate Impact Assessment Science Initiative with additional support from the NCAR Geophysical Statistics Project (GSP).
Extreme value analysis (EVA) is used primarily to quantify the stochastic behavior of a process at unusually large (or small) values. Particularly, such analyses usually require estimation of the probability of events that are more extreme than any previously observed. Many fields use EVA including: meteorology, hydrology, finance and ocean wave modeling to name just a few.
Many statistical analyses concern sums or averages of random variables, and often rely upon limiting results such as the Central Limit Theorem to justify use of the normal (or bell-shaped) distribution. When interest is in extremes, the bulk of the data may be misleading, and the normal distribution is not appropriate. A similar theorem to the Central Limit Theorem, the Extremal Types Theorem, provides justification for using a family of distributions (in the univariate setting, similar results hold for multivariate analysis) known as the generalized extreme value (GEV) distribution. This, or analagous results for threshold excesses, are often the focus of EVA.
For more about EVA, see Rick Katz's web page on extremes
If you have an example where you have used extRemes on a weather and/or climate problem (conference poster, journal paper, preprint, etc.), we would love to hear about it (ericg " at" ucar "dot " edu).
- Using the Extremes Toolkit
- Weather and climate community
- Other research areas
- How to cite the toolkit in a journal paper
Using the Extremes Toolkit
Gilleland E and RW Katz, 2006. Analyzing seasonal to interannual extreme weather and climate variability with the extremes toolkit (extRemes), 18th Conference on Climate Variability and Change, 86th American Meteorological Society (AMS) Annual Meeting, 29 January - 2 February, 2006, Atlanta, Georgia. P2.15.
Stephenson, A and E Gilleland, 2006. Software for the Analysis of Extreme Events: The Current State and Future Directions, Extremes 8:87--109.
Examples where the toolkit has been used in the Weather and Climate Community
Abeysirigunawardena DS, E Gilleland, D Bronaugh, 2008. Extreme wind regime responses to climate variability and change in the inner-south-coast of British Columbia Canada. Accepted to Atmosphere-Ocean.
Bodini A and QA Cossu, 2008. Analysis of precipitation trends during 2nd half of the 20th century in an area of Sardinia (Italy) at high hydrogeological risk. CNR-IMATI Technical Report 08.11. Available at http://www.mi.imati.cnr.it/iami/papers/08-11.pdf
Helminen J, A Venäläinen and A Vajda, 2005. The occurence of extreme precipitation values in Finland during summer (May-September). 4th Conference on Extreme Value Analysis: Probabilistic and Statistical Models and their Applications, 15 - 19 August, 2005, Gothenburg, Sweden.
Katz RW, GS Brush, and MB Parlange, 2004. Statistics of extremes: Modeling ecological disturbances. Ecology, 86:1124--1134.
Lu, J, 2007. Local effects of global warming. Masters Thesis, Dept. of Mathematics and Statistics, Texas Tech University, Clyde F. Martin, Committee Chair. Selected as Women's Studies Best Graduate Student Paper.
Mares C, I Mares, and A Stanciu, 2009. Extreme value analysis in the Danube lower basin discharge time series in the twentieth century. Theor. Appl. Climatol., 95:223--233. DOI 10.1007/s00704-008-0001-0
Pirazzoli PA and A Tomasin, 2007. Estimation of return periods for extreme sea levels: a simplified empirical correction of the joint probabilities method with examples from the French Atlantic coast and three ports in the southwest of the UK. Ocean Dynamics, 57:91--107.
Pirazzoli PA, A Tomasin, and A Ullmann, 2006. Extreme sea levels in two northern Mediterranean areas. J Mediterranean Geography, 108:59--68.
Sanabria LA and RP Cechet, 2007. A statistical model of severe winds. Geoscience Australia Record 2007/12. Available at: http://www.ga.gov.au/image_cache/GA10911.pdf
Unkašević M and I Tošić, 2009. Changes in extreme daily winter and summer temperatures in Belgrade. Theor. Appl. Climatol., 95:27--38, DOI 10.1007/s00704-007-0364-7
Walter MD, 2008. Application of the Statistical Theory of Extreme Values to Heat Waves. Significant Opportunities in Atmospheric Research and Science (SOARS) Program. (pdf)
Wise E, 2006. Air quality extreme events and projected trends for the southwestern United States. Climate Prediction Applications Science Workshop, 22 March 2006, Tucson, Arizona. http://cals.arizona.edu/climate/CPASW2006/proc/day2/Climate-Health-AirQuality_1/Wise.pdf
Wolters D, 2007. A method to investigate the time evolution of the probability distribution of high temperature extremes in The Netherlands, applied to the extremes in the period of May 2006-April 2007. MSc study project, Wageningen University, supervisors: dr. Leo Kroon and drs. Paul Torfs.
Examples where the Extremes Toolkit has been used in other areas
de Alba E, J Zúñiga, and MA Ramírez Corzo, 2008. Measurement and transfer of catastrophic risks: A simulation analysis. Institute of Insurance and Pension Research (IIPR) Report 2008-03. Available at http://www.stats.uwaterloo.ca/stats_navigation/IIPR/2008Reports/08-03.pdf
Denny MW, 2008. Limits to running speed in dogs, horses and humans. J. Experim. Biol., 211:3836--3849, doi:10.1242/jeb.024968
Fujita M, 2007. Separation and Airspace Safety Panel (SASP) meeting of the working group of the whole. Twelfth meeting of the International Civil Aviation Organization, Santiago, Chile, 5-16 November 2007. Available at: http://www.enri.go.jp/info/katsudou/pdf/sasp/h19_158.pdf
How to cite the toolkit in a journal paper
You can use the following function in R to see how to cite the toolkit.
citation("extRemes")
Similarly, to cite the R programming language itself, use:
citation()
install.packages("extRemes")
Once extRemes has been installed, it will need to be loaded into your R session for every new session of R using the following command.
library( extRemes)
Specific details for each OS are given below, but the above commands work generally.
The R Statistical Software Language and Environment
The extRemes package is an R package, and therefore this application must be installed in order to use extRemes. R is a language and environment for statistical computing and graphics. It is a GNU Project that is free and publicly available. More information about dowloading, installing, and anything else pertaining to R can be found at the R project web site at http://www.r-project.org.
Important! When installing R (on any OS), be sure to install the full version of R that includes Tcl/Tk, as extRemes requires this software to run.
Linux/UnixStep 1: Download/Install the Extremes Toolkit
To install locally (no root priveleges), create a directory in which to install the toolkit. For example, suppose you wish to install the toolkit in the directory, /home/[user]/src/library. Further, I will assume that the directory src/library does not already exist; if it does exist, you can skip the first two mkdir commands. From unix/linux prompt: pwd/home/[user]/
mkdir src
mkdir src/library
Next, open an R session, and from the R prompt type the following command.
install.packages("extRemes", lib="/home/[user]/src/library")
If you have the correct permissions, and would like the toolkit to be available to all users, then simply follow the above directions, but install the toolkit to the R library files (varies with system) by using the following (simpler) command from the R prompt.
install.packages("extRemes")
Step 1b (unix/linux): Download/Install ismev package from CRAN
To install ismev, open an R session, and from the R prompt, type:install.packages("ismev")
If this fails, it may be that you do not have permission to write files where R wants to write them. In this case, it is possible to tell R to install the package somewhere else, say to the directory /home/[user]/src/library. To do this, type:
install.packages( "ismev", lib="/home/[user]/src/library")
If ismev is installed in this way, then it may be necessary to load it into R manually. This can be done with the command:
library( ismev, lib.loc="/home/[user]/src/library")
Otherwise, if ismev is installed in the R default directory for package installations, then the Extremes Toolkit will be able to load ismev into R automatically.
Step 2: Load into R
From the unix prompt, open an R session.R
Then, from the R prompt, type:
library( extRemes)
If all is well and good, the main toolkit dialog will appear and the toolkit will work. If at any time this main window is closed, it can be re-opened by the command:
extremes.gui() Windows
Step 1 (Windows): Download/Install extRemes and ismev
Open an R session by double clicking on the R icon, and select Install package(s) from CRAN... from the Packages menu. Find "extRemes", select it and click OK. R will do the rest (when it asks whether or not to delete downloaded files, type 'y' for yes). Repeat these steps, but this time choose "ismev" instead of "extRemes".Step 2: Loading extRemes (and ismev) into R (Windows)
Open R and follow the instructions below. Note that the toolkit depends on the Tcl/Tk software as well as the ismev package. If the R Tcl/Tk interface package, tcltk, does not load with the extRemes package then please refer to the Windows FAQ on the R project website or to the tutorial for instructions on how to get this package up and running.library( extRemes)
Assuming all necessary packages are successfully loaded, the Extremes Toolkit main dialog window will launch immediately. If at any time this main window is closed, it can be re-opened by the command:
extremes.gui() Macintosh
If you do not already have the X11 application, you must first install it. Apple distributes its own version at
http://www.apple.com/macosx/features/x11/download/,
and the open-source XFree86, on which it is based, is available at http://www.xfree86.org/
Install necessary libraries (such as extRemes) exactly as for Windows (for Aqua GUI) or Unix/Linux (for Terminal command line)
Once these are successfully installed, open an R session. With Macintosh, there are two options for opening an R session: (i) in X11 (akin to linux/unix) and (ii) via Aqua GUI (akin to Windows).
- For (i), Open an X11 window to start the X-Windows Server. Follow the instructions above for installing extRemes
- For (ii), follow the instructions for installing extRemes exactly as for Windows.
Short Course Material
Example Data sets
Be sure to also check out the various updates since version 1.50 (under the Updates tab) for changes that may affect results shown in the tutorials below.
Tutorial
Tutorial (pdf)Tutorial (html)
Short Course Material
Gilleland E. Short course: An introduction to the analysis of extreme values using R and extRemes. Graybill VIII/6th International Conference on Extreme Value Analysis. Colorado State University, Fort Collins, Colorado. 22-26 June 2009. (Presentation Slides (univariate), Practice Problems (univariate))
Gilleland E. Intense course for young researchers on R Statistical software for climate research with an introduction to extreme value analysis, Interdisciplinary Workshop: Effects of climate change: coastal systems, policy implications, and the role of statistics Workshop. 16-20 March 2009, Preluna Hotel and Spa, Sliema, Malta. (Presentation Slides, Practice Problems, R scripts)
Katz RW, 2009: "Problem application: Exercise session on analyses of extremes." American Meteorological Society Short Course on Statistics of Extreme Events, Phoenix, AZ. (pdf lecture notes)
Katz RW, 2008: "Background on extreme value theory with emphasis on climate applications." Short Course on Statistics of Extremes in Climate Change, Michigan State University. (pdf lecture notes)
Katz RW, 2008: "Application of extreme value theory to climate change." Short Course on Statistics of Extremes in Climate Change, Michigan State University. (pdf lecture notes)
Example Datasets for extRemes
For more information about a particular dataset, see the respective help file. For example, to learn more about Ozone4H, type the following after loading extRemes.[R console]> help( Ozone4H)
R source filesdamage.RDenversp.R Flood.R FtCoPrec.R Peak.R Potomac.R SEPTsp.R Denmint.R ftcanmax.R HEAT.R Ozone4H.R PORTw.R Rsum.R Tphap.R |
Common datasetsOzone4H.datFlood.dat |
What's new?
Sign up to receive email updates about extRemes. These updates are highly infrequent, and typically minor updates such as for version 1.55 are not announced, so check here if you find that your version of extRemes does not work with your version of R. You will also be able to unsubscribe from this list using the same link.Changes in extRemes with version 1.60
If Calculate L-moments is checked when fitting data to a GEV or GPD distribution, then L-moments (for the stationary model only) are calculated, printed to the screen, and used as initial estimates for the MLE numerical optimization routine. Also, for GEV ad GPD models, when fitting the stationary model, a likelihood-ratio test is performed against the case that the shape parameter is zero (i.e., Gumbel or Exponential), and the result is printed to the screen.Update to ismev affecting extRemes
A bug was found in the pp.diag function of ismev when making qq-plots for models with covariates in the parameters. As of version 1.32 of ismev, this bug has been fixed. Because extRemes used this function to make its qq-plots, this will affect output from extRemes. Another bug associated with the pp.fit function of ismev when using covariates was also fixed with this version, but this had already been fixed for extRemes (see changes in extRemes with version 1.51 below). Eventually, the fix for extRemes will be removed, and the ismev function will be used instead.Changes in extRemes with version 1.59
Removed the fpp function now that pp.fit from the ismev package has been fixed. There is also another fpp function in package evd. Also modified the help file for gen.gev to be compliant with new R package checking rules.Changes in extRemes with version 1.58
The default optimization routine for fitting data to an EVD has been changed back to Nelder-Mead from BFGS. This is consistent with what is in the tutorial, and is more straightforward because of the display.Changes in extRemes with version 1.57
Further fixes to return.level including a switch to using the exact gradient for the return level function when computing the delta method confidence intervals. Previously, the difference approximation was used.No asymptotic results are used for finding return levels for return periods of less than one year. Only return periods greater than 1 year can be computed with this function.
Note that this function is not called by any of the GUI windows, which continue to use ismev routines.
Changes in extRemes with version 1.56
Fixed some problems with the command-line function (not used with the GUIs) 'return.level' designed to allow the user to pass particular desired return periods, and receive the return levels (and delta method confidence intervals, if desired) as output instead of simply plotting them.Changes in extRemes with version 1.55
Only one minor change here to (with any luck) remove a warning found with 'R CMD check' of the pre-release of R 2.5.0.Changes in extRemes with version 1.54
No noticeable changes have taken effect here. Just some minor modifications to keep up with newer versions of R. Note that the package may no longer work with older versions of R. It will be necessary to update to the latest version of R for the package to work.Changes in extRemes with version 1.53
Mostly cosmetic and probably will not be noticed by the user, but I did fix a bug whereby when one transforms data to log daily returns, a missing value was left in the final spot, which is subsequently not handled by numerous other functions. So, any missing values (either at the end, or created from the transformation) are replaced by the mean of the resulting returns.Changes in extRemes with version 1.52
- One can now obtain return levels in an R object by typing a new object name in the Save As (optional) field of the Return Level Plot GUI (i.e., Click Plot followed by Return Level). A list object is returned, and assigned to an object with the Save As name, with values of the return period (period), the return values (values), and the lower and upper confidence intervals (if any).
- When obtaining confidence intervals via the profile likelihood method, the window now remains open with the values last entered remaining. This saves time when trying various different limits, etc. It is helpful for finding confidence intervals for multiple return levels.
Changes in extRemes with version 1.51
- The point-process algorithm has been fixed so that inclusion of covariates works correctly, if slowly. The function fpp has been added to replace use of the ismev function pp.fit, which uses an incorrect approximation to the exceedance rate when including covariates.
- Added some code written by Chris Ferro. Specifically, the following functions have been added: boot.matrix, boot.sequence, decluster.runs, decluster.intervals, and exi.intervals: and each function has an associated help file. In particular, the following features are now included with extRemes.
- Intervals estimator for extremal index now gives (bootstrap) confidence limits.
- It is now possible to decluster using intervals declustering (but not directly via GUIs).
- The runs declustering algorithm is now fast.
- Run length estimator has been fixed.
- A few typos in dataset help files have been corrected.
Changes in extRemes with version 1.50
The primary changes in the new version (1.50) of extRemes are:- Pertinent code executed by the GUIs is written to a log file (extRemes.log) ... more on this
- All other messages/output are displayed on the main R console instead of the console and/or the main toolkit dialog window.
- The current R workspace can now be saved from the main toolkit dialog ... more on this
- When data are read into R via the toolkit dialog, the current R workspace is saved, and a statistical summary of the data is given (e.g., upper and lower quartiles, min, max, mean, etc.).
- The class "ev.data" is now called "extRemesDataObject".
- There is a new function called as.extRemesDataObject. Use the command help( as.extRemesDataObject) for more on this function.
- More help files are included ... more on this
- Much more information is given when help( extRemes) is invoked.
- There is no longer a time series option under Plot ... more on this
- MLE estimation for routines that require the R function optim now defaults to the "BFGS" optimization method if no method is selected (instead of returning an error). [Note: as of version 1.58, this has been changed back to Nelder-Mead]
Pertinent code executed by the GUIs is written to a log file (extRemes.log), enabling the user to view the actual R commands carried out by each window action. The file is written to the directory whence R was launched. In Windows, the location of this directory may not be obvious (e.g., if a shortcut is used to open the file). Use the command getwd() from the R console prompt in order to find the path to this directory. Additionally for Windows, the extension '.log' may be invisible; look for the text file 'extRemes'.
Note: The log file can get to be very large as new commands are appended to the file. It is possible to clear this log file from the GUI windows at any time--the file will still be there, but will only display a messaging giving the date and time it was cleared. To do this, click on File > Clear log file from the main toolkit dialog.
Furthermore, note that list components are accessed using the full list.name[["component.name"]] notation because the shortcut notation, list.name$component.name, does not work properly when using eval; which is necessary in order to send the (exact) commands to a file. For example, to access the "data" component from a list, say it is called "Fort", one can do either of the following commands.
> Fort[["data"]] # As would be seen in extRemes.log
> Fort$data # As can be done from the command line.
The current R workspace can now be saved from the main toolkit dialog. To do this, click on File > Save from the main toolkit dialog.
More help files are included with extRemes. In particular, there are help files for every dataset provided with the toolkit. Use the command help( extRemes) to see a list of all of these datasets.
There is no longer a time series option under Plot. It was never a true time series. In particular, it did not make use of the R package ts. It had been a scatter plot with lines connecting points; though it was possible to plot a time series in this way. Instead, there is now a line option on the scatter plot dialog, which provides the same functionality as before.
R basics
For the most part, R code is identical across platforms. However, there are differences in appearance between Windows, Mac and Unix/Linux platforms, but almost every command (if not all of them) is the same. Below are some basic commands to assist you in using the extRemes toolkit, which does not require much knowledge of the R programming language to use effectively. For a more thorough introduction to R, please see "An Introduction to R" at the R project home page (click on Manuals under Documentation) at: http://www.r-project.org/To begin an R session in Windows, find the R icon or start menu button and click/double click on it as you would any other program in Windows. Note that R version >= 1.7.0 for Windows is required as it installs and configures the necessary (for this toolkit) Tcl/Tk software automatically.
To begin an R session in Unix or Linux, type the capital letter R from the command prompt.
Note that all R commands are functions, so they must be followed by a set of parentheses, which may be empty if there are no parameters to be entered. For example,
> date()
[1] "Tue Jul 8 14:02:33 2003"
If the parentheses are not given, then the source code of the function will be given. For example,
> date
function ()
.Internal(date())
If there are arguments to pass to the function, these are listed inside the parentheses. For example,
> plot(x=1:10)
The last command should produce an uninteresting plot of one-to-one points. to list out the arguments to any function, the args caommand is useful. For example,
> args( plot)
function (x, y, ...)
NULL
> args( rnorm)
function (n, mean = 0, sd = 1)
NULL
To get help on a function, say rnorm, type
> help( rnorm)
Or, simply
> ?rnorm
To assign a value to an object, the simplest method is to use the "<-" symbol. For example, to assign a vector of numbers from 1 to 4 to the object "foo", simply type:
> foo <- 1:4
To check the contents of foo, type:
> foo
[1] 1 2 3 4
Ignore the [1] here. It indicates that it is the first row of a vector (i.e., with only one row). The object foo is (temporarily) assigned to the current working directory. To see what the current working directory is, type:
> getwd()
[1] "/[path to current working directory shown]"
You can change the current working directory with the setwd function. It is possible to save the contents of your current working R session (e.g. to save foo for future R sessions). The saved R workspaces will be found in a file called .RData. To save the current working directory, use the command:
> save.image()
Finally, in order to exit out of R simply type:
> q()
R will ask if you wish to save the workspace image. Type 'y' for yes, 'n' for no and 'c' to cancel. It is also possible to instruct R whether to save the workspace or not in the following way:
> q("yes") # to save the workspace
> q("no") # to exit without saving the workspace.
In Windows, it is also possible to exit by clicking on the X in the upper right corner of the R gui, or by selecting Exit from the dropdown menu. Note that comments in R source code are indicated by the '#' sign.
Again, for more information about R, please refer to the R project website.
| "
Il est impossible que l'improbable n'arrive jamais." |