Two-process model where both numerator and denominator follow log-normal distributions. Appropriate when the underlying process is multiplicative and residuals are log-normally distributed.
Use cases:
Abundance indices (CPUE with continuous effort)
Economic ratios (costs, prices)
Body condition indices
Details
The log-normal distribution arises when a variable is the product of many independent positive factors. If \(Y = e^X\) where \(X\) is normal, then \(Y\) is log-normal.
For ratios, if both numerator and denominator are log-normal, the ratio is also log-normal (difference of normals on log scale). This can simplify interpretation when working on the log scale.
Examples
# Create family object
fam <- ratiod_lognormal()
print(fam)
#> tulpaRatio family: lognormal_lognormal
#> Log-normal numerator and denominator (multiplicative processes)
#>
#> Numerator: lognormal(log)
#> Denominator: lognormal (log)
# Simulate body condition data
set.seed(123)
n <- 60
df <- data.frame(
weight = rlnorm(n, meanlog = 3, sdlog = 0.3),
length_cubed = rlnorm(n, meanlog = 2, sdlog = 0.2),
age = sample(1:5, n, replace = TRUE),
sex = factor(rep(c("M", "F"), each = n/2)),
cohort = factor(rep(1:6, each = n/6))
)
# \donttest{
# Fit model
fit <- tratio(
weight | length_cubed ~ age + sex + (1 | cohort),
data = df,
family = ratiod_lognormal(),
control = list(iter = 400, chains = 1, seed = 1)
)
#> Warning: 1 divergent transition(s) after warmup; raise `adapt_delta` or reparameterise.
summary(fit)
#> ratio model summary
#> ===================
#>
#> Inference: Exact (Tier 1) via hmc
#> Family: lognormal_lognormal
#>
#> Fixed effects (numerator):
#> parameter mean sd 2.5% 97.5% rhat ess_bulk
#> num:(Intercept) 3.151 0.122 2.876 3.410 1.035 58
#> num:age -0.033 0.023 -0.075 0.010 1.011 121
#> num:sexM -0.047 0.109 -0.235 0.176 1.019 39
#>
#> Fixed effects (denominator):
#> parameter mean sd 2.5% 97.5% rhat ess_bulk
#> denom:(Intercept) 1.992 0.093 1.827 2.152 0.999 43
#> denom:age -0.003 0.015 -0.029 0.026 1.004 44
#> denom:sexM 0.045 0.103 -0.119 0.335 1.041 38
#>
#> Variance components:
#> parameter mean sd 2.5% 97.5% rhat ess_bulk
#> sigma_denom 0.181 0.018 0.151 0.227 0.999 97
#> sigma_num 0.282 0.032 0.226 0.346 0.996 78
#> sigma_re 0.097 0.076 0.008 0.284 1.050 32
#>
#> Diagnostics:
#> Divergences: 1
#> Avg. acceptance: 0.82
#> Chains: 1
#> Iterations: 400
#> Warmup: 200
#> R-hat > 1.01 for 5 parameter(s), largest 1.050 (sigma_re).
#> Bulk ESS < 100 for 8 parameter(s), smallest 32 (sigma_re).
#> Run longer chains or reparameterise before using these estimates.
# }