Title: Moment-Matching Methods for Weighted Sums of Chi-Squared Random Variables
Version: 0.1.5
Author: Dean Bodenham
Maintainer: Dean Bodenham <deanbodenhambsse@gmail.com>
Description: A collection of moment-matching methods for computing the cumulative distribution function of a positively-weighted sum of chi-squared random variables. Methods include the Satterthwaite-Welch method, Hall-Buckley-Eagleson method, Wood's F method, and the Lindsay-Pilla-Basak method.
Depends: R (≥ 3.1.2)
License: GPL-2 | GPL-3
LazyData: true
NeedsCompilation: no
Packaged: 2016-09-23 14:42:23 UTC; dean
Repository: CRAN
Date/Publication: 2016-09-26 13:27:37

momentchi2: A package containing a collection of moment-matching methods for computing the cdf of a weighted sum of chi-squared random variables

Description

The momentchi2 package provides implementations of moment-matching (equivalently, cumulant-matching) methods for computing the cumulative distribution function (cdf) of a positively-weighted sum of chi-squared random variables.

Details

Methods implemented include the Satterthwaite-Welch (SW), Hall-Buckley-Eagleson (HBE), Wood F (WF) and Lindsay-Pilla-Basak (LPB4) methods. Note that the chi-squared random variables are assumed to have degree 1.

See Also

Those interested in weighted sums of chi-squared random variables are encouraged to also have a look at the excellent CompQuadForm R package, which provides implementations of several iterative methods for computing the cdf of a weighted sum of (potentially noncentral) chi-squared random variables.


Hall-Buckley-Eagleson method

Description

Computes the cdf of a positively-weighted sum of chi-squared random variables with the Hall-Buckley-Eagleson (HBE) method.

Usage

hbe(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.

References

Examples

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

hbe(c(1.5, 1.5, 0.5, 0.5), 10.203)            # should give value close to 0.95
hbe(coeff=c(1.5, 1.5, 0.5, 0.5), x=10.203)    # specifying parameters
hbe(c(1.5, 1.5, 0.5, 0.5), c(0.627, 10.203))  # x is a vector, output approx. 0.05, 0.95

Lindsay-Pilla-Basak method

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

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

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

Satterthwaite-Welch method

Description

Computes the cdf of a positively-weighted sum of chi-squared random variables with the Satterthwaite-Welch (SW) method.

Usage

sw(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.

References

Examples

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

sw(c(1.5, 1.5, 0.5, 0.5), 10.203)            # should give value close to 0.95
sw(coeff=c(1.5, 1.5, 0.5, 0.5), x=10.203)    # specifying parameters
sw(c(1.5, 1.5, 0.5, 0.5), c(0.627, 10.203))  # x is a vector, output close to 0.05, 0.95

Wood's F method

Description

Computes the cdf of a positively-weighted sum of chi-squared random variables with the Wood F (WF) method.

Usage

wf(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 there are pathological cases where, for certain coefficient vectors (which result in certain cumulant values), the Wood F method will be unable to match moments (cumulants) with the three-parameter F distribution. In this situation, the HBE method is used, and a warning is displayed. A simple example of such a pathological case is when the coefficient vector is of length 1. Note that these pathological cases are rare; see (Wood, 1989) in the references.

References

Examples

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

wf(c(1.5, 1.5, 0.5, 0.5), 10.203)            # should give value close to 0.95
wf(coeff=c(1.5, 1.5, 0.5, 0.5), x=10.203)    # specifying parameters
wf(c(1.5, 1.5, 0.5, 0.5), c(0.627, 10.203))  # x is a vector, output approx. 0.05, 0.95
wf(c(0.9), 1)                                # pathological case, warning, uses hbe()