Learn R Programming

lmomRFA (version 2.0)

regfit: Fit a regional frequency distribution

Description

Fits a frequency distribution to a vector of regional average $L$-moments. Returns an object of class "rfd", which contains the specification of the regional frequency distribution: the quantile function, parameters of the regional growth curve, and the index-flood values (site-specific scale factors) for each site.

Usage

regfit(regdata, dist)

Arguments

regdata
Object of class regdata, containing summary statistics of the data for the sites in a region.
dist
Character string specifying the distribution to be fitted. See Details below.

Value

  • An object of class "rfd", containing the specification of the regional frequency distribution: It is a list with the following elements:
  • distThe character string dist.
  • paraVector containing the parameters of the fitted regional distribution.
  • qfuncThe quantile function of distribution dist. It is a function that takes a single argument, a vector of probabilities, and returns a vector of quantiles.
  • rmomThe regional average $L$-moments.
  • indexIndex flood values at each site. This is a named vector whose values are the index flood values at each site, from regdata[[3]], and whose names are the site names, from regdata[[1]].

synopsis

print.rfd(x, ...)

Details

The function computes regional average $L$-moments (by calling regavlmom) and fits a probability distribution to the regional average $L$-moments. For distribution dist there should exist a function to estimate the parameters of the distribution given a set of $L$-moments. The function should have a name that is the character string "pel" followed by the character string dist. It should accept a single argument, a vector containing $L$-moments $\ell_1$, $\ell_2$, $t_3$, $t_4$, etc., and return a vector of distribution parameters. For distribution dist there should also exist a quantile function, which should have a name that is the character string "qua" followed by the character string dist. It should accept two arguments: a vector of probabilities and a vector containing the parameters of the distribution. The estimation routines and quantile functions in package lmom have the form described here. For example, to fit a generalized extreme value distribution set dist to be the string "gev"; then the fitting function pelgev and the quantile function quagev will be used.

Examples

Run this code
data(Cascades)                  # An object of class "regdata"
rfit <- regfit(Cascades, "gno") # Fit a generalized normal distribution
rfit                            # Print details of the fitted distribution
                                #   (components 'dist' and 'para')
rfit$index                      # Index flood values

evplot(rfit)                    # Plot the regional growth curve
evplot(qfunc=rfit$qfunc)        # The same, but with more typing
evplot(qfunc=regqfunc(rfit))    # The same, with still more typing

Run the code above in your browser using DataLab