r.norMix | 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 |
x |
numeric vector with abscissa values where to evaluate the
density. Default is constructed from |
xlim |
range of abscissa values, used if |
n |
number of abscissa values to generate if |
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 |
y |
corresponding values |
f0 |
values of the moment matching normal density |
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.