Learn R Programming

COUNT (version 1.3.2)

nb1_syn: Negative binomial (NB1): generic synthetic linear negative binomial data and model

Description

nb1_syn is a generic function for developing synthetic NB1 data and a model given user defined specifications.

Usage

nb1_syn(nobs=50000, delta=1, xv = c(1, 0.75, -1.25))

Arguments

nobs
number of observations in model, Default is 50000
delta
NB1 heterogeneity or ancillary parameter
xv
predictor coefficient values. First argument is intercept. Use as xv = c(intercept , x1_coef, x2_coef, ...)

Value

  • nb1yNegative binomial (NB1) response; number of counts
  • sim.datasynthetic data set

Details

Create a synthetic linear negative binomial (NB1) regression model using the appropriate arguments. Model data with predictors indicated as a group with a period (.). See examples. Data can be modeled using the ml.nb1.r function in the COUNT package, or by using the gamlss function in the gamlss package, using the "family=NBII" option.

References

Hilbe, J.M. (2011), Negative Binomial Regression, second edition, Cambridge University Press.

See Also

nb2_syn, nbc_syn

Examples

Run this code
sim.data <- nb1_syn(nobs = 5000, delta = .5, xv = c(.5, 1.25, -1.5))
mynb1 <- ml.nb1(nb1y ~ . , data = sim.data)
mynb1

# use gamlss to model NB1 data
library(gamlss)         
sim.data <- nb1_syn(nobs = 5000, delta = .5, xv = c(.5, 1.25, -1.5))
mynb1 <- gamlss( nb1y ~ . , family=NBII, data = sim.data)
mynb1

# default
sim.data <- nb1_syn()
dnb1 <- ml.nb1(nb1y ~ . , data = sim.data)
dnb1

Run the code above in your browser using DataLab