pnorMix {nor1mix} | R Documentation |
Compute cumulative probabilities or quantiles (the inverse) for a
normal mixture specified as norMix
object.
pnorMix(obj, q) qnorMix(obj, p)
obj |
an object of class norMix . |
p |
numeric vector of probabilities. |
q |
numeric vector of quantiles |
.
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(MW.nm3, x), type="l", col=2) ## and some of its inverse : pp <- seq(.1, .9, by=.1) plot(qnorMix(MW.nm3, pp), pp) ## The "true" median of a normal mixture: median.norMix <- function(x) qnorMix(x, 1/2) median.norMix(MW.nm3) ## -2.32