pnorMix {nor1mix}R Documentation

Normal Mixture Cumulative Distribution and Quantiles

Description

Compute cumulative probabilities or quantiles (the inverse) for a normal mixture specified as norMix object.

Usage

pnorMix(obj, q)
qnorMix(obj, p)

Arguments

obj an object of class norMix.
p numeric vector of probabilities.
q numeric vector of quantiles

.

Details

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.

Value

a numeric vector of the same length as p or q, respectively.

Author(s)

First version by Erik Jørgensen Erik.Jorgensen@agrsci.dk.

See Also

dnorMix for the density function.

Examples

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

[Package nor1mix version 1.0-6 Index]