Learn R Programming

nspmix (version 1.5-0)

plot.nspmix: Class 'nspmix'

Description

Class nspmix is an object returned by function cnm, cnmms, cnmpl or cnmap.

Usage

# S3 method for 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 (probability), or the gradient function (gradient).

...

arguments passed on to the plot function called.

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.

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

See Also

nnls, cnm, cnmms, cnmpl, cnmap, npnorm, nppois.

Examples

Run this code
# NOT RUN {
## 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")

# }

Run the code above in your browser using DataLab