Learn R Programming

fExtremes (version 201.10059)

GevFit: Modelling the GEV Distribution

Description

A collection and description of functions to model the Generalized Extreme Value, GEV, distribution based on R's 'evir' package. Two types of approaches for parameter estimation are provided: Maximum likelihood estimation and probability weighted moment method. The functions are: ll{ gevSim generates data from the GEV, gevFit fits empirical or simulated data to the distribution, print print method for a fitted GEV object, plot plot method for a fitted GEV object, summary summary method for a fitted GEV object, gevrlevelPlot k-block return level with confidence intervals. }

Usage

gevSim(model = list(shape = 0.25, location = 0, scale = 1), n = 1000)
gevFit(x, block = NA, type = c("mle", "pwm"), gumbel = FALSE, ...)

## S3 method for class 'gevFit':
print(x, \dots)
## S3 method for class 'gevFit':
plot(x, which = "all", \dots)
## S3 method for class 'gevFit':
summary(object, doplot = TRUE, which = "all", \dots)

gevrlevelPlot(object, k.blocks = 20, add = FALSE, ...)

Arguments

add
[gevrlevelPlot] - whether the return level should be added graphically to a time series plot; if FALSE a graph of the profile likelihood curve showing the return level and its confidence interval is produced.
block
[gevFit] - the block size. Only used if method="mle" is selected. A numeric value is interpreted as the number of data values in each successive block. All the data is used, so the last block may not contain
doplot
a logical. Should the results be plotted?
gumbel
[gevFit] - a logical, by default FALSE. To fit a Gumbel model with fixed shape=0 set gumbel=TRUE.
k.blocks
[gevrlevelPlot] - specifies the particular return level to be estimated; default set arbitrarily to 20.
model
[gevSim] - a list with components shape, location and scale giving the parameters of the GEV distribution. By default the shape parameter has the value 0.25, the location is zero and the
n
[gevSim] - number of generated data points, an integer value.
object
[summary][grlevelPlot] - a fitted object of class "gevFit".
type
a character string denoting the type of parameter estimation, either by maximum likelihood estimation "mle", the default value, or by the probability weighted moment menthod "pwm".
which
[plot][summary] - a vector of logicals, one for each plot, denoting which plot should be displayed. Alkternatively if which="ask" the user will be interactively asked which of the plots should be desplayed. By def
x
[gevFit] - data vector. In the case of method="mle" the interpretation depends on the value of block: if no block size is specified then data are interpreted as block maxima; if block size is set, then data are i
...
[gevFit] - control parameters optionally passed to the optimization function. Parameters for the optimization function are passed to components of the control argument of optim. [plot][summ

Value

  • gevSim returns a vector of datapoints from the simulated series. gevFit returns an object of class gev describing the fit. print.summary prints a report of the parameter fit. summary performs diagnostic analysis. The method provides two different residual plots for assessing the fitted GEV model. gevrlevelPlot returns a vector containing the lower 95% bound of the confidence interval, the estimated return level and the upper 95% bound.

Details

Parameter Estimation: gevFit estimates the parameters either by the probability weighted moment method, method="pwm" or by maximum log likelihood estimation method="mle". As a limiting case the Gumbel distribution can be selected. The summary method produces diagnostic plots for fitted GEV or Gumbel models. Methods: print.gev, plot.gev and summary.gev are print, plot, and summary methods for a fitted object of class gev. Concerning the summary method, the data are converted to unit exponentially distributed residuals under null hypothesis that GEV fits. Two diagnostics for iid exponential data are offered. The plot method provides two different residual plots for assessing the fitted GEV model. Two diagnostics for iid exponential data are offered. Return Level Plot: gevrlevelPlot calculates and plots the k-block return level and 95% confidence interval based on a GEV model for block maxima, where k is specified by the user. The k-block return level is that level exceeded once every k blocks, on average. The GEV likelihood is reparameterized in terms of the unknown return level and profile likelihood arguments are used to construct a confidence interval.

References

Embrechts, P., Klueppelberg, C., Mikosch, T. (1997); Modelling Extremal Events, Springer.

See Also

GevGlmFit, GevDistribution.

Examples

Run this code
## gevSim -
## gevFit -
   # Simulate GEV Data:
   xmpExtremes("Start: Simulte GEV Sample >")
   # Use default length n=1000
   x = gevSim(model = list(shape = 0.25, location =0 , scale = 1))
   # Fit GEV Data by Probability Weighted Moments:
   fit = gevFit(x, type = "pwm") 
   print(fit)
   # Summarize Results:
   par(mfcol = c(3, 2))
   summary(fit)
   
## gevFit -
   # Fit GEV Data by Max Log Likelihood Method:
   xmpExtremes("Next: Estimate Parameters >")
   fit = gevFit(x, type = "mle") 
   print(fit)
   # Summarize Results:
   summary(fit) 
    
## gevSim -
## gevFit -
   # Simulate Gumbel Data:
   xmpExtremes("Next: Simulte Gumbel Sample >")
   # Use default length n=1000
   ##> x = gevSim(model = list(shape = 0, location = 0, scale = 1))
   # Fit Gumbel Data by Probability Weighted Moments:
   ##> fit = gevFit(x, type = "pwm", gumbel = TRUE) 
   ##> print(fit)
   # Summarize Results:
   ##> par(mfcol = c(3, 2))
   ##> summary(fit)  
   
## Fit Gumbel Data by Max Log Likelihood Method:
   xmpExtremes("Next: Estimate Parameters >")
   ##> fit = gevFit(x, type = "mle", gumbel = TRUE) 
   ##> print(fit)
   # Summarize Results:
   ##> summary(fit)     
   ##> xmpExtremes("Press any key to continue >") 
   
## Return levels based on GEV Fit:
   # BMW Stock Data:
   xmpExtremes("Next: Compute BMW Return Levels >")
   par(mfrow = c(2, 1))
   data(bmw)
   # Fit GEV to monthly Block Maxima:
   fit = gevFit(-bmw, block = "month") 
   # Calculate the 40 month return level
   gevrlevelPlot(fit, k.block = 40, main = "BMW: Return Levels")   
   
## Return levels based on GEV Fit:
   xmpExtremes("Next: Compute SIEMENS Return Levels >")
   # Siemens Stock Data:
   data(siemens)
   # Fit GEV to monthly Block Maxima:
   fit = gevFit(-siemens, block = "month") 
   # Calculate the 40 month return level
   gevrlevelPlot(fit, k.block = 40, main = "SIEMENS: Return Levels")
   
## Interactive Plot:
   ##> par(mfrow = c(1, 1), ask = TRUE)
   ##> plot(fit)

Run the code above in your browser using DataLab