mod_pois {bage}R Documentation

Specify a Poisson Model

Description

Specify a model where the outcome is drawn from a Poisson distribution.

Usage

mod_pois(formula, data, exposure)

Arguments

formula

An R formula, specifying the outcome and predictors.

data

A data frame containing outcome, predictor, and, optionally, exposure variables.

exposure

Name of the exposure variable, or a 1, or a formula. See below for details.

Details

The model is hierarchical. The rates in the Poisson distribution are described by a prior model formed from dimensions such as age, sex, and time. The terms for these dimension themselves have models, as described in priors. These priors all have defaults, which depend on the type of term (eg an intercept, an age main effect, or an age-time interaction.)

Value

An object of class bage_mod_pois.

Mathematical details

The likelihood is

y_i \sim \text{Poisson}(\gamma_i w_i)

where

In some applications, there is no obvious population at risk. In these cases, exposure w_i can be set to 1 for all i.

The rates \gamma_i are assumed to be drawn a gamma distribution

y_i \sim \text{Gamma}(\xi^{-1}, (\xi \mu_i)^{-1})

where

Expected value \mu_i equals, on the log scale, the sum of terms formed from classifying variables,

\log \mu_i = \sum_{m=0}^{M} \beta_{j_i^m}^{(m)}

where

The \beta^{(m)} are given priors, as described in priors.

The prior for \xi is described in set_disp().

Specifying exposure

The exposure argument can take three forms:

See Also

Examples

## specify a model with exposure
mod <- mod_pois(injuries ~ age:sex + ethnicity + year,
                data = nzl_injuries,
                exposure = popn)

## specify a model without exposure
mod <- mod_pois(injuries ~ age:sex + ethnicity + year,
                data = nzl_injuries,
                exposure = 1)

## use a formula to specify exposure
mod <- mod_pois(injuries ~ age:sex + ethnicity + year,
                data = nzl_injuries,
                exposure = ~ pmax(popn, 1))

[Package bage version 0.9.0 Index]