Class nppois
is used to store data that will be processed as those of
a nonparametric Poisson mixture.
nppois(v, w=1)
rnppois(n, mix=disc(1))
# S3 method for nppois
plot(x, mix, beta, col="red", add=FALSE,
components=TRUE, main="nppois", lwd=1, lty=1, xlab="Data",
ylab="Density", ...)
a numeric vector that stores the values of a sample.
a numeric vector that stores the corresponding weights/frequencies of the observations.
the sample size.
an object of class nppois
.
an object of class disc
.
the structural parameter, which is not really needed for the Poisson mixture.
the color of the density curve to be plotted.
if FALSE
, creates a new plot; if TRUE
, adds the
plot to the existing one.
if TRUE
, also show the support points and mixing
proportions.
arguments for graphical parameters (see
par
).
arguments passed on to function plot
.
Function nppois
creates an object of class nppois
, given
values and weights/frequencies.
Function rnppois
generates a random sample from a Poisson mixture and
saves the data as an object of class nppois
.
Function plot.nppois
plots the Poisson mixture.
When components=TRUE
, the support points are shown on the horizontal
line of density 0. The component density curves, weighted appropriately, are
also shown.
Wang, Y. (2007). On fast computation of the non-parametric maximum likelihood estimate of a mixing distribution. Journal of the Royal Statistical Society, Ser. B, 69, 185-198.
nnls
, cnm
, cnmms
,
plot.nspmix
.
# NOT RUN {
mix = disc(pt=c(1,4), pr=c(0.3,0.7))
x = rnppois(200, mix)
plot(x, mix)
# }
Run the code above in your browser using DataLab