Skip to contents

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"))

Arguments

s

Scale for the prior for the innovations. Default is 1.

sd_slope

Standard deviation for initial slope of random walk. Default is 1.

con

Constraints on parameters. Current choices are "none" and "by". Default is "none". See below for details.

Value

Object of class "bage_prior_rw2infant".

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 indicator

  • Sp() Smoothing via splines

  • SVD() Smoothing over age via singular value decomposition

  • priors Overview of priors implemented in bage

  • set_prior() Specify prior for intercept, main effect, or interaction

Examples

RW2_Infant()
#>   RW2_Infant() 
#>          s: 1
#>   sd_slope: 1
#>        con: none
RW2_Infant(s = 0.1)
#>   RW2_Infant(s=0.1) 
#>          s: 0.1
#>   sd_slope: 1
#>        con: none