Negative binomial - Gamma family for overdispersed count/effort ratios
Source:R/family.R
ratiod_negbin_gamma.RdTwo-process model where the numerator follows a negative binomial distribution and the denominator (effort/exposure) follows a Gamma distribution. This fills the gap between Poisson-Gamma (equidispersed counts) and NegBin-NegBin (integer denominator): use it when counts are overdispersed and effort is continuous.
Use cases:
Overdispersed catch per unit effort (CPUE)
Overdispersed observations per continuous exposure
Any ratio of overdispersed counts over continuous positive effort
Examples
# Create family object
fam <- ratiod_negbin_gamma()
print(fam)
#> tulpaRatio family: negbin_gamma
#> Negative binomial numerator, Gamma denominator (overdispersed CPUE-type)
#>
#> Numerator: neg_binomial_2(log)
#> Denominator: gamma (log)
# Simulate overdispersed CPUE data
set.seed(123)
n <- 60
df <- data.frame(
catch = rnbinom(n, size = 5, mu = 8),
effort_hours = rgamma(n, shape = 4, rate = 1),
depth = rnorm(n),
vessel = factor(rep(1:6, each = n/6))
)
if (FALSE) { # \dontrun{
# Fit model (slow, not run on CRAN)
fit <- tratio(
catch | effort_hours ~ depth + (1 | vessel),
data = df,
family = ratiod_negbin_gamma(),
control = list(iter = 200, warmup = 100, chains = 1)
)
} # }