# dat2bernquaf: Equivalent Nonexceedance Probability for a Given Value... In lmomco: L-Moments, Censored L-Moments, Trimmed L-Moments, L-Comoments, and Many Distributions

## 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

 1 dat2bernquaf(x, data, interval=NA, ...) 

## Arguments

 x A scalar value for which the equivalent nonexceedance probability F through the function dat2bernqua is to be computed. data A vector of data values that directly correspond to the argument x in the function dat2bernqua. interval The search interval. If NA, then [1/(n+1), 1 - 1/(n+1)] is used. If interval is a single value a, then the interval is computed as [a, 1 - a]. ... Additional arguments passed to dat2bernqua through the uniroot() function in R.

## 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:

 1 2 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 x value via the x argument. f The equivalent nonexceedance probability F(x{\mid}\hat{X}). interval The search interval of F used. afunc.root Corresponds to the f.root element returned by the uniroot() function. iter Corresponds to the iter element returned by the uniroot() function. estim.prec Corresponds to the estim.prec element returned by the uniroot() function. source An attribute identifying the computational source: “dat2bernquaf”

## Author(s)

W.H. Asquith

dat2bernqua
  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 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)