Skip to contents

A Poisson or negative binomial count over any denominator the samplers fit: a known exposure ("fixed"), a count ("negbin") or a continuous effort ("gamma"). A known exposure is data: it scales the count mean, which is then the rate times the exposure, and the ratio is the rate. This is the disease-mapping model of observed cases over a population or an expected count. The zero-inflated and hurdle counterparts are ratiod_zipois(), ratiod_zinegbin(), ratiod_hurdle_pois() and ratiod_hurdle_negbin().

ratiod_poisson(denom_family = "gamma") is ratiod_poisson_gamma(), ratiod_negbin(denom_family = "negbin") is ratiod_negbin_negbin() and ratiod_negbin(denom_family = "gamma") is ratiod_negbin_gamma().

Usage

ratiod_poisson(link_num = "log", link_denom = "log", denom_family = "fixed")

ratiod_negbin(link_num = "log", link_denom = "log", denom_family = "fixed")

Arguments

Link function for the count mean: "log".

Link function for the denominator mean: "log" (default); a gamma denominator also takes "identity" or "inverse". Unread for a known exposure.

denom_family

Denominator distribution: "fixed" (default) for a known exposure, "negbin" for a count denominator, or "gamma" for continuous effort.

Value

A ratiod_family object

Examples

fam <- ratiod_poisson()
print(fam)
#> tulpaRatio family: poisson_fixed 
#> Poisson numerator, known exposure denominator 
#> 
#> Numerator:  poisson(log)
#> Denominator: fixed (fixed) 

# Cases over a known population at risk
set.seed(1)
n <- 60
df <- data.frame(population = round(runif(n, 500, 5000)), x = rnorm(n))
df$cases <- rpois(n, df$population * exp(-6 + 0.3 * df$x))

# \donttest{
fit <- tratio(cases | population ~ x, data = df,
              family = ratiod_poisson(),
              control = list(iter = 400, chains = 1, seed = 1))
coef(fit)
#> num:(Intercept)           num:x 
#>      -5.9861033       0.2837649 
# }