residSVD2 {CvmortalityMult} | R Documentation |
Function to extract the resid from SVD
Description
This function uses the first d
components of the singular value
decomposition in order to approximate a vector of model residuals by a
sum of d
multiplicative terms, with the multiplicative
structure determined by two specified factors follows the SVD function by Turner et al. (2023).
For glm
and gnm
models from the gnm
R-packages,
the matrix entries are weighted working residuals. The primary use of residSVD
is to
generate good starting values for the parameters in Mult terms
in models to be fitted using gnm. In this case, we modified the function
in order to obtain good starting values for the multi-population mortality models.
Usage
residSVD2(model, fac1, fac2, d = 1)
Arguments
model |
object with na.action, residuals, and weights methods, e.g. objects inheriting from class |
fac1 |
first factor. |
fac2 |
second factor. |
d |
integer, the number of multiplicative terms to use in the approximation. |
Value
If d = 1
, a numeric vector; otherwise a numeric matrix with d
columns.
References
Turner, H., & Firth, D. (2023). Generalized nonlinear models in R: An overview of the gnm package. R package version 1.1-5. https://CRAN.R-project.org/package=gnm
See Also
fitLCmulti
, forecast.fitLCmulti
multipopulation_cv
, plot.fitLCmulti
plot.forLCmulti