pnorMix {nor1mix} | R Documentation |
Compute cumulative probabilities or quantiles (the inverse) for a
normal mixture specified as norMix
object.
pnorMix(q, obj, lower.tail = TRUE, log.p = FALSE) qnorMix(p, obj, lower.tail = TRUE, log.p = FALSE, tol = .Machine$double.eps^0.25, maxiter = 1000)
obj |
an object of class norMix . |
p |
numeric vector of probabilities. |
q |
numeric vector of quantiles |
lower.tail |
logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]. |
log.p |
logical; if TRUE, probabilities p are given as log(p). |
tol, maxiter |
determine the root finding algorithm, see
uniroot . |
Whereas the distribution function pnorMix
is the trivial sum of
weighted normal probabilities (pnorm
), its inverse is
currently computed numerically using uniroot
to find
q
such that pnorMix(obj, q) == p
.
a numeric vector of the same length as p
or q
, respectively.
First version by Erik Jørgensen Erik.Jorgensen@agrsci.dk.
dnorMix
for the density function.
MW.nm3 # the "strange skew" one plot(MW.nm3) ## now the cumlative : x <- seq(-4,4, length=1001) plot(x, pnorMix(x, MW.nm3), type="l", col=2) ## and some of its inverse : pp <- seq(.1, .9, by=.1) plot(qnorMix(pp, MW.nm3), pp) ## The "true" median of a normal mixture: median.norMix <- function(x) qnorMix(1/2, x) median.norMix(MW.nm3) ## -2.32