Description Usage Arguments Details Value Note Author(s) Examples
Density, distribution function, quantile function and random generation for the distribution of the product of indepdendent normal random variables.
1 2 3 4 5 6 7 | dprodnormal(x, mu, sigma, log = FALSE, order.max=5)
pprodnormal(q, mu, sigma, lower.tail = TRUE, log.p = FALSE, order.max=5)
qprodnormal(p, mu, sigma, lower.tail = TRUE, log.p = FALSE, order.max=5)
rprodnormal(n, mu, sigma)
|
x, q |
vector of quantiles. |
mu |
the vector of means.
This is recycled against the |
sigma |
the vector of standard deviations.
This is recycled against the |
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]. |
Let Z_i ~ N(mu_i, sigma_i^2) be independently distributed normal variates, with means mu_i and variances sigma_i^2. Suppose
Z = prod (Z_i).
Then Y follows a product of normals distribution.
dprodnormal
gives the density, pprodnormal
gives the
distribution function, qprodnormal
gives the quantile function,
and rprodnormal
generates random deviates.
Invalid arguments will result in return value NaN
with a warning.
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.
Steven E. Pav shabbychef@gmail.com
1 2 3 4 5 6 | mu <- c(100,20,10)
sigma <- c(10,50,10)
rvs <- rprodnormal(128, mu, sigma)
dvs <- dprodnormal(rvs, mu, sigma)
qvs <- pprodnormal(rvs, mu, sigma)
pvs <- qprodnormal(ppoints(length(rvs)), mu, sigma)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.