lpb4: Lindsay-Pilla-Basak method

Description Usage Arguments Details References Examples

Description

Computes the cdf of a positively-weighted sum of chi-squared random variables with the Lindsay-Pilla-Basak (LPB4) method using four support points. Note that the coefficient vector must be of length at least four.

Usage

1
lpb4(coeff, x)

Arguments

coeff

The coefficient vector. All values must be greater than 0.

x

The vector of quantile values. All values must be greater than 0.

Details

Note that the coefficient vector must of length at least four. In some cases when the coefficient vector was of length two or three, the algorithm would be unable to find roots of a particular equation during an intermediate step, and so the algorithm would produce NaNs. If the coefficient vector is of length less than four, the Hall-Buckley-Eagleson method is used (and a warning is displayed).

References

Examples

1
2
3
4
5
6
7
#Examples taken from Table 18.6 in N. L. Johnson, S. Kotz, N. Balakrishnan.
#Continuous Univariate Distributions, Volume 1, John Wiley & Sons, 1994.

lpb4(c(1.5, 1.5, 0.5, 0.5), 10.203)            # should give value close to 0.95
lpb4(coeff=c(1.5, 1.5, 0.5, 0.5), x=10.203)    # specifying parameters
lpb4(c(1.5, 1.5, 0.5, 0.5), c(0.627, 10.203))  # x is a vector, output approx 0.05, 0.95
lpb4(c(0.5, 0.3, 0.2), 2.708)                  # length(coeff) < 4, warning, uses hbe()

Example output

[1] 0.9500092
[1] 0.9500092
[1] 0.05001144 0.95000919
[1] 0.9483417
Warning message:
In lpb4(c(0.5, 0.3, 0.2), 2.708) :
  Less than four coefficients - LPB4 method may return NaN: running hbe instead.

momentchi2 documentation built on May 2, 2019, 2:02 p.m.

Related to lpb4 in momentchi2...