npnbinom: Class 'npnbinom'

View source: R/npnbinom.R

npnbinomR Documentation

Class npnbinom

Description

Class npnbinom is used to store data that will be processed as those of a nonparametric negative binomial mixture.

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

Function rnpnbinom generates a random sample from a negative binomial mixture and saves the data as an object of class npnbinom.

Usage

npnbinom(v, w=1, size, grouping=TRUE)
rnpnbinom(n, size, mix=disc(0.5))
dnpnbinom(x, mix=disc(0.5), size=NULL, log=FALSE)
pnpnbinom(x, mix=disc(0.5), size=NULL, 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.

size

number of successful trials (ignored if x is an object of class npnbinom).

grouping

logical, to use frequencies (w) for identical values

n

the sample size.

x

an object of class npnbinom, or a numeric vector (then value of size must be provided).

mix

an object of class disc.

log

=FALSE, if log-values are to be returned.

lower.tail

=FALSE, if lower.tail values are to be returned.

log.p

=FALSE, if log probability values are to be returned.

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.2,0.5), pr=c(0.3,0.7))
(x = rnpnbinom(200, size=10, mix))
dnpnbinom(x, mix, size=10)
pnpnbinom(x, mix, size=10)


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

Related to npnbinom in nspmix...