Learn R Programming

loopevd (version 1.0.2)

df_fevd: Fit EVD Parameters to Rows of a Data Frame of Annual Maxima

Description

Fits an extreme value distribution (EVD) to each row of a data.frame, where each row represents a time series of annual maxima. Optionally includes non-stationary covariates in the location parameter. Parallel processing is used to improve efficiency.

Usage

df_fevd(
  varbIN,
  cores = 1,
  ntries = 1,
  evd_mod_str = "fgumbel",
  nsloc = NULL,
  seed = NULL
)

Value

A data.frame with one row per input time series, containing the fitted EVD parameters returned by evd_params().

Arguments

varbIN

A numeric data.frame where each row is a vector of annual maxima values (e.g., one row per location or site).

cores

An integer specifying the number of parallel cores to use for computation.

ntries

The integer number of tries to fit the evd

evd_mod_str

A character string specifying the EVD fitting function to use. Must be one of "fgumbel", "fgumbelx", or "fgev".

nsloc

Optional data.frame of covariates for non-stationary location modelling. Must have the same number of rows as varbIN.

seed

Optional integer for reproducibility. If supplied, a random seed will be set before model fitting.

Details

Each row of varbIN is passed to evd_params(), optionally with a corresponding row of covariates from nsloc. Covariates are internally standardised if provided. The function constructs a blank parameter structure (empty_evd_params) to ensure consistent output structure, even if fitting fails.

Parallel computation is performed using parLapply.

See Also

list_fevd to apply EVD fitting to a list of annual maxima, evd_params for direct fitting to a single time series. #'

Examples

Run this code
set.seed(42)
df <- as.data.frame(matrix(evd::rgev(1000), nrow = 100))
results <- df_fevd(df, cores = 1, evd_mod_str = "fgumbel")

Run the code above in your browser using DataLab