bellreg: Bell regression model

Description Usage Arguments Value Examples

View source: R/bellreg.R

Description

Fits the Bell regression model to overdispersed count data.

Usage

1
2
3
4
5
6
7
8
bellreg(
  formula,
  data,
  approach = c("mle", "bayes"),
  hessian = TRUE,
  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".

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

1
2
3
4
5
6
7
# ML approach:
mle <- bellreg(nf ~ lroll, data = faults, approach = "mle")
summary(mle)

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

bellreg documentation built on July 1, 2020, 8:29 p.m.