Learn R Programming

lmomco (version 2.4.14)

theoTLmoms: The Theoretical Trimmed L-moments and TL-moment Ratios using Integration of the Quantile Function

Description

Compute the theoretrical trimmed L-moments (TL-moments) for a vector. The level of symmetrical or asymmetrical trimming is specified. A theoretrical TL-moment in integral form is

$$ \lambda^{(t_1,t_2)}_r = \underbrace{\frac{1}{r}}_{\stackrel{\mbox{average}}{\mbox{of terms}}} \sum^{r-1}_{k=0} \overbrace{(-1)^k}^{\mbox{differences}} \underbrace{ r-1 \choose k }_{\mbox{combinations}} \frac{\overbrace{(r+t_1+t_2)!}^{\mbox{sample size}}\: I^{(t_1,t_2)}_r} {\underbrace{(r+t_1-k-1)!}_{\mbox{left tail}} \underbrace{(t_2+k)!}_{\mbox{right tail}}} \mbox{, in which }$$

$$ I^{(t_1,t_2)}_r = \int^1_0 \underbrace{x(F)}_{\stackrel{\mbox{quantile}}{\mbox{function}}} \times \overbrace{F^{r+t_1-k-1}}^{\mbox{left tail}} \overbrace{(1-F)^{t_2+k}}^{\mbox{right tail}} \,\mathrm{d}F \mbox{,}$$

where \(x(F)\) is the quantile function of the random variable \(X\) for nonexceedance probability \(F\), \(t_1\) represents the trimming level of the \(t_1\)-smallest, \(t_2\) represents the trimming level of the \(t_2\)-largest values, \(r\) represents the order of the L-moments. This function loops across the above equation for each nmom set in the argument list. The function \(x(F)\) is computed through the par2qua function. The distribution type is determined using the type attribute of the para argument---the parameter object.

As of version 1.5.2 of lmomco, there exists enhanced error trapping on integration failures in
theoTLmoms. The function now abandons operations should any of the integrations for the \(r\)th L-moment fail for reasons such as divergent integral or round off problems. The function returns NAs for all L-moments in lambdas and ratios.

Usage

theoTLmoms(para, nmom=5, trim=NULL, leftrim=NULL, rightrim=NULL,
                 minF=0, maxF=1, quafunc=NULL,
                 nsim=50000, fold=5,
                 silent=TRUE, verbose=FALSE, ...)

Value

An R

list is returned.

lambdas

Vector of the TL-moments. First element is \(\lambda^{(t_1,t_2)}_1\), second element is \(\lambda^{(t_1,t_2)}_2\), and so on.

ratios

Vector of the L-moment ratios. Second element is \(\tau^{(t_1,t_2)}\), third element is \(\tau^{(t_1,t_2)}_3\) and so on.

trim

Level of symmetrical trimming used in the computation, which will equal NULL if asymmetrical trimming was used.

leftrim

Level of left-tail trimming used in the computation.

rightrim

Level of right-tail trimming used in the computation.

nsim

Echo of the nsim argument if and only if at least one Monte Carlo integration was required, otherwise this is set to “not needed” on the return.

folds

Echo of the folds argument if and only if at least one Monte Carlo integration was required, otherwise this is set to “not needed” on the return.

monte_carlo

A logical vector of whether one or more Monte Carlo integrations was needed for the r-th index of the vector during the integrations for the \(r\)-th L-moment.

source

An attribute identifying the computational source of the L-moments: “theoTLmoms” or switched to “theoLmoms” if this function was dispatched from theoLmoms.

integrations

If verbose=TRUE, then the results of the integrations are a data frame stored here. Otherwise, integrations is not present in the list.

Arguments

para

A distribution parameter object of this package such as by vec2par.

nmom

The number of moments to compute. Default is 5.

trim

Level of symmetrical trimming to use in the computations. Although NULL in the argument list, the default is 0---the usual L-moment is returned.

leftrim

Level of trimming of the left-tail of the sample.

rightrim

Level of trimming of the right-tail of the sample.

minF

The end point of nonexceedance probability in which to perform the integration. Try setting to non-zero (but small) if you have a divergent integral.

maxF

The end point of nonexceedance probability in which to perform the integration. Try setting to non-unity (but close) if you have a divergent integral.

quafunc

An optional and arbitrary quantile function that simply needs to except a nonexceedance probability and the parameter object in para. This is a feature that permits computation of the L-moments of a quantile function that does not have to be implemented in the greater overhead hassles of the lmomco style. This feature might be useful for estimation of quantile function mixtures or those distributions not otherwise implemented in this package.

nsim

Simulation size for Monte Carlo integration is such is internally deemed necessary (see silent argument).

fold

The number of fractions or number of folds of nsim, which in other words, means that nsim is divided by folds and a loop creating folds integrations of nsim/folds is used from which the mean and mean absolute error of the integrand are computed. This is to try to recover similar output as integrate().

silent

The argument of silent for the try() operation wrapped on integrate(). If set true and the integral is probability divergent, Monte Carlo integration is triggered using nsim and folds. The user would have to set verbose=TRUE to then acquire the returned table in integrations of the integration passes including those are or are not Monte Carlo.

verbose

Toggle verbose output. Because the R function integrate is used to perform the numerical integration, it might be useful to see selected messages regarding the numerical integration.

...

Additional arguments to pass.

Author

W.H. Asquith

References

Elamir, E.A.H., and Seheult, A.H., 2003, Trimmed L-moments: Computational Statistics and Data Analysis, v. 43, pp. 299--314.

See Also

theoLmoms, TLmoms, tlmr2par