retPlot: Plots of return curves and confidence intervals estimated by...

View source: R/ismevExtension.R

retPlotR Documentation

Plots of return curves and confidence intervals estimated by the delta method

Description

This function is based on the ismev::gev.rl function but also allows the case in which historical data are added to the systematic record. It plots the return curve (flood frequency curve in hydrology) based on the data and the fitted parameters for a glo.fit or gev.fit object, including ones with historical data. The data points are plotted using the Gringorten plotting positions. The function also outputs useful the estimated return levels and the corresponding standard error as estimated via the delta method (see Coles, 2001).

Usage

retPlot(
  obj,
  p = NULL,
  sign.alpha = 0.05,
  plot.out = TRUE,
  vtype = "redVar",
  pch = par()$pch,
  pchHist = 15,
  ...
)

Arguments

obj

a glo.fit or gev.fit object

p

non-exceedance probabilities for which return level and standard errors are calculated. If the given non-exceedance probability don't cover the whole range of empirical non-exceedance probabilities of the data the figure will automatically draw a line covering the whole range, but the output dataframe will only contain the specified non-exceedance probabilities.

sign.alpha

significance level required for the confidence intervals - default to 0.05

plot.out

logical, indicating whether the plot should actually be displayed; set to FALSE to only compute the return levels and standard errors

vtype

a character specifying the reduced variate type to be used in the figure. The types allowed are "Gumbel", corresponding to -log(-log(p)), and "redVar", corresponding to log(p/(1-p)). The default is set to "redVar".

pch

pch parameter to be used for the (systematic) data - default to the current setting in par

pchHist

pch parameter to be used for the historical data (if present) - default to 15

...

Arguments to be passed to methods, such as graphical parameters (see par)

Value

a return levels figure and a data.frame containing the estimated return levels and corresponding standard errors for the specified exceedance probabilities

Examples

set.seed(7821567)
xx <- rglo(500, 40, 6, -0.2)
xxsist <- xx[471:500]; xxhist <- xx[1:470][xx[1:470] > 80]
s1 <- glod.fit(xxsist, show=FALSE) 
rls1 <- retPlot(s1, sign.alpha = 0.1, col = 4, 
   p = c(seq(0.01,0.991,length=45),seq(0.992,0.9992,length=120)))
h1 <- glo.hist.fit(c(xxhist,xxsist), 
   k = length(xxhist), h = 470, X0 = 80, show=FALSE)
rlh1 <- retPlot(h1, vtype = "Gumbel", col = 1, 
   sign.alpha = 0.05, p = rls1$p, 
   xlab = "Gumbel reduced variate (-log(-log(1-1/T)))")
lines(-log(-log(rls1$p)), rls1$retLev, col = 2)
lines(-log(-log(rls1$p)), 
   rls1$retLev+qnorm(0.025)*rls1$se, lty = 2, col = 2)
lines(-log(-log(rls1$p)), 
   rls1$retLev-qnorm(0.025)*rls1$se, lty = 2, col = 2)
legend("topleft", col =c(1,2),
   legend = c("With historical","Systematic Only"), lty = 1)
## similar fitted curve - but large reduction in uncertainty for rare events

ilapros/ilaprosUtils documentation built on April 6, 2023, 4:44 a.m.