Second-Order Random Walk Prior with 'Infant' Indicator
Source:R/bage_prior-constructors.R
RW2_Infant.Rd
Use a second-order random walk to model variation over age, with an indicator variable for the first age group. Designed for use in models of mortality rates.
Details
A second-order random walk prior RW2()
does a good job of smoothing
mortality rates over age, except at age 0, where there
is typically a sudden jump in rates, reflecting the
special risks of infancy. The RW2_Infant()
is a RW2()
prior with a special treatment of
the first age group.
If RW2_Infant()
is used in an interaction,
the 'along' dimension is always age, implying that
there is a separate random walk along age within each
combination of the 'by' variables.
Argument s
controls the size of innovations in the random walk.
Smaller values for s
tend to give smoother series.
Argument sd
controls the sl size of innovations in the random walk.
Smaller values for s
tend to give smoother series.
Mathematical details
When RW2_Infant()
is used with a main effect,
$$\beta_1 \sim \text{N}(0, 1)$$ $$\beta_2 \sim \text{N}(0, \omega^2)$$ $$\beta_3 \sim \text{N}(2 \beta_2, \tau^2)$$ $$\beta_j \sim \text{N}(2 \beta_{j-1} - \beta_{j-2}, \tau^2)$$
and when it is used with an interaction,
$$\beta_{u,1} \sim \text{N}(0, 1)$$ $$\beta_{u,2} \sim \text{N}(0, \omega^2)$$ $$\beta_{u,3} \sim \text{N}(2 \beta_{u,2}, \tau^2)$$ $$\beta_{u,j} \sim \text{N}(2 \beta_{u,v-1} - \beta_{u,v-2}, \tau^2)$$
where
\(\pmb{\beta}\) is a main effect or interaction;
\(j\) denotes position within the main effect;
\(v\) denotes position within the 'along' variable of the interaction; and
\(u\) denotes position within the 'by' variable(s) of the interaction.
Parameter \(\omega\) has a half-normal prior
$$\omega \sim \text{N}^+(0, \text{sd}^2),$$
where sd
can be specified by the user.
Parameter \(\tau\) has a half-normal prior
$$\tau \sim \text{N}^+(0, \text{s}^2),$$
where s
can be specified by the user.
See also
RW2()
Second-order random walk, without infant indicatorSp()
Smoothing via splinesSVD()
Smoothing over age via singular value decompositionpriors Overview of priors implemented in bage
set_prior()
Specify prior for intercept, main effect, or interaction