dat2bernquaf {lmomco} | R Documentation |
Equivalent Nonexceedance Probability for a Given Value through Observed Data to Empirical Quantiles through Bernstein or Kantorovich Polynomials
Description
This function computes an equivalent nonexceedance probability F
of a single value x
for the sample data set (\hat{X}
) through inversion of the empricial quantile function as computable through Bernstein or Kantorovich Polynomials by the dat2bernqua
function.
Usage
dat2bernquaf(x, data, interval=NA, ...)
Arguments
x |
A scalar value for which the equivalent nonexceedance probability |
data |
A vector of data values that directly correspond to the argument |
interval |
The search interval. If |
... |
Additional arguments passed to |
Details
The basic logic is thus. The \hat{X}
in conjunction with the settings for the polynomials provides the empirical quantile function (EQF). The dat2bernquaf
function then takes the EQF (through dynamic recomputation) and seeks a root for the single value also given.
The critical piece likely is the search interval, which can be modified by the interval
argument if the internal defaults are not sufficient. The default interval is determined as the first and last Weibull plotting positions of \hat{X}
having a sample size n
: [1/(n+1), 1 - 1/(n+1)]
. Because the dat2bernqua
function has a substantial set of options that control how the empirical curve is (might be) extrapolated beyond the range of \hat{X}
, it is difficult to determine an always suitable interval for the rooting. However, it should be considered obvious that the result is more of an interpolation if F(x)
is within F \in [1/(n+1), 1 - 1/(n+1)]
and increasingly becomes an accurate interpolation as F(x) \rightarrow 1/2
(the median).
If the value x
is too far beyond the data or if the search interval is not sufficient then the following error will be triggered:
Error in uniroot(afunc, interval, ...) : f() values at end points not of opposite sign
The Examples section explores this aspect.
Value
An R list
is returned.
x |
An echoing of the |
f |
The equivalent nonexceedance probability |
interval |
The search interval of |
afunc.root |
Corresponds to the |
iter |
Corresponds to the |
estim.prec |
Corresponds to the |
source |
An attribute identifying the computational source: “dat2bernquaf”. |
Author(s)
W.H. Asquith
See Also
Examples
dat2bernquaf(6, c(2,10)) # median 1/2 of 2 and 10 is 6 (trivial and fast)
## Not run:
set.seed(5135)
lmr <- vec2lmom(c(1000, 400, 0.2, 0.3, 0.045))
par <- lmom2par(lmr, type="wak")
Q <- rlmomco(83, par) # n = 83 and extremely non-Normal data
lgQ <- max(Q) # 5551.052 by theory
dat2bernquaf(median(Q), Q)$f # returns 0.5100523 (nearly 1/2)
dat2bernquaf(lgQ, Q)$f # unable to root
dat2bernquaf(lgQ, Q, bound.type="sd")$f # unable to root
itf <- c(0.5, 0.99999)
f <- dat2bernquaf(lgQ, Q, interval=itf, bound.type="sd")$f
print(f) # F=0.9961118
qlmomco(f, par) # 5045.784 for the estimate F=0.9961118
# If we were not using the maximum and something more near the center of the
# distribution then that estimate would be closer to qlmomco(f, par).
# You might consider lqQ <- qlmomco(0.99, Q) # theoretical 99th percentile and
# let the random seed wander and see the various results.
## End(Not run)