npnorm: Class 'npnorm'

Description Usage Arguments Details Author(s) References See Also Examples

View source: R/npnorm.R

Description

Class npnorm can be used to store data that will be processed as those of a nonparametric normal mixture. There are several functions associated with the class.

Usage

1
2
3
4
5
6
7
8
npnorm(v, w=1)
rnpnorm(n, mix=disc(0), sd=1)
## S3 method for class 'npnorm'
plot(x, mix, beta, breaks=NULL, col="red", len=100,
    add=FALSE, border.col=NULL, border.lwd=1,
    fill="lightgrey", main, lwd=2, lty=1, xlab="Data",
    ylab="Density", components=c("proportions","curves","null"),
    lty.components=2, lwd.components=2, ...)

Arguments

v

a numeric vector that stores the values of a sample.

w

a numeric vector that stores the corresponding weights/frequencies of the observations.

n

the sample size.

mix

an object of class disc, for a discrete distribution.

beta

the structural parameter.

sd

a scalar for the component standard deviation that is common to all components.

x

an object of class npnorm.

breaks

the rough number bins used for plotting the histogram.

col

the color of the density curve to be plotted.

len

the number of points roughly used to plot the density curve over the interval of length 8 times the component standard deviation around each component mean.

add

if FALSE, creates a new plot; if TRUE, adds the plot to the existing one.

border.col

color for the border of histogram boxes.

border.lwd

line width for the border of histogram boxes.

fill

color to fill in the histogram boxes.

components

if proportions (default), also show the support points and mixing proportions; if curves, also show the component density curves; if null, components are not shown.

lty.components, lwd.components

line type and width for the component curves.

main, lwd, lty, xlab, ylab

arguments for graphical parameters (see par).

...

arguments passed on to function plot.

Details

Function npnorm creates an object of class npnorm, given values and weights/frequencies.

Function rnpnorm generates a random sample from a normal mixture and saves the data as an object of class npnorm.

Function plot.npnorm plots the normal mixture.

When components="proportions", the component means are shown on the horizontal line of density 0. The vertical lines going upwardly 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.

See Also

nnls, cnm, cnmms, plot.nspmix.

Examples

1
2
3
mix = disc(pt=c(0,4), pr=c(0.3,0.7))  # a discrete distribution
x = rnpnorm(200, mix, sd=1)
plot(x, mix, beta=1)

nspmix documentation built on Oct. 23, 2020, 6:46 p.m.

Related to npnorm in nspmix...