plotgrad {nspmix} | R Documentation |
Plot the Gradient Function
Description
Function plotgrad
plots the gradient function or its first derivative
of a nonparametric mixture.
Usage
plotgrad(
x,
mix,
beta,
len = 500,
order = 0,
col = "blue",
col2 = "red",
add = FALSE,
main = paste0("Class: ", class(x)),
xlab = expression(theta),
ylab = paste0("Gradient (order = ", order, ")"),
cex = 1,
pch = 1,
lwd = 1,
xlim,
ylim,
...
)
Arguments
x |
a data object of a mixture model class. |
mix |
an object of class 'disc', for a discrete mixing distribution. |
beta |
the structural parameter. |
len |
number of points used to plot the smooth curve. |
order |
the order of the derivative of the gradient function to be plotted. If 0, it is the gradient function itself. |
col |
color for the curve. |
col2 |
color for the support points. |
add |
if |
main , xlab , ylab , cex , pch , lwd , xlim , ylim |
arguments for graphical
parameters (see |
... |
arguments passed on to function |
Details
data
must belong to a mixture family, as specified by its class.
The support points are shown on the horizontal line of gradient 0. The vertical lines going downwards at the support points are proportional to the mixing proportions at these points.
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
See Also
plot.nspmix
, nnls
, cnm
,
cnmms
, npnorm
, nppois
.
Examples
## Poisson mixture
x = rnppois(200, disc(c(1,4), c(0.7,0.3)))
r = cnm(x)
plotgrad(x, r$mix)
## 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
plotgrad(x, r$mix, r$beta)