plot.nspmix | R Documentation |
nspmix
Plots a function for the object of class
nspmix
, currently either using the plot function of the
class or plotting the gradient curve (or its first derivative)
data
must belong to a mixture family, as specified by its class.
Class nspmix
is an object returned by function cnm
,
cnmms
, cnmpl
or cnmap
.
## S3 method for class 'nspmix'
plot(x, data, type = c("probability", "gradient"), ...)
## S3 method for class 'nspmix'
plot(x, data, type=c("probability","gradient"), ...)
x |
an object of a mixture model class |
data |
a data set from the mixture model |
type |
the type of function to be plotted: the probability model of the
mixture family ( |
... |
arguments passed on to the |
Function plot.nspmix
plots either the mixture model, if the family of
the mixture provides an implementation of the generic plot
function,
or the gradient function.
data
must belong to a mixture family, as specified by its class.
Yong Wang <yongwang@auckland.ac.nz>
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.
Wang, Y. (2010). Maximum likelihood computation for fitting semiparametric mixture models. Statistics and Computing, 20, 75-86
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.
Wang, Y. (2010). Maximum likelihood computation for fitting semiparametric mixture models. Statistics and Computing, 20, 75-86
plot.nspmix
, nnls
,
cnm
, cnmms
, npnorm
,
nppois
.
nnls
, cnm
, cnmms
,
cnmpl
, cnmap
, npnorm
,
nppois
.
## Poisson mixture
x = rnppois(200, disc(c(1,4), c(0.7,0.3)))
plot(cnm(x), x)
## Normal mixture
x = rnpnorm(200, disc(c(0,4), c(0.3,0.7)), sd=1)
r = cnm(x, init=list(beta=0.5)) # sd = 0.5
plot(r, x)
plot(r, x, type="g")
plot(r, x, type="g", order=1)
## Poisson mixture
x = rnppois(200, disc(c(1,4), c(0.7,0.3)))
r = cnm(x)
plot(r, x, "p")
plot(r, x, "g")
## Normal mixture
x = rnpnorm(200, mix=disc(c(0,4), c(0.3,0.7)), sd=1)
r = cnm(x, init=list(beta=0.5)) # sd = 0.5
plot(r, x, "p")
plot(r, x, "g")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.