Trial-based model where the numerator represents successes out of denominator trials. The denominator can be treated as known (fixed) or modelled with its own process.
Use cases:
Detection / availability (occupancy-style)
Successes / trials (hierarchical binomial)
Proportions with known denominators
Examples
# Create family object
fam <- ratiod_binomial()
print(fam)
#> tulpaRatio family: binomial_fixed
#> Binomial numerator with fixed denominator
#>
#> Numerator: binomial(logit)
#> Denominator: fixed (fixed)
# Simulate detection/availability data
set.seed(123)
n <- 50
df <- data.frame(
detections = rbinom(n, size = 10, prob = 0.4),
trials = rep(10L, n),
effort = rnorm(n),
site = factor(rep(1:10, each = 5))
)
if (FALSE) { # \dontrun{
# Fit model (slow, not run on CRAN)
fit <- tratio(
detections | trials ~ effort + (1 | site),
data = df,
family = ratiod_binomial(),
control = list(iter = 200, warmup = 100, chains = 1)
)
} # }