r.norMix {nor1mix} | R Documentation |
Compute r(x) = f(x)/ f0(x) where f() is a normal mixture density and f0 the normal density with the same mean and variance as f.
r.norMix(obj, x = NULL, xlim = NULL, n = 511, xy.return = TRUE)
obj |
an object of class norMix . |
x |
numeric vector with abscissa values where to evaluate the
density. Default is constructed from n (and xlim if
specified). |
xlim |
range of abscissa values, used if x == NULL . By default,
xlim taken as mean plus/minus 3 standard deviations of the normal mixture. |
n |
number of abscissa values to generate if x is not specified. |
xy.return |
logical indicating if the result should be a list or just a numeric vector, see below. |
It depends on xy.return
. If it's false, a numeric vector of
the same length as x
, if true (as per default), a list that can
be plotted, with components
x |
abscissa values corresponding to argument x . |
y |
corresponding values r(x). |
f0 |
values of the moment matching normal density f0(x). |
The ratio function is used in certain semi-parametric density estimation methods (and theory).
d3 <- norMix(m = 5*(0:2), w = c(0.6, 0.3, 0.1)) plot(d3) rd3 <- r.norMix(d3) str(rd3) stopifnot(rd3 $ y == r.norMix(d3, xy.ret = FALSE)) par(new = TRUE) plot(rd3, type = "l", col = 3, axes = FALSE, xlab = "", ylab="") axis(4, col.axis=3)