# dproddnf: The product of multiple doubly non-central F's distribution. In shabbychef/sadists: Some Additional Distributions

## Description

Density, distribution function, quantile function and random generation for the product of multiple independent doubly non-central F variates.

## Usage

 ```1 2 3 4 5 6 7``` ```dproddnf(x, df1, df2, ncp1, ncp2, log = FALSE, order.max=4) pproddnf(q, df1, df2, ncp1, ncp2, lower.tail = TRUE, log.p = FALSE, order.max=4) qproddnf(p, df1, df2, ncp1, ncp2, lower.tail = TRUE, log.p = FALSE, order.max=4) rproddnf(n, df1, df2, ncp1, ncp2) ```

## Arguments

 `x, q` vector of quantiles. `df1, df2` the vectors of the degrees of freedom for the numerator and denominator. We do not recycle these versus the `x,q,p,n`. `ncp1, ncp2` the vectors of the non-centrality parameters for the numerator and denominator. We do not recycle these versus the `x,q,p,n`. `log` logical; if TRUE, densities f are given as log(f). `order.max` the order to use in the approximate density, distribution, and quantile computations, via the Gram-Charlier, Edeworth, or Cornish-Fisher expansion. `p` vector of probabilities. `n` number of observations. `log.p` logical; if TRUE, probabilities p are given as log(p). `lower.tail` logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x].

## Details

Let

x_j ~ F(delta_1j,delta_2j,v_1j,v_2j)

be independent doubly non-central F variates with non-centrality parameters delta_ij and degrees of freedom v_ij for i=1,2,...,I and j=1,2. Then

Y = prod x_j

takes a product of doubly non-central F's distribution. We take the parameters of this distribution as the four I length vectors of the two degrees of freedom and the two non-centrality parameters.

## Value

`dproddnf` gives the density, `pproddnf` gives the distribution function, `qproddnf` gives the quantile function, and `rproddnf` generates random deviates.

Invalid arguments will result in return value `NaN` with a warning.

## Note

The PDF, CDF, and quantile function are approximated, via the Edgeworth or Cornish Fisher approximations, which may not be terribly accurate in the tails of the distribution. You are warned.

The distribution parameters are not recycled with respect to the `x, p, q` or `n` parameters, for, respectively, the density, distribution, quantile and generation functions. This is for simplicity of implementation and performance. It is, however, in contrast to the usual R idiom for dpqr functions.

The PDQ functions are computed by translation of the sum of log chi-squares distribution functions.

## Author(s)

Steven E. Pav [email protected]

## References

Pav, Steven. Moments of the log non-central chi-square distribution. http://arxiv.org/abs/1503.06266

## See Also

The sum of log of chi-squares distribution, `dsumlogchisq`, `psumlogchisq`, `qsumlogchisq`, `rsumlogchisq`. (doubly non-central) F distribution functions, `ddnf`, `pdnf`, `qdnf`, `rdnf`.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22``` ```df1 <- c(10,20,5) df2 <- c(1000,500,150) ncp1 <- c(1,0,2.5) ncp2 <- c(0,1.5,5) rv <- rproddnf(500, df1=df1,df2=df2,ncp1=ncp1,ncp2=ncp2) d1 <- dproddnf(rv, df1=df1,df2=df2,ncp1=ncp1,ncp2=ncp2) ## Not run: plot(rv,d1) ## End(Not run) p1 <- pproddnf(rv, df1=df1,df2=df2,ncp1=ncp1,ncp2=ncp2) # should be nearly uniform: ## Not run: plot(ecdf(p1)) ## End(Not run) q1 <- qproddnf(ppoints(length(rv)), df1=df1,df2=df2,ncp1=ncp1,ncp2=ncp2) ## Not run: qqplot(x=rv,y=q1) ## End(Not run) ```

shabbychef/sadists documentation built on May 26, 2017, 6:59 a.m.