Learn R Programming

lmomRFA (version 3.8)

regsimh: Simulate the distribution of heterogeneity and goodness-of-fit measures

Description

Estimates, using Monte Carlo simulation, the distribution of heterogeneity and goodness-of-fit measures for regional frequency analysis. These are the statistics \(H\) and \(Z^{\rm DIST}\) defined respectively in sections 4.3.3 and 5.2.3 of Hosking and Wallis (1997).

Usage

regsimh(qfunc, para, cor = 0, nrec, nrep = 500, nsim = 500)

Value

An object of class "regsimh". This is a list with the following components:

nrep

The number of simulated regions (argument nrep).

nsim

The number of simulation used within each region (argument nsim).

results

Matrix of dimension 8 \(\times\) nrep, containing the values, for each of the nrep simulated regions, of the heterogeneity and goodness-of-fit measures.

means

Vector of length 8, containing the mean values, across the nrep simulated regions, of the three heterogeneity and five goodness-of-fit measures.

Arguments

qfunc

List containing the quantile functions for each site. Can also be a single quantile function, which will be used for each site.

para

Parameters of the quantile functions at each site. If qfunc is a list, para must be a list of the same length whose components are numeric vectors, the parameters of the corresponding component of qfunc. If qfunc is a single quantile function, para can be a single vector, containing a single set of parameter values that will be used for each site; a matrix or data frame whose rows each contain the parameter values for one site; or a list of length length(nrec) whose components are numeric vectors, each containing the parameter values for one site.

cor

Specifies the correlation matrix of the frequency distribution of each site's data. Can be a matrix (which will be rescaled to a correlation matrix if necessary) or a constant (which will be taken as the correlation between each pair of sites).

nrec

Numeric vector containing the record lengths at each site.

nrep

Number of simulated regions.

nsim

Number of simulations used, within each of the nrep simulated regions, when calculating heterogeneity and goodness-of-fit measures.

Author

J. R. M. Hosking jrmhosking@gmail.com

Details

A realization is generated of data simulated from the region specified by parameters qfunc, para, and cor, and with record lengths at each site specified by argument nrec. The simulation procedure is as described in Hosking and Wallis (1997), Table 6.1, through step 3.1.2. Heterogeneity and goodness-of-fit measures are computed for the realization, using the same method as in function regtst. The entire procedure is repeated nrep times, and the values of the heterogeneity and goodness-of-fit measures are saved. Average values, across all nrep realizations, of the heterogeneity and goodness-of-fit measures are computed.

References

Hosking, J. R. M., and Wallis, J. R. (1997). Regional frequency analysis: an approach based on \(L\)-moments. Cambridge University Press.

See Also

regtst for details of the heterogeneity and goodness-of-fit measures.

Examples

Run this code
if (FALSE)  
data(Cascades)            # A regional data set

rmom<-regavlmom(Cascades) # Regional average L-moments

# Set up an artificial region to be simulated:
# -- Same number of sites as Cascades
# -- Same record lengths as Cascades
# -- Mean 1 at every site (results do not depend on the site means)
# -- L-CV varies linearly across sites, with mean value equal
#    to the regional average L-CV for the Cascades data.
#    'LCVrange' specifies the  range of L-CV across the sites.
# -- L-skewness the same at each site, and equal to the regional
#    average L-skewness for the Cascades data
nsites <- nrow(Cascades)
means <- rep(1,nsites)
LCVrange <- 0.025
LCVs <- seq(rmom[2]-LCVrange/2, rmom[2]+LCVrange/2, len=nsites)
Lskews<-rep(rmom[3], nsites)

# Each site will have a generalized normal distribution:
# get the parameter values for each site
pp <- t(apply(cbind(means, means*LCVs ,Lskews), 1, pelgno))

# Set correlation between each pair of sites to 0.64, the
# average inter-site correlation for the Cascades data
avcor <- 0.64

# Run the simulation.  It will take some time (about 25 sec
# on a Lenovo W500, a moderately fast 2011-vintage laptop)
# Note that the results are consistent with the statement
# "the average H value of simulated regions is 1.08"
# in Hosking and Wallis (1997, p.98).
set.seed(123)
regsimh(qfunc=quagno, para=pp, cor=avcor, nrec=Cascades$n,
  nrep=100)

Run the code above in your browser using DataLab