bellreg {bellreg}R Documentation

Bell regression model

Description

Fits the Bell regression model to overdispersed count data.

Usage

bellreg(
  formula,
  data = NULL,
  approach = c("mle", "bayes"),
  hessian = TRUE,
  link = c("log", "sqrt", "identity"),
  hyperpars = list(mu_beta = 0, sigma_beta = 10),
  ...
)

Arguments

formula

an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted.

data

an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which ypbp is called.

approach

approach to be used to fit the model (mle: maximum likelihood; bayes: Bayesian approach).

hessian

hessian logical; If TRUE (default), the hessian matrix is returned when approach="mle".

link

assumed link function (log, sqrt or identiy); default is log.

hyperpars

a list containing the hyperparameters associated with the prior distribution of the regression coefficients; if not specified then default choice is hyperpars = c(mu_beta = 0, sigma_beta = 10).

...

further arguments passed to either rstan::optimizing or rstan::sampling.

Value

bellreg returns an object of class "bellreg" containing the fitted model.

Examples


data(faults)
# ML approach:
mle <- bellreg(nf ~ lroll, data = faults, approach = "mle")
summary(mle)

# Bayesian approach:
bayes <- bellreg(nf ~ lroll, data = faults, approach = "bayes", refresh = FALSE)
summary(bayes)



[Package bellreg version 0.0.2 Index]