Description Usage Arguments Details Value Optimization failures Author(s) References Examples

Compute risk ratio and uncertainty by fitting generalized extreme value model, designed specifically for climate data, to exceedance-only data, using the point process approach. The risk ratio is the ratio of the probability of exceedance of a pre-specified value under the model fit to the first dataset to the probability under the model fit to the second dataset. Default standard errors are based on the usual MLE asymptotics using a delta-method-based approximation, but standard errors based on the nonparametric bootstrap and on a likelihood ratio procedure can also be computed.

1 2 3 4 5 6 7 8 9 10 11 | ```
calc_riskRatio_gev(returnValue, y1, y2, x1 = NULL, x2 = x1,
locationFun1 = NULL, locationFun2 = locationFun1, scaleFun1 = NULL,
scaleFun2 = scaleFun1, shapeFun1 = NULL, shapeFun2 = shapeFun1,
nReplicates1 = 1, nReplicates2 = 1, replicateIndex1 = NULL,
replicateIndex2 = NULL, weights1 = NULL, weights2 = NULL,
xNew1 = NULL, xNew2 = NULL, maxes = TRUE, scaling1 = 1,
scaling2 = 1, ciLevel = 0.9, bootCI = FALSE, bootControl = list(seed =
1, n = 250, by = "block"), lrtCI = FALSE, lrtControl = list(bounds =
c(0.01, 100)), optimArgs = list(method = "Nelder-Mead"), initial1 = NULL,
initial2 = NULL, logScale1 = NULL, logScale2 = NULL,
getReturnCalcs = FALSE, getParams = FALSE, getFit = FALSE)
``` |

`returnValue` |
numeric value giving the value for which the risk ratio should be calculated, where the resulting period will be the average number of blocks until the value is exceeded and the probability the probability of exceeding the value in any single block. |

`y1` |
a numeric vector of observed maxima or minima values for the first dataset. See |

`y2` |
a numeric vector of observed maxima or minima values for the second dataset. Analogous to |

`x1` |
a data frame, or object that can be converted to a data frame with columns corresponding to covariate/predictor/feature variables and each row containing the values of the variable for the corresponding observed maximum/minimum. The number of rows should either equal the length of |

`x2` |
analogous to |

`locationFun1` |
formula, vector of character strings, or indices describing a linear model (i.e., regression function) for the location parameter using columns from |

`locationFun2` |
formula, vector of character strings, or indices describing a linear model (i.e., regression function) for the location parameter using columns from |

`scaleFun1` |
formula, vector of character strings, or indices describing a linear model (i.e., regression function) for the log of the scale parameter using columns from |

`scaleFun2` |
formula, vector of character strings, or indices describing a linear model (i.e., regression function) for the log of the scale parameter using columns from |

`shapeFun1` |
formula, vector of character strings, or indices describing a linear model (i.e., regression function) for the shape parameter using columns from |

`shapeFun2` |
formula, vector of character strings, or indices describing a linear model (i.e., regression function) for the shape parameter using columns from |

`nReplicates1` |
numeric value indicating the number of replicates for the first dataset. |

`nReplicates2` |
numeric value indicating the number of replicates for the second dataset. |

`replicateIndex1` |
numeric vector providing the index of the replicate corresponding to each element of |

`replicateIndex2` |
numeric vector providing the index of the replicate corresponding to each element of |

`weights1` |
a vector providing the weights for each observation in the first dataset. When there is only one replicate or the weights do not vary by replicate, a vector of length equal to the number of observations. When weights vary by replicate, this should be of equal length to |

`weights2` |
a vector providing the weights for each observation in the second dataset. Analogous to |

`xNew1` |
object of the same form as |

`xNew2` |
object of the same form as |

`maxes` |
logical indicating whether analysis is for block maxima (TRUE) or block minima (FALSE); in the latter case, the function works with the negative of the values, changing the sign of the resulting location parameters |

`scaling1` |
positive-valued scalar used to scale the data values of the first dataset for more robust optimization performance. When multiplied by the values, it should produce values with magnitude around 1. |

