sitequant | R Documentation |
Quantiles and quantile functions for individual sites in a region.
sitequant
computes quantiles directly;
siteqfunc
returns a function that will compute quantiles.
sitequant(f, rfd, sitenames, index, drop = TRUE)
siteqfunc(rfd, sitenames, index)
f |
Vector of probabilities. |
rfd |
Object of class |
sitenames |
Vector of site names. |
index |
Values of the site-specific scale factor (“index flood”) for the sites. |
drop |
Logical: if |
If index
and sitenames
are both present,
they must have the same length, and will be taken to refer to sites
whose names are the elements of sitename
and whose index-flood values
are the elements of index
.
If index
is present and sitenames
is missing,
quantiles are computed for sites whose index-flood values
are the elements of index
; if index
has names, these
names will be used as the site names.
If sitenames
is present and index
is missing,
then quantiles will be computed for a subset of the
sites in the region specified by rfd
.
sitenames
will be used to select sites from the vector rfd$index
,
either by position or by name.
If sitenames
and index
are both missing,
then quantiles will be computed for all of the
sites in the region specified by rfd
.
For sitequant
, a matrix whose rows contain quantiles
for a single site, for the probabilities specified in f
.
If drop
is TRUE
and the matrix has only one row or column,
it will be returned as a vector.
For siteqfunc
, a function or a list of functions that each compute
quantiles for one site.
Each function takes a single argument, a vector of probabilities,
and returns a vector of quantiles.
J. R. M. Hosking jrmhosking@gmail.com
rfit <- regfit(Cascades, "gno") # Fit regional distribution
## Quantiles for:
# - sites in the Cascades data set, indexed by number
sitequant(c(0.9, 0.99, 0.999), rfit, sitenames=1:3)
# - sites in the Cascades data set, indexed by name
sitequant(c(0.9, 0.99, 0.999), rfit,
sitenames=c("350304", "351433", "351862"))
# - other sites, with specified index floods
sitequant(c(0.9, 0.99, 0.999), rfit, index=c(80, 100))
# - other sites, with specified index floods and names
sitequant(c(0.9, 0.99, 0.999), rfit, index=c(80, 100),
sitenames=c("Site 80", "Site 100"))
# - a single site, with drop=FALSE: result is a matrix
sitequant(c(0.9, 0.99, 0.999), rfit, sitenames=10, drop=FALSE)
# - a single site, with drop=TRUE (the default): result is a vector
sitequant(c(0.9, 0.99, 0.999), rfit, sitenames=10)
# Quantile function for site 10
qfunc10 <- siteqfunc(rfit, site=10)
# Compute quantiles via the quantile function
qfunc10(c(0.9, 0.99, 0.999))
# Plot the quantile function
evplot(qfunc=qfunc10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.