Two-process model where the numerator follows a Poisson distribution and the denominator (effort/exposure) follows a Gamma distribution. This is the natural family for CPUE-type data.
Use cases:
Catch per unit effort (CPUE)
Observations per hour
Events per continuous exposure
Examples
# Create family object
fam <- ratiod_poisson_gamma()
print(fam)
#> tulpaRatio family: poisson_gamma
#> Poisson numerator, Gamma denominator (CPUE-type)
#>
#> Numerator: poisson(log)
#> Denominator: gamma (log)
# Simulate CPUE data
set.seed(123)
n <- 60
season <- factor(rep(c("spring", "summer", "fall"), each = n/3))
vessel <- factor(rep(1:10, each = n/10))
u <- rnorm(10, sd = 0.5)[vessel]
depth <- rnorm(n)
df <- data.frame(
catch = rpois(n, exp(1.5 + 0.3 * depth + 0.4 * (season == "summer") + u)),
effort_hours = rgamma(n, shape = 4, rate = exp(-u)),
depth = depth,
season = season,
vessel = vessel
)
# \donttest{
# Fit model
fit <- tratio(
catch | effort_hours ~ depth + season + (1 | vessel),
data = df,
family = ratiod_poisson_gamma(),
control = list(iter = 400, chains = 1, seed = 1)
)
summary(fit)
#> ratio model summary
#> ===================
#>
#> Inference: Exact (Tier 1) via hmc
#> Family: poisson_gamma
#>
#> Fixed effects (numerator):
#> parameter mean sd 2.5% 97.5% rhat ess_bulk
#> num:(Intercept) 1.334 0.201 0.928 1.704 1.017 40
#> num:depth 0.305 0.057 0.198 0.418 1.004 74
#> num:seasonspring 0.017 0.332 -0.675 0.606 1.079 26
#> num:seasonsummer 0.817 0.250 0.329 1.249 1.020 65
#>
#> Fixed effects (denominator):
#> parameter mean sd 2.5% 97.5% rhat ess_bulk
#> denom:(Intercept) 1.102 0.215 0.719 1.537 1.022 33
#> denom:depth -0.007 0.092 -0.186 0.162 1.004 85
#> denom:seasonspring 0.378 0.340 -0.213 1.039 1.086 25
#> denom:seasonsummer 0.464 0.249 -0.123 0.860 1.029 43
#>
#> Variance components:
#> parameter mean sd 2.5% 97.5% rhat ess_bulk
#> shape 4.043 0.815 2.693 5.740 1.026 87
#> sigma_re 0.491 0.185 0.284 1.011 0.999 42
#>
#> Diagnostics:
#> Divergences: 0
#> Avg. acceptance: 0.873
#> Chains: 1
#> Iterations: 400
#> Warmup: 200
#> R-hat > 1.01 for 7 parameter(s), largest 1.086 (denom:seasonspring).
#> Bulk ESS < 100 for 10 parameter(s), smallest 25 (denom:seasonspring).
#> Run longer chains or reparameterise before using these estimates.
# }