Learn R Programming

COUNT (version 1.3.4)

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))

Value

nb1y

Negative binomial (NB1) response; number of counts

sim.data

synthetic data set

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, ...)

Author

Joseph M. Hilbe, Arizona State University, and Jet Propulsion Laboratory, California Institute of Technology Andrew Robinson, Universty of Melbourne, Australia.

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

if (FALSE) {
# 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
}

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

Run the code above in your browser using DataLab