Skip to contents

Extract posterior distributions of temporal effects from a fitted tulpaRatio model with temporal specification.

Usage

temporal(
  object,
  component = "all",
  summary = FALSE,
  probs = c(0.025, 0.5, 0.975),
  ...
)

# S3 method for class 'ratiod_fit'
temporal(
  object,
  component = "all",
  summary = FALSE,
  probs = c(0.025, 0.5, 0.975),
  ...
)

Arguments

object

A ratiod_fit object fitted with temporal argument

component

Which component to extract for multi-scale models: "all" (default), "trend", "seasonal", or "short_term".

summary

Logical; if TRUE, return summary statistics instead of full posterior draws.

probs

Quantiles to compute if summary = TRUE.

...

Ignored

Value

A ratiod_temporal_posterior object

Examples

if (FALSE) { # \dontrun{
# Fit model with multi-scale temporal effects (not run - experimental)
set.seed(131)
df <- data.frame(
  year = 1:40,
  x = rnorm(40),
  count = rpois(40, lambda = 22),
  effort = rgamma(40, shape = 4.5, rate = 1)
)

fit <- tratio(
  count | effort ~ x,
  data = df,
  family = ratiod_poisson_gamma(),
  temporal = temporal_multiscale("year", trend = "rw2", seasonal = 12),
  control = list(iter = 200, warmup = 100, chains = 1)
)

# Extract all temporal effects
temp_post <- temporal(fit)
summary(temp_post)
} # }