| Title: | Adapts the Regional Frequency Analysis to Air Temperature |
|---|---|
| Description: | Adapts the index-flood technique to extreme air temperature data. The package uses the additive approach proposed in Martins et al. (2022) <doi:10.1590/1678-4499.20220061> and adapt it to climate change conditions through the use of nonstationary parametric distributions. |
| Authors: | Gabriel Constantino Blain [aut, cre] (ORCID: <https://orcid.org/0000-0001-8832-7734>), Graciela R. Sobierajski [aut] (ORCID: <https://orcid.org/0000-0002-7211-9268>), Leticia L. Martins [aut] (ORCID: <https://orcid.org/0000-0002-0299-3005>), Adam H. Sparks [aut] (ORCID: <https://orcid.org/0000-0002-0061-8359>) |
| Maintainer: | Gabriel Constantino Blain <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.2.0.9000 |
| Built: | 2026-10-01 13:45:59 UTC |
| Source: | https://github.com/gabrielblain/nstemprfa |
This function calculates the Hosking and Wallis' discordance measure (discord) and the robust discordance measure (Neykov et al. 2007) https://doi.org/10.1029/2006WR005322 using the additive approach proposed in Martins et al. (2022) https://doi.org/10.1590/1678-4499.20220061.
Add_Discord(dataset)Add_Discord(dataset)
dataset |
A numeric matrix with extreme air temperature data from multiple sites. The first column must contain the years, and the remaining columns contain temperature data from each site. |
The discordance measures identify sites that are potentially discordant within a regional frequency analysis framework for extreme air temperature series.
A data.frame with 8 columns:
Site identifier.
Number of observations for each site.
First L-moment (mean).
Second L-moment (L-scale).
L-skewness ratio.
L-kurtosis ratio.
Fifth-order L-moment ratio.
Original discordance statistic indicating potential outlier status.
Add_Discord(TmaxCPC_SP)Add_Discord(TmaxCPC_SP)
Add_Heterogeneity
Add_Heterogeneity(dataset.add, rho, Ns)Add_Heterogeneity(dataset.add, rho, Ns)
dataset.add |
A numeric matrix of air temperature data as calculated by
|
rho |
A single numeric value describing the average inter-site correlation. Must be strictly between -1 and 1. |
Ns |
Number of simulated groups of series. Default is 100; at least 500 is recommended. |
Hosking and Wallis' heterogeneity measure using an additive approach,
as proposed in Martins et al. (2022)
doi:10.1590/1678-4499.20220061.
Returns NA if the regional distribution cannot be fitted or if
simulated statistics have zero variance.
add.data <- Dataset_add(TmaxCPC_SP) Add_Heterogeneity(dataset.add = add.data$add_data, rho = 0.51, Ns = 500)add.data <- Dataset_add(TmaxCPC_SP) Add_Heterogeneity(dataset.add = add.data$add_data, rho = 0.51, Ns = 500)
Add_RegProb
Add_RegProb(quantiles, regional_pars, site_temp, n.year)Add_RegProb(quantiles, regional_pars, site_temp, n.year)
quantiles |
A numeric vector with no missing data containing extreme air temperatures. |
regional_pars |
A 6-column, 1-row |
site_temp |
A non-empty numeric vector or 1-column matrix of site air temperature data. |
n.year |
A single integer giving the year index for which parameters are calculated.
Must be between 1 and |
A numeric matrix of cumulative probabilities (clamped to [0.0001, 0.9999]) associated with the input quantiles from the regional GEV distribution.
quantiles <- c(37.8, 37.9, 38.0, 38.1, 38.2, 38.5, 39.0) add.data <- Dataset_add(TmaxCPC_SP) best.parms <- Best_model(add.data = add.data$add_data) regional_pars <- Reg_par(best_model = best.parms$atsite.models) Add_RegProb( quantiles = quantiles, regional_pars = regional_pars, site_temp = TmaxCPC_SP$Pixel_1, n.year = 34 )quantiles <- c(37.8, 37.9, 38.0, 38.1, 38.2, 38.5, 39.0) add.data <- Dataset_add(TmaxCPC_SP) best.parms <- Best_model(add.data = add.data$add_data) regional_pars <- Reg_par(best_model = best.parms$atsite.models) Add_RegProb( quantiles = quantiles, regional_pars = regional_pars, site_temp = TmaxCPC_SP$Pixel_1, n.year = 34 )
Computes quantiles for a given site based on regional GEV parameters and a time-varying location and scale model. Estimated quantiles are adjusted by the site's mean temperature.
Add_RegQuant(prob, regional_pars, site_temp, n.year)Add_RegQuant(prob, regional_pars, site_temp, n.year)
prob |
A numeric vector of probabilities strictly between 0 and 1, with no missing values. |
regional_pars |
A 1-row, 6-column |
site_temp |
A numeric vector or 1-column matrix of site air temperature data. |
n.year |
A single integer indicating the year index for which quantiles are
calculated. Must be between 1 and |
A named numeric vector of adjusted regional quantiles for the specified
year. Names are of the form "Q90", '"Q95"“, etc.
prob <- c(0.90, 0.92, 0.93, 0.94, 0.95, 0.97, 0.99) add.data <- Dataset_add(TmaxCPC_SP) best.parms <- Best_model(add.data = add.data$add_data) regional_pars <- Reg_par(best_model = best.parms$atsite.models) Add_RegQuant( prob = prob, regional_pars = regional_pars, site_temp = TmaxCPC_SP$Pixel_1, n.year = 34 )prob <- c(0.90, 0.92, 0.93, 0.94, 0.95, 0.97, 0.99) add.data <- Dataset_add(TmaxCPC_SP) best.parms <- Best_model(add.data = add.data$add_data) regional_pars <- Reg_par(best_model = best.parms$atsite.models) Add_RegQuant( prob = prob, regional_pars = regional_pars, site_temp = TmaxCPC_SP$Pixel_1, n.year = 34 )
This function fits six time-varying GEV models (with different assumptions on non-stationarity in location and/or scale) to each temperature series, computes the AICc of each model, and selects the best one according to the lowest total AICc.
Best_model(add.data)Best_model(add.data)
add.data |
A numeric matrix of air temperature data as calculated by |
Model fitting is performed via ismev::gev.fit(), using a log link for the
scale parameter (which keeps the scale positive at all times). Six models
are considered:
Stationary (constant location and scale).
Linear time-varying location only.
Log-linear time-varying scale only.
Linear time-varying location and log-linear time-varying scale.
Quadratic time-varying location only, GEV(2,0,0).
Quadratic time-varying location and log-linear time-varying scale, GEV(2,1,0).
To reduce the collinearity between t and t^2, the models are fitted using
a centred and standardised time variable. The estimates are then
converted back to the original time index (t = 1, 2, ..., size), so the
reported parameters refer to t, not to the standardised variable.
For each site the function tries up to five optimisation methods
(Nelder-Mead, BFGS, CG, L-BFGS-B, SANN)
and uses the first that converges. Model selection is based on the sum of
site-level AICc values.
A list with:
Index (1–6) of the model with the lowest total AICc across all sites.
Data frame containing the estimated parameters
(mu0, mu1, mu2, sigma0, sigma1, shape)
and sample size for each site. The location is
mu(t) = mu0 + mu1 * t + mu2 * t^2 and the scale is
sigma(t) = sigma0 * exp(sigma1 * t), where t = 1, 2, ..., size.
Thus sigma0 is the scale at t = 0 and sigma1 is the log rate of
change of the scale. Parameters that are not part of the
selected model are set to zero.
add.data <- Dataset_add(TmaxCPC_SP) best.parms <- Best_model(add.data = add.data$add_data)add.data <- Dataset_add(TmaxCPC_SP) best.parms <- Best_model(add.data = add.data$add_data)
dataset_add
Dataset_add(dataset)Dataset_add(dataset)
dataset |
A numeric matrix with extreme air temperature data from multiple sites. The first column must contain the years, and the remaining columns contain temperature data from each site. |
A list object with the following elements:
A matrix of centered temperature values for each site.
Mean temperature values for each site.
Dataset_add(TmaxCPC_SP)Dataset_add(TmaxCPC_SP)
Time-varying parameters of a given GEV model
Fit_model(temperatures, model)Fit_model(temperatures, model)
temperatures |
A vector or single-column matrix of air temperature data, either original or centered by subtracting the sample mean. |
model |
A single integer between 1 and 6 defining the GEV model
(see |
The function attempts to fit the model using ismev::gev.fit() with
a log link for the scale parameter (which keeps the scale positive at all
times) and the following optimisers in sequence:
Nelder-Mead, BFGS, CG, L-BFGS-B, SANN.
The first optimiser that converges is used; if all fail, NAs are
returned for that site.
Internally, the series is centred on its mean and a standardised time
variable is used to reduce the collinearity between t and t^2. The
estimates are converted back to the original units and to the original
time index, so mu0 is expressed in the same units as temperatures.
A data.frame containing the estimated parameters
(mu0, mu1, mu2, sigma0, sigma1, shape, size).
The location is mu(t) = mu0 + mu1 * t + mu2 * t^2 and the scale is
sigma(t) = sigma0 * exp(sigma1 * t), where t = 1, 2, ..., size.
Thus sigma0 is the scale at t = 0 and sigma1 is the log rate of
change of the scale (sigma1 = 0 means a constant scale).
Parameters that are not part of the selected model are set to
zero. If fitting fails for a site, NAs are returned for
that site.
temperatures <- TmaxCPC_SP$Pixel_1 model <- 4 Fit_model(temperatures, model) # Quadratic time-varying location and log-linear time-varying scale Fit_model(temperatures, model = 6)temperatures <- TmaxCPC_SP$Pixel_1 model <- 4 Fit_model(temperatures, model) # Quadratic time-varying location and log-linear time-varying scale Fit_model(temperatures, model = 6)
TmaxCPC_SP seriesGeographical coordinates of the TmaxCPC_SP series
lonlat_Tmaxlonlat_Tmax
lonlat_TmaxA data.frame with 2 columns and 10 rows.
Longitude in decinal degrees
Latitude in decinal degrees
Estimate the parameters of the regional distribution
Reg_par(best_model)Reg_par(best_model)
best_model |
A 7-column
|
A one-row data.frame with the size-weighted regional parameters of a
time-varying generalized extreme value distribution.
add.data <- Dataset_add(TmaxCPC_SP) best.parms <- Best_model(add.data = add.data$add_data) Reg_par(best_model = best.parms$atsite.models)add.data <- Dataset_add(TmaxCPC_SP) best.parms <- Best_model(add.data = add.data$add_data) Reg_par(best_model = best.parms$atsite.models)
Confidence intervals for regional GEV parameters
Reg_parCI(add_data, model, reg_par, n.boots = 999, progress = NULL)Reg_parCI(add_data, model, reg_par, n.boots = 999, progress = NULL)
add_data |
A numeric matrix of air temperature data as calculated by |
model |
A single integer number from 1 to 4 defining the GEV model.
May be provided by |
reg_par |
A 6-column and 1-row data.frame or matrix as generated by
|
n.boots |
A single number describing the number of bootstrap replicates.
Whenever possible, |
progress |
Logical scalar controlling whether a progress bar is displayed.
|
A matrix containing the 95% confidence intervals (lower and upper bounds) of the time-varying parameter estimates. The spatial dependence between sites is preserved.
add.data <- Dataset_add(TmaxCPC_SP) best.parms <- Best_model(add.data = add.data$add_data) regional.parms <- Reg_par(best_model = best.parms$atsite.models) Reg_parCI( add_data = add.data$add_data, model = best.parms$best, reg_par = regional.parms, n.boots = 100 )add.data <- Dataset_add(TmaxCPC_SP) best.parms <- Best_model(add.data = add.data$add_data) regional.parms <- Reg_par(best_model = best.parms$atsite.models) Reg_parCI( add_data = add.data$add_data, model = best.parms$best, reg_par = regional.parms, n.boots = 100 )
Confidence intervals for site-specific GEV parameters
Site_parCI(atsite_temp, model, site_par, n.boots = 999, progress = NULL)Site_parCI(atsite_temp, model, site_par, n.boots = 999, progress = NULL)
atsite_temp |
A numeric vector or single-column matrix of air temperature data. |
model |
A single integer from 1 to 4 defining the GEV model. |
site_par |
A 1-row, 5-column data.frame or matrix generated by Fit_model(). |
n.boots |
Number of bootstrap replicates. Values smaller than 100 are not allowed.
Defaults to |
progress |
Logical scalar controlling whether a progress bar is displayed.
|
A matrix containing the lower and upper 95% confidence limits of the estimated parameters.
temperatures <- TmaxCPC_SP$Pixel_1 model <- 5 site_par <- Fit_model(temperatures, model) Site_parCI( atsite_temp = temperatures, model = model, site_par = site_par[1, 1:6], n.boots = 100 )temperatures <- TmaxCPC_SP$Pixel_1 model <- 5 site_par <- Fit_model(temperatures, model) Site_parCI( atsite_temp = temperatures, model = model, site_par = site_par[1, 1:6], n.boots = 100 )
Daily extremes for air temperature data sampled from the block maxima approach. A block corresponds to one year. The data belongs to The Climate Prediction Center - NOAA. location of Ribeirao Preto, State of Sao Paulo in Brazil.
TmaxCPC_SPTmaxCPC_SP
TmaxCPC_SPA data.frame with 11 columns and 34 rows.
Year
daily extremes for air temperature