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.
neg_binomial_2(link = "log")
link | The same as for |
---|
An object of class family
very similar to
that of poisson
but with a different family name.
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")#> Warning: Pareto k diagnostic value is 0.81. Resampling is unreliable. Increasing the number of draws or decreasing tol_rel_grad may help.#> stan_glm #> family: neg_binomial_2 [log] #> formula: Days ~ Sex/(Age + Eth * Lrn) #> observations: 146 #> predictors: 14 #> ------ #> Median MAD_SD #> (Intercept) 3.0 0.3 #> SexM -0.5 0.3 #> SexF:AgeF1 -0.7 0.3 #> SexM:AgeF1 -0.7 0.3 #> SexF:AgeF2 -0.6 0.5 #> SexM:AgeF2 0.7 0.3 #> SexF:AgeF3 -0.3 0.3 #> SexM:AgeF3 1.2 0.3 #> SexF:EthN -0.1 0.3 #> SexM:EthN -0.7 0.3 #> SexF:LrnSL 1.0 0.5 #> SexM:LrnSL 0.3 0.4 #> SexF:EthN:LrnSL -1.4 0.5 #> SexM:EthN:LrnSL 0.8 0.4 #> #> Auxiliary parameter(s): #> Median MAD_SD #> reciprocal_dispersion 1.4 0.2 #> #> ------ #> * For help interpreting the printed output see ?print.stanreg #> * For info on the priors used see ?prior_summary.stanreg# or, equivalently, call stan_glm.nb() without specifying the family