1. Introduction

library(bage)
library(rvec)
#> 
#> Attaching package: 'rvec'
#> The following objects are masked from 'package:stats':
#> 
#>     sd, var
#> The following object is masked from 'package:base':
#> 
#>     rank
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(ggplot2)
mod <- mod_pois(injuries ~ age : sex + age : ethnicity + year,
                data = injuries,
                exposure = popn) |>
  set_prior(year ~ AR1())
mod
#> -- Unfitted Poisson model --
#> 
#>      injuries ~ age:sex + age:ethnicity + year
#> 
#>   (Intercept) ~ NFix()
#>          year ~ AR1()
#>       age:sex ~ RW()
#> age:ethnicity ~ RW()
#> 
#>      dispersion: mean=1
#>        exposure: popn
#>         var_age: age
#>   var_sexgender: sex
#>        var_time: year
#>          n_draw: 1000