`scaling2` |
positive-valued scalar used to scale the data values of the second dataset for more robust optimization performance. When multiplied by the values, it should produce values with magnitude around 1. |

`ciLevel` |
statistical confidence level for confidence intervals; in repeated experimentation, this proportion of confidence intervals should contain the true risk ratio. Note that if only one endpoint of the resulting interval is used, for example the lower bound, then the effective confidence level increases by half of one minus |

`bootCI` |
logical indicating whether to use the bootstrap to estimate a confidence interval (and standard error). |

`bootControl` |
a list of control parameters for the bootstrapping. See |

`lrtCI` |
logical indicating whether to calculate a likelihood ratio-based confidence interval |

`lrtControl` |
list containing a single component, |

`optimArgs` |
a list with named components matching exactly any arguments that the user wishes to pass to |

`initial1` |
a list with components named |

`initial2` |
a list with components named |

`logScale1` |
logical indicating whether optimization for the scale parameter should be done on the log scale for the first dataset. By default this is FALSE when the scale is not a function of covariates and TRUE when the scale is a function of covariates (to ensure the scale is positive regardless of the regression coefficients). |

`logScale2` |
logical indicating whether optimization for the scale parameter should be done on the log scale for the second dataset. By default this is FALSE when the scale is not a function of covariates and TRUE when the scale is a function of covariates (to ensure the scale is positive regardless of the regression coefficients). |

`getReturnCalcs` |
logical indicating whether to return the estimated return values/probabilities/periods from the fitted models. |

`getParams` |
logical indicating whether to return the fitted parameter values and their standard errors for the fitted models; WARNING: parameter values for models with covariates for the scale parameter must interpreted based on the value of |

`getFit` |
logical indicating whether to return the full fitted models (potentially useful for model evaluation and for understanding optimization problems); note that estimated parameters in the fit object for nonstationary models will not generally match the MLE provided when |

See `fit_gev`

for more details on fitting the block maxima model for each dataset, including details on blocking and replication. Also see `fit_gev`

for information on the `bootControl`

argument.

The primary outputs of this function are as follows: the log of the risk ratio and standard error of that log risk ratio (`logRiskRatio`

and `se_logRiskRatio`

) as well the risk ratio itself (`riskRatio`

) and a confidence interval (`ci_riskRatio`

) for the risk ratio. The standard error and confidence interval are based on the usual MLE asymptotics using a delta-method-based approximation. If requested via `bootCI`

or `lrtCI`

, confidence intervals based on the nonparametric bootstrap and on a likelihood ratio procedure can also be computed.

It is not uncommon for maximization of the log-likelihood to fail for extreme value models. Please see the help information for `fit_gev`

. Also note that if the probability in the denominator of the risk ratio is near 1, one may achieve better numerical performance by swapping the two datasets and computing the risk ratio for the probability under dataset 2 relative to the probability under dataset 1.

Christopher J. Paciorek

Jeon S., C.J. Paciorek, and M.F. Wehner. 2016. Quantile-based bias correction and uncertainty quantification of extreme event attribution statements. Weather and Climate Extremes 12: 24-32. doi: 10.1016/j.wace.2016.02.001. arXiv preprint: http://arxiv.org/abs/1602.04139.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ```
require(extRemes)
data(Fort)
FortMax <- aggregate(Prec ~ year, data = Fort, max)
earlyYears <- 1900:1929
lateYears <- 1970:1999
earlyPeriod <- which(FortMax$year %in% earlyYears)
latePeriod <- which(FortMax$year %in% lateYears)
# contrast late period with early period, assuming a nonstationary fit
# within each time period and finding RR based on midpoint of each period
# lrtCI set to FALSE here to limit time in running examples on CRAN
out <- calc_riskRatio_gev(returnValue = 3,
y1 = FortMax$Prec[earlyPeriod], y2 = FortMax$Prec[latePeriod],
x1 = data.frame(years = earlyYears), x2 = data.frame(years = lateYears),
locationFun1 = ~years, locationFun2 = ~years,
xNew1 = data.frame(years = mean(earlyYears)),
xNew2 = data.frame(years = mean(lateYears)),
lrtCI = FALSE)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.