Simulate the distribution of heterogeneity and goodness-of-fit measures
Simulate the distribution of heterogeneity and goodness-of-fit measures
Estimates, using Monte Carlo simulation, the distribution of heterogeneity and goodness-of-fit measures for regional frequency analysis. These are the statistics H and ZDIST
defined respectively in sections 4.3.3 and 5.2.3 of Hosking and Wallis (1997).
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.
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.
Returns
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 bynrep, 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.
References
Hosking, J. R. M., and Wallis, J. R. (1997). Regional frequency analysis: an approach based on L-moments. Cambridge University Press.
regtst for details of the heterogeneity and goodness-of-fit measures.
Examples
## Not run:data(Cascades)# A regional data setrmom<-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 datansites <- nrow(Cascades)means <- rep(1,nsites)LCVrange <-0.025LCVs <- 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 sitepp <- 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 dataavcor <-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)## End(Not run)