Learn R Programming

lmomco (version 2.0.1)

lmomsf01: The Sample L-moments and L-moment Ratios from Nonexceedance Probabilities on the Bounds of 0 to 1

Description

Compute the sample L-moments for a vector given another vector of nonexceedance probabilities $F$ according to the following

$$\lambda_r = \int_0^1 x(F) P^\star_{r-1}(F) \; \mathrm{d}F$$

where $P^\star_{r}(F)$ is

$$P^\star_{r}(F) = \sum_{k=0}^r (-1)^{r-k} {r \choose k} {r+k \choose k} F^k \mathrm{.}$$

The quantile function $x(F)$ is approximated by linear interpolation using the approx function with flat line (constant) extrapolation to the left and right of the end points of the input vector x. The extrapolation however can be controlled by functional arguments.

Usage

lmomsf01(x, f=NULL, a=0, nmom=5, subdivisionscale=50,
       sort=TRUE, constantails=TRUE, efs=1e-3)

Arguments

x
A vector of data values.
f
A vector of nonexceedance probabilities for each value in x.
a
A plotting position coefficient as also used by the pp function for estimation of nonexceedance probabilities in f if f=NULL. The default is for the Weibull plotting positions.
nmom
The number of moments to compute. Default is 5.
subdivisionscale
A multiplicative factor on the sample size (length(x)) for the subdivision argument of the integrate function. The default value is not optimal but determined by some limited trial and error by the author.
sort
Does the data need sorting? The computations require sorted data. This option is provided to optimize processing speed if presorted data already exists.
constantails
During the linear interpolation, is rule=2 of the approx function to be used if constantails=TRUE or will tail extrapolation using the last left and right tail slopes of the $x$ and $F$ values be used.
efs
A near zero value for a difference between the pair of left and right edge $F$ values that are used for computation of the demoninator of a slope computation. The default value is relatively ad hoc determined but provides protection from slopes becoming t

Value

  • An R list is returned.
  • lambdasVector of the L-moments. First element is $\hat{\lambda}^{(0,0)}_1$, second element is $\hat{\lambda}^{(0,0)}_2$, and so on.
  • ratiosVector of the L-moment ratios. Second element is $\hat{\tau}^{(0,0)}$, third element is $\hat{\tau}^{(0,0)}_3$ and so on.
  • trimLevel of symmetrical trimming used in the computation, which will equal NULL if asymmetrical trimming was used.
  • leftrimLevel of left-tail trimming used in the computation.
  • rightrimLevel of right-tail trimming used in the computation.
  • sourceAn attribute identifying the computational source of the L-moments: lmomsf.

References

Asquith, W.H., 2011, Distributional analysis with L-moment statistics using the R environment for statistical computing: CreateSpace, ISBN 978--1--46350841--8, 344 p. [eqs. 6.2 and 6.3, p. 91]

See Also

lmoms

Examples

Run this code
set.seed(11)
   x <- rnorm(35)
   lmomsf01(x)$lambdas # linear approx via weibull
   lmomsf01(sort(x), f=pp(x))$lambdas # same
   lmomsf01(x, f=pp(x, sort=FALSE))$lambdas # same
   pwm2lmom(pwm.pp(x, pp=pp(x, sort=FALSE)))$lambdas # directly by weibull
   pwm2lmom(pwm.pp(x, B=1))$lambdas # same
   lmoms(x)$lambdas # unbiased estimates

  lmr0 <- lmoms(x)
  lmr1 <- lmomsf01(sort(x), f=pp(x))
  lmr2 <- pwm2lmom(pwm.pp(x, B=1))
  Fs <- seq(0.001, 0.999, by=0.001)
  F <- pp(x, sort=FALSE)
  xofF <- approx(x=F, y=x, xout=Fs, rule=2)$y
  plot(qnorm(Fs), xofF, type="l",
       xlab="STANDARD NORMAL VARIATE",
       ylab="VALUE")
  points(qnorm(F), x)
  lines(qnorm(Fs), qlmomco(Fs, parnor(lmr0)), col=2)
  lines(qnorm(Fs), qlmomco(Fs, parnor(lmr1)))
  lines(qnorm(Fs), qlmomco(Fs, parnor(lmr2)), col=3)

Run the code above in your browser using DataLab