Skip to contents

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

Usage

ratiod_lognormal(link_num = "log", link_denom = "log", denom_fixed = FALSE)

Arguments

Link function for numerator (default: "log")

Link function for denominator (default: "log")

denom_fixed

Logical; if TRUE, denominator is treated as fixed (only numerator is modelled as log-normal). Default FALSE.

Value

A ratiod_family object

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))
)

if (FALSE) { # \dontrun{
# Fit model (slow, not run on CRAN)
fit <- tratio(
  weight | length_cubed ~ age + sex + (1 | cohort),
  data = df,
  family = ratiod_lognormal(),
  control = list(iter = 200, warmup = 100, chains = 1)
)
} # }