Last chance! 50% off unlimited learning
Sale ends in
rnbinom()
samples negative-binomial data.
The following description of the sampling process is based on the parametrization
used by Gsteiger et al. 2013.
rnbinom(n, lambda, kappa, offset = NULL)
rnbinom()
returns a data.frame
with two columns:
y
as the observations and offset
as the number of offsets per
observation.
defines the number of clusters (
defines the overall Poisson mean (
dispersion parameter (
defines the number of experimental units per cluster (
The variance of the negative-binomial distribution is
Define the parameters of the gamma distribution as
Gsteiger, S., Neuenschwander, B., Mercier, F. and Schmidli, H. (2013): Using historical control information for the design and analysis of clinical trials with overdispersed count data. Statistics in Medicine, 32: 3609-3622. tools:::Rd_expr_doi("10.1002/sim.5851")
# Sampling of negative-binomial observations
# with different offsets
set.seed(123)
rnbinom(n=5, lambda=5, kappa=0.13, offset=c(3,3,2,3,2))
Run the code above in your browser using DataLab