SVD_AR {bage} | R Documentation |
Dynamic SVD-Based Priors for Age Profiles or Age-Sex Profiles
Description
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 |
n_comp |
Number of components from scaled SVD
to use in modelling. The default is half
the number of components of |
indep |
Whether to use separate or
combined SVDs in terms involving sex or gender.
Default is |
n_coef |
Number of AR coefficients in |
s |
Scale for standard deviations terms. |
shape1 , shape2 |
Parameters for prior
for coefficients in |
con |
Constraints on parameters.
Current choices are |
min , max |
Minimum and maximum values
for autocorrelation coefficient in |
sd |
Standard deviation
of initial value for random walks. Default is |
sd_slope |
Standard deviation in prior
for initial slope. Default is |
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.
Value
An object of class "bage_prior_svd_ar"
,
"bage_prior_svd_rw"
, or "bage_prior_svd_rw2"
.
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 periodt
; -
\pmb{\beta}_{u,t}
is a subvector of\pmb{\beta}_t
holding values for theu
th combination of the non-age, non-time, non-sex/gender variables for periodt
; -
\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
when trying to obtain interpretable values
for main effects and interactions, it can be helpful to increase
identifiability through the use of constraints, specified through the
con
argument.
Current options for con
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
-
HMD
Mortality rates from the Human Mortality Database. -
HFD
Fertility rates from the Human Fertility Database.
References
For details of the construction of scaled SVDS see the
-
Mathematical Details vignette
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_RW(HMD, n_comp = 3)
SVD_RW2(HMD, indep = FALSE)