dnorMix {nor1mix} | R Documentation |
Normal Mixture Density
Description
Evaluate the density function of the normal mixture specified as
norMix
object.
Usage
dnorMix (x, obj, log = FALSE)
dnorMixL(obj, x = NULL, log = FALSE, xlim = NULL, n = 511)
dpnorMix(x, obj, lower.tail = TRUE)
Arguments
obj |
an object of class |
x |
numeric vector with abscissa values where to evaluate the
density (and probability, for |
log |
logical indicating log-density values should be returned. |
xlim |
range of abscissa values, used if |
n |
number of abscissa values to generate if |
lower.tail |
logical; if TRUE (default), probabilities are
|
Value
dnorMix(x)
returns the numeric vector of density values
f(x)
, logged if log
is TRUE.
dnorMixL()
returns a list with components
x |
the abscissa values. |
y |
the density values |
dpnorMix()
returns a list with components
d |
the density values |
p |
the probability values |
See Also
rnorMix
for random number generation, and
norMix
for the construction and further methods,
particularly plot.norMix
which makes use dnorMix
.
Examples
ff <- dnorMixL(MW.nm7)
str(ff)
plot(ff, type = "h", ylim = c(0,1)) # rather use plot(ff, ...)
x <- seq.int(-4,5, length.out = 501)
dp <- dpnorMix(x, MW.nm7)
lines(x, dp$d, col = "tomato", lwd=3)
lines(x, dp$p, col = 3, lwd=2)# does not fit y-wise
stopifnot(all.equal(dp$d, dnorMix(x, MW.nm7), tolerance=1e-12),
all.equal(dp$p, pnorMix(x, MW.nm7), tolerance=1e-12))