Learn R Programming

ffaframework (version 0.1.0)

fit_mle: Maximum Likelihood Parameter Estimation

Description

Estimates the parameters of a probability distribution by maximizing the log‐likelihood. Initial parameter estimates are obtained using the method of L‐moments and optimization is performed via stats::nlminb() with repeated perturbations if needed.

For NS-FFA: To estimate parameters for a nonstationary model, include the observation years (ns_years) and the nonstationary model structure (ns_structure).

Usage

fit_mle(data, distribution, ns_years = NULL, ns_structure = NULL)

Value

A list containing the results of parameter estimation:

  • data: The data argument.

  • distribution: The distribution argument.

  • ns_years: The ns_years argument, if given.

  • ns_structure: The ns_structure argument, if given.

  • method: "MLE".

  • params: Numeric vector of estimated parameters.

  • mll: The maximum value of the log‐likelihood.

Arguments

data

Numeric vector of observed annual maximum series values. Must be strictly positive, finite, and not missing.

distribution

A three-character code indicating the distribution family. Must be "GUM", "NOR", "LNO", "GEV", "GLO", "GNO", "PE3", "LP3", or "WEI".

ns_years

For NS-FFA only: Numeric vector of observation years corresponding to data. Must be the same length as data and strictly increasing.

ns_structure

For NS-FFA only: Named list indicating which distribution parameters are modeled as nonstationary. Must contain two logical scalars:

  • location: If TRUE, the location parameter has a linear temporal trend.

  • scale: If TRUE, the scale parameter has a linear temporal trend.

Details

  1. Calls fit_lmoments() on data to obtain initial parameter estimates.

  2. Initializes trend parameters to zero if necessary.

  3. For WEI models, sets the location parameter to zero to ensure support.

  4. Defines an objective function using utils_log_likelihood().

  5. Runs stats::nlminb() with box constraints. Attempts minimization up to 100 times.

See Also

utils_log_likelihood(), fit_lmoments(), stats::nlminb()

Examples

Run this code
data <- rnorm(n = 100, mean = 100, sd = 10)
ns_years <- seq(from = 1901, to = 2000)
ns_structure <- list(location = TRUE, scale = FALSE)
fit_mle(data, "GNO", ns_years, ns_structure)

Run the code above in your browser using DataLab