Specify an independent temporal random effect: each time point gets its own
coefficient with phi[t] ~ N(0, sigma^2), no dependence between them.
Use it for a year or season effect that varies without a trend, and as the
unstructured comparison against which temporal_rw1(), temporal_rw2()
and temporal_ar1() add smoothness.
Arguments
- time_var
Name of the time variable in data. Can be a formula (e.g.,
~ year) or a character string (e.g.,"year").- group_var
Optional name of grouping variable for panel data. If provided, separate random walks are estimated for each group. Each group's walk sums to zero over time, so it carries the group's trend and not its level; add a group intercept such as
(1 | site)for the levels.Logical; if TRUE (default), temporal effect enters both numerator and denominator linear predictors identically.
Details
The precision matrix is tau * I: diagonal and full rank, so no constraint
is needed and no ordering of the time points is used. A model whose time
points carry no meaningful order fits the same way here as one whose do.
Examples
# Create temporal IID specification
temporal_iid("year")
#> tulpaRatio temporal specification
#> ============================
#>
#> Type: IID (Independent Effects)
#> Time variable: year
#> Shared: Yes (enters both processes)
# \donttest{
# Unstructured year effects
set.seed(129)
df <- data.frame(
year = rep(2010:2029, each = 2),
x = rnorm(40),
count = rpois(40, lambda = 22),
effort = rgamma(40, shape = 4, rate = 1)
)
fit <- tratio(
count | effort ~ x,
data = df,
family = ratiod_poisson_gamma(),
temporal = temporal_iid("year"),
mode = "hmc",
control = list(iter = 400, chains = 1, seed = 1)
)
# }