plot.nspmix {nspmix} | R Documentation |
Plots a function for an object of class nspmix
Description
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
.
Usage
## S3 method for class 'nspmix'
plot(x, data, type = c("probability", "gradient"), ...)
## S3 method for class 'nspmix'
plot(x, data, type=c("probability","gradient"), ...)
Arguments
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 |
Details
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.
Author(s)
Yong Wang <yongwang@auckland.ac.nz>
References
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
See Also
plot.nspmix
, nnls
,
cnm
, cnmms
, npnorm
,
nppois
.
nnls
, cnm
, cnmms
,
cnmpl
, cnmap
, npnorm
,
nppois
.
Examples
## 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")