Skip to contents

Use components from a Singular Value Decomposition (SVD) to model an interaction involving age and time, or age, sex/gender and time, where the coefficients evolve over time.

Usage

SVD_AR(
  ssvd,
  n_comp = NULL,
  indep = TRUE,
  n_coef = 2,
  s = 1,
  shape1 = 5,
  shape2 = 5,
  con = c("none", "by")
)

SVD_AR1(
  ssvd,
  n_comp = NULL,
  indep = TRUE,
  min = 0.8,
  max = 0.98,
  s = 1,
  shape1 = 5,
  shape2 = 5,
  con = c("none", "by")
)

SVD_RW(ssvd, n_comp = NULL, indep = TRUE, s = 1, sd = 1, con = c("none", "by"))

SVD_RW2(
  ssvd,
  n_comp = NULL,
  indep = TRUE,
  s = 1,
  sd = 1,
  sd_slope = 1,
  con = c("none", "by")
)

Arguments

ssvd

Object of class "bage_ssvd" holding a scaled SVD. See below for scaled SVDs of databases currently available in bage.

n_comp

Number of components from scaled SVD to use in modelling. The default is half the number of components of ssvd.

indep

Whether to use separate or combined SVDs in terms involving sex or gender. Default is TRUE. See below for details.

n_coef

Number of AR coefficients in SVD_RW().

s

Scale for standard deviations terms.

shape1, shape2

Parameters for prior for coefficients in SVD_AR(). Defaults are 5 and 5.

con

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

min, max

Minimum and maximum values for autocorrelation coefficient in SVD_AR1(). Defaults are 0.8 and 0.98.

sd

Standard deviation of initial value for random walks. Default is 1. Can be 0.

sd_slope

Standard deviation in prior for initial slope. Default is 1.

Value

An object of class "bage_prior_svd_ar", "bage_prior_svd_rw", or "bage_prior_svd_rw2".

Details

SVD_AR(), SVD_AR1(), SVD_RW(), and SVD_RW2() priors assume that, in any given period, the age profiles or age-sex profiles for the quantity being modelled looks like they were drawn at random from an external demographic database. For instance, the SVD_AR() prior obtained via

SVD_AR(HMD)

assumes that profiles look like they were obtained from the Human Mortality Database.

Mathematical details

When the interaction being modelled only involves age and time, or age, sex/gender, and time

$$\pmb{\beta}_t = \pmb{F} \pmb{\alpha}_t + \pmb{g},$$

and when it involves other variables besides age, sex/gender, and time,

$$\pmb{\beta}_{u,t} = \pmb{F} \pmb{\alpha}_{u,t} + \pmb{g},$$

where

  • \(\pmb{\beta}\) is an interaction involving age, time, possibly sex/gender, and possibly other variables;

  • \(\pmb{\beta}_t\) is a subvector of \(\pmb{\beta}\) holding values for period \(t\);

  • \(\pmb{\beta}_{u,t}\) is a subvector of \(\pmb{\beta}_t\) holding values for the \(u\)th combination of the non-age, non-time, non-sex/gender variables for period \(t\);

  • \(\pmb{F}\) is a known matrix; and

  • \(\pmb{g}\) is a known vector.

\(\pmb{F}\) and \(\pmb{g}\) are constructed from a large database of age-specific demographic estimates by applying the singular value decomposition, and then standardizing.

With SVD_AR(), the prior for the \(k\)th element of \(\pmb{\alpha}_t\) or \(\pmb{\alpha}_{u,t}\) is

$$\alpha_{k,t} = \phi_1 \alpha_{k,t-1} + \cdots + \phi_n \beta_{k,t-n} + \epsilon_{k,t}$$

or

$$\alpha_{k,u,t} = \phi_1 \alpha_{k,u,t-1} + \cdots + \phi_n \beta_{k,u,t-n} + \epsilon_{k,u,t};$$

with SVD_AR1(), it is

$$\alpha_{k,t} = \phi \alpha_{k,t-1} + \epsilon_{k,t}$$

or

$$\alpha_{k,u,t} = \phi \alpha_{k,u,t-1} + \epsilon_{k,u,t};$$

with SVD_RW(), it is

$$\alpha_{k,t} = \alpha_{k,t-1} + \epsilon_{k,t}$$

or

$$\alpha_{k,u,t} = \alpha_{k,u,t-1} + \epsilon_{k,u,t};$$

and with SVD_RW2(), it is

$$\alpha_{k,t} = 2 \alpha_{k,t-1} - \alpha_{k,t-2} + \epsilon_{k,t}$$

or

$$\alpha_{k,u,t} = 2 \alpha_{k,u,t-1} - \alpha_{k,u,t-2} + \epsilon_{k,u,t}.$$

For details, see AR(), AR1(), RW(), and RW2().

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.

Scaled SVDs of demographic databases in bage

References

  • For details of the construction of scaled SVDS see the vignette here.

See also

  • SVD() SVD prior for non-time-varying terms

  • RW() Smoothing via random walk

  • RW2() Smoothing via second-order random walk

  • Sp() Smoothing via splines

  • priors Overview of priors implemented in bage

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

  • set_var_sexgender() Identify sex or gender variable in data

Examples

SVD_AR1(HMD)
#>   SVD_AR1(HMD) 
#>       ssvd: HMD
#>     n_comp: 3
#>        min: 0.8
#>        max: 0.98
#>          s: 1
#>      along: NULL
#>        con: none
SVD_RW(HMD, n_comp = 3)
#>   SVD_RW(HMD) 
#>       ssvd: HMD
#>     n_comp: 3
#>          s: 1
#>         sd: 1
#>      along: NULL
#>        con: none
SVD_RW2(HMD, indep = FALSE)
#>   SVD_RW2(HMD,indep=FALSE) 
#>       ssvd: HMD
#>     n_comp: 3
#>      indep: FALSE
#>          s: 1
#>         sd: 1
#>   sd_slope: 1
#>      along: NULL
#>        con: none