Description Usage Arguments Details Value Author(s) See Also Examples
Compute cumulative probabilities or quantiles (the inverse) for a
normal mixture specified as norMix
object.
1 2 3 4 5 6 
obj 
an object of class 
p 
numeric vector of probabilities. Note that for all

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 
tolerance and maximal number of iterations for the
root search algorithm, see 
traceRootsearch 
logical or integer in \{0,1,2,3\}, determining the amount of information printed during root search. 
method 
a string specifying which algorithm is used for the
“root search”. Originally, the only method was a
variation of 
l.interp 
positive integer for 
n.mu.interp 
positive integer for 
Whereas the distribution function pnorMix
is the trivial sum of
weighted normal probabilities (pnorm
), its inverse,
qnorMix
is computed numerically: For each p
we search for
q
such that pnorMix(obj, q) == p
, i.e., f(q) = 0
for f(q) := pnorMix(obj, q)  p
. This is a root finding
problem which can be solved by uniroot(f, lower,upper,*)
.
If length(p) <= 2
or method = "eachRoot"
, this happens
one for one for the sorted p's. Otherwise, we start by doing
this for the outermost nontrivial (0 < p < 1) values of p.
For method = "interQpspline"
or "interpspline"
, we now compute
p. < pnorMix(q., obj)
for values q.
which are a grid
of length l.interp
in each interval [q_j,q_{j+1}], where
q_j are the “Xextremes” plus (a sub sequence of length
n.mu.interp
of) theordered mu[j]
's.
Then, we use montone inverse interpolation
(splinefun(q., p., method="monoH.FC")
) plus
a few (maximally maxiter
, typically one!) Newton steps.
The default, "interQpspline"
, additionally logittransforms the
p.
values to make the interpolation more linear.
This method is faster, particularly for large length(p)
.
a numeric vector of the same length as p
or q
, respectively.
Very first version (for length1 p,q
) by
Erik J<c3><b8>rgensen [email protected].
dnorMix
for the density function.
1 2 3 4 5 6 7 8 9 10 11 12  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

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.