npnorm: Class 'npnorm'

View source: R/npnorm.R

npnormR Documentation

Class npnorm

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.

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 dnpnorm is the density function of a normal mixture.

Function pnpnorm is the distribution function of a normal mixture.

Usage

npnorm(v, w = 1)
rnpnorm(n, mix=disc(0), sd=1)
dnpnorm(x, mix=disc(0), sd=1, log=FALSE)
pnpnorm(x, mix=disc(0), sd=1, lower.tail=TRUE, log.p=FALSE)

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.

sd

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

x

a numeric vector or an object of class npnorm.

log, log.p

logical, for computing the log-values or not.

lower.tail

logical, for computing the lower tail value or not.

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


mix = disc(pt=c(0,4), pr=c(0.3,0.7))  # a discrete distribution
x = rnpnorm(200, mix, sd=1)
dnpnorm(-2:6, mix, sd=1)
pnpnorm(-2:6, mix, sd=1)
dnpnorm(npnorm(-2:6), mix, sd=1)
pnpnorm(npnorm(-2:6), mix, sd=1)


nspmix documentation built on June 8, 2025, 12:29 p.m.

Related to npnorm in nspmix...