Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

neg_binomial_2

Family function for negative binomial GLMs


Description

Specifies the information required to fit a Negative Binomial GLM in a similar way to negative.binomial. However, here the overdispersion parameter theta is not specified by the user and always estimated (really the reciprocal of the dispersion parameter is estimated). A call to this function can be passed to the family argument of stan_glm or stan_glmer to estimate a Negative Binomial model. Alternatively, the stan_glm.nb and stan_glmer.nb wrapper functions may be used, which call neg_binomial_2 internally.

Usage

neg_binomial_2(link = "log")

Arguments

link

The same as for poisson, typically a character vector of length one among "log", "identity", and "sqrt".

Value

An object of class family very similar to that of poisson but with a different family name.

Examples

if (!grepl("^sparc",  R.version$platform))
stan_glm(Days ~ Sex/(Age + Eth*Lrn), data = MASS::quine, seed = 123,
         family = neg_binomial_2, QR = TRUE, algorithm = "optimizing") 
                
# or, equivalently, call stan_glm.nb() without specifying the family

rstanarm

Bayesian Applied Regression Modeling via Stan

v2.21.1
GPL (>= 3)
Authors
Jonah Gabry [aut], Imad Ali [ctb], Sam Brilleman [ctb], Jacqueline Buros Novik [ctb] (R/stan_jm.R), AstraZeneca [ctb] (R/stan_jm.R), Trustees of Columbia University [cph], Simon Wood [cph] (R/stan_gamm4.R), R Core Deveopment Team [cph] (R/stan_aov.R), Douglas Bates [cph] (R/pp_data.R), Martin Maechler [cph] (R/pp_data.R), Ben Bolker [cph] (R/pp_data.R), Steve Walker [cph] (R/pp_data.R), Brian Ripley [cph] (R/stan_aov.R, R/stan_polr.R), William Venables [cph] (R/stan_polr.R), Paul-Christian Burkner [cph] (R/misc.R), Ben Goodrich [cre, aut]
Initial release
2020-07-20

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.