rmixnegbinom: Random numbers generator for negative binomial mixtures

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

View source: R/functions_only.R

Description

Generates random samples from a mixture of negative binomials.

Usage

1
rmixnegbinom(n, pis, size, probs)

Arguments

n

Size of the random sample.

pis

A vector collecting the mixture weights. See details.

size

A postive value corresponding to the target for number of successful trials. See details.

probs

A vector collecting the probabilities of success for every mixture component.

Details

The argument pis is a vector with length equal the number of components in the mixture. The vector pis must sum up to one, e.g. c(0.7, 0.2, 0.1). All the negative binomials contributing to the mixture are assumed to have the same size.

Value

A vector collecting the random sample of size n from the mixture of negative binomials specified.

Author(s)

Xiangyu Zhang and Sara Algeri

See Also

rmixtruncnorm, dmixtruncnorm, dmixnegbinom, find_h_disc.

Examples

1
rmixnegbinom(n=100,pis=c(0.3,0.6,0.1),size=2,probs=c(0.3,0.4,0.2))

Yorkee2018/LPsmooth documentation built on June 5, 2020, 12:32 a.m.