Dynamic SVD-Based Priors for Age Profiles or Age-Sex Profiles
Source:R/bage_prior-constructors.R
SVD_AR.Rd
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, zero_sum = FALSE)
SVD_AR1(
ssvd,
n_comp = NULL,
indep = TRUE,
min = 0.8,
max = 0.98,
s = 1,
zero_sum = FALSE
)
SVD_RW(ssvd, n_comp = NULL, indep = TRUE, s = 1, zero_sum = FALSE)
SVD_RW2(
ssvd,
n_comp = NULL,
indep = TRUE,
s = 1,
sd_slope = 1,
zero_sum = FALSE
)
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.
- zero_sum
If
TRUE
, values must sum to 0 within each combination of the 'by' variables. Default isFALSE
.- min, max
Minimum and maximum values for autocorrelation coefficient in
SVD_AR()
. Defaults are0.8
and0.98
.- sd_slope
Standard deviation in prior for initial slope. Default is
1
.
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
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\);
\(J\) is the number of elements of \(\pmb{\beta}_t\);
\(V\) is the number of elements of \(\pmb{\beta}_{u,t}\);
\(n\) is
n_coef
;\(\pmb{F}\) is a known matrix with dimension \(J \times n\) or \(V \times n\);
\(\pmb{g}\) is a known vector with \(J\) or \(V\) elements.
\(\pmb{F}\) and \(\pmb{g}\) are constructed from a large database of age-specific demographic estimates by performing an SVD and 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 more on the \(\phi\) and \(\epsilon\), see AR()
, AR1()
,
RW()
, and RW2()
.
Scaled SVDs of demographic databases in bage
HMD
Mortality rates from the Human Mortality Database.
References
For details of the construction of scaled SVDS see the vignette here.
See also
SVD()
SVD prior for non-time-varying termsRW()
Smoothing via random walkRW2()
Smoothing via second-order random walkSp()
Smoothing via splinespriors Overview of priors implemented in bage
set_prior()
Specify prior for intercept, main effect, or interactionset_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
#> zero_sum: FALSE
SVD_RW(HMD, n_comp = 3)
#> SVD_RW(HMD)
#> ssvd: HMD
#> n_comp: 3
#> s: 1
#> along: NULL
#> zero_sum: FALSE
SVD_RW2(HMD, indep = FALSE)
#> SVD_RW2(HMD,indep=FALSE)
#> ssvd: HMD
#> n_comp: 3
#> indep: FALSE
#> s: 1
#> sd_slope: 1
#> along: NULL
#> zero_sum: FALSE