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.
Usage
RW2_Infant(s = 1, sd_slope = 1, con = c("none", "by"))
Details
A second-order random walk prior RW2()
works well for smoothing
mortality rates over age, except at age 0, where there
is a sudden jump in rates, reflecting the
special risks of infancy. The RW2_Infant()
extends the RW2()
prior by adding an indicator
variable for 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, \mathtt{sd\_slope}^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), \quad j = 3, \cdots, J$$
and when it is used with an interaction,
$$\beta_{u,1} \sim \text{N}(0, 1)$$ $$\beta_{u,2} \sim \text{N}(0, \mathtt{sd\_slope}^2)$$ $$\beta_{u,3} \sim \text{N}(2 \beta_{u,2}, \tau^2)$$ $$\beta_{u,v} \sim \text{N}(2 \beta_{u,v-1} - \beta_{u,v-2}, \tau^2), \quad v = 3, \cdots, V$$
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 \(\tau\) has a half-normal prior $$\tau \sim \text{N}^+(0, \mathtt{s}^2)$$.
Constraints
With some combinations of terms and priors, the values of the intercept, main effects, and interactions are are only weakly identified. For instance, it may be possible to increase the value of the intercept and reduce the value of the remaining terms in the model with no effect on predicted rates and only a tiny effect on prior probabilities. This weak identifiability is typically harmless. However, in some applications, such as forecasting, or when trying to obtain interpretable values for main effects and interactions, it can be helpful to increase identifiability through the use of constraints.
Current options for constraints are:
"none"
No constraints. The default."by"
Only used in interaction terms that include 'along' and 'by' dimensions. Within each value of the 'along' dimension, terms across each 'by' dimension are constrained to sum to 0.
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