Package 'momentchi2'

Title: Moment-Matching Methods for Weighted Sums of Chi-Squared Random Variables
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.
Authors: Dean Bodenham
Maintainer: Dean Bodenham <[email protected]>
License: GPL-2 | GPL-3
Version: 0.1.5
Built: 2024-12-01 08:19:39 UTC
Source: CRAN

Help Index


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

  • P. Hall. Chi squared approximations to the distribution of a sum of independent random variables. The Annals of Probability, 11(4):1028-1036, 1983.

  • M. J. Buckley and G. K. Eagleson. An approximation to the distribution of quadratic forms in normal random variables. Australian Journal of Statistics, 30(1):150-159, 1988.

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

  • B. G. Lindsay, R. S. Pilla, and P. Basak. Moment-based approximations of distributions using mixtures: Theory and applications. Annals of the Institute of Statistical Mathematics, 52(2):215-230, 2000.

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

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.


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

  • B. L.Welch. The significance of the difference between two means when the population variances are unequal. Biometrika, 29(3/4):350-362, 1938.

  • F. E. Satterthwaite. An approximate distribution of estimates of variance components. Biometrics Bulletin, 2(6):110-114, 1946.

  • G. E. P. Box Some theorems on quadratic forms applied in the study of analysis of variance problems, I. Effects of inequality of variance in the one-way classification. The Annals of Mathematical Statistics, 25(2):290-302, 1954.

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

  • A. T. A. Wood. An F approximation to the distribution of a linear combination of chi-squared variables. Communications in Statistics-Simulation and Computation, 18(4):1439-1456, 1989.

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