Skip to content

Commit

Permalink
version 1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeBiessy authored and cran-robot committed Apr 11, 2024
1 parent 251807d commit 195b488
Show file tree
Hide file tree
Showing 38 changed files with 967 additions and 974 deletions.
16 changes: 9 additions & 7 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Package: WH
Type: Package
Title: Enhanced Implementation of Whittaker-Henderson Smoothing
Version: 1.1.0
Version: 1.1.1
Authors@R: person("Guillaume", "Biessy", email = "guillaume.biessy78@gmail.com",
role = c("aut", "cre"), comment = c(ORCID = "0000-0003-3756-7345"))
role = c("aut", "cre", "cph"), comment = c(ORCID = "0000-0003-3756-7345"))
Description: An enhanced implementation of Whittaker-Henderson smoothing for the gradation
of one-dimensional and two-dimensional actuarial tables used to quantify Life Insurance risks.
'WH' is based on the methods described in Biessy (2023) <doi:10.48550/arXiv.2306.06932>.
Expand All @@ -16,13 +16,15 @@ URL: https://github.com/GuillaumeBiessy/WH
BugReports: https://github.com/GuillaumeBiessy/WH/issues
Depends: R (>= 4.2)
Imports: stats
Suggests: knitr, rmarkdown, testthat (>= 3.0.0)
Suggests: knitr, rmarkdown, spelling, testthat (>= 3.0.0)
Config/testthat/edition: 3
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
VignetteBuilder: knitr
Language: en-US
NeedsCompilation: no
Packaged: 2023-09-16 11:47:09 UTC; Guillaume BIESSY
Author: Guillaume Biessy [aut, cre] (<https://orcid.org/0000-0003-3756-7345>)
Packaged: 2024-03-30 15:51:06 UTC; Guillaume Biessy
Author: Guillaume Biessy [aut, cre, cph]
(<https://orcid.org/0000-0003-3756-7345>)
Maintainer: Guillaume Biessy <guillaume.biessy78@gmail.com>
Repository: CRAN
Date/Publication: 2023-09-18 08:20:02 UTC
Date/Publication: 2024-04-10 16:40:02 UTC
71 changes: 36 additions & 35 deletions MD5
Original file line number Diff line number Diff line change
@@ -1,52 +1,53 @@
2e1a1dc73c63f5072005124f7f6ee7ab *DESCRIPTION
f0b75b6da8f835c34824cee20c5fcc48 *DESCRIPTION
cda3ab64b68876145fdd6d6032379c16 *NAMESPACE
f9088b37832cd871673066795553b92b *NEWS.md
6f005df720dee1e2788140dea3ac0d24 *R/WH-package.R
cdbd6da5a263f78eef1b2b6e02912118 *R/main.R
5067dafecc2c1b8b0763bc4d9253423a *NEWS.md
b133b1090e5677f757a1eb5277a0e63b *R/WH-package.R
e1b895ecb9e1771ae092709e08dec585 *R/main.R
4e3a90501d0387bdb1035ebaf7c5501c *R/tools.R
90cbe261c9ca614a2a18554cfc07b2b4 *README.md
7c8bfb9d72b020e0c68f9873f61961de *build/vignette.rds
3f3ff6d6fa13e7d64926ff4dfb19d99e *README.md
770f7d8a321e201ab7ada04c67addd5a *build/vignette.rds
43fa807f5c4aa6c8aa8b1301a594e70d *data/portfolio_LTC.rda
389c4d1f41c027674a25bf81c71fccf8 *data/portfolio_mort.rda
13e5b5217d0ca0ae468daab576cdd2db *inst/CITATION
54f678fb74ad9318fb08d433ad877986 *inst/CITATION
712304661eecd6942e913ba103cfee62 *inst/WORDLIST
d847721c40983fb15fdb62c0b9e141c8 *inst/doc/WH.R
b2438c9365b57f8dc207cffc3b229c80 *inst/doc/WH.Rmd
efba59e111c312606d010e0bd61abbf6 *inst/doc/WH.html
2d7c65133d7934fd4a6f97fcdab7cc2e *man/WH-package.Rd
d442149a14024490020343be20420da0 *man/WH_1d.Rd
889d09be20652fdc6ffb4cc631ce0a5a *man/WH_1d_fixed_lambda.Rd
6cac4e003cf20fe118935116c371f8cb *man/WH_1d_outer.Rd
3ccec8ddf5f0423e803659ca4642ecef *man/WH_1d_perf.Rd
8f7e3bd1c1dfd1fa0c370e3a8e2c5900 *inst/doc/WH.Rmd
90dd96cc82b175d884a19ad07c302166 *inst/doc/WH.html
0cedf3628fb7d43de64d546010ac7b68 *man/WH-package.Rd
c681a22ef91c0a8166e9a04b07b90636 *man/WH_1d.Rd
87c11e97582de438f0f643b91ae700d9 *man/WH_1d_fixed_lambda.Rd
d6bf463db5dbe034adb2fb2b4814cc35 *man/WH_1d_outer.Rd
4d300d076450ab1273c4e546ba7f7ca5 *man/WH_1d_perf.Rd
357d0d5c34cc66b4e095c0ca538f79d2 *man/WH_2d.Rd
4ab1a2780f9ae7126464586d7d6577e7 *man/WH_2d_fixed_lambda.Rd
59cbf4c1489a31144a94c1bac0297795 *man/WH_2d_outer.Rd
4ab6d6eadc694865216157d2cd4d539e *man/WH_2d_perf.Rd
c30efae626f31a93a96c5dfda631cb19 *man/WH_2d_fixed_lambda.Rd
637eac1756b5a21951538762157e9839 *man/WH_2d_outer.Rd
9754652bb5cf72e62534e5fba64583be *man/WH_2d_perf.Rd
e718b63482111fbb469b0d7a6eb447ca *man/blockdiag.Rd
495e497b6cb6e4dd81b8377fa85a521f *man/build_D_mat.Rd
3797917646aa550a487c894ef5123562 *man/compute_res_deviance.Rd
f474d77fcdc426cc29ac5fe5475fbbbf *man/eigen_dec.Rd
19ba916745c2273fee313d3a6ae3cdcd *man/build_D_mat.Rd
655323575573de23a5c40bc1ef3294ad *man/compute_res_deviance.Rd
c389e1b0e35b7efc0f895358c3f4b17a *man/eigen_dec.Rd
eaef6ac0f3b6e7b13ffdf2e0af009a11 *man/figures/README-plot-1.png
c9ba1845c022a3033eb0181914837eac *man/figures/README-plot-2.png
322acdd22207c3b58d5b964ada6026d3 *man/figures/README-plot-3.png
a97393938e4803c65f958748c3d3b49a *man/figures/README-plot-4.png
7e48b945d48d76c2c88dd6bedd6138d5 *man/figures/README-plot-5.png
464d10356c7b350846c2b1a04227ce90 *man/figures/README-predict-1.png
04fe2b0f7cfaa7d6f7d4d4a27a424c3f *man/figures/README-predict-2.png
4e6e1418d443718c7de38fce6036de54 *man/get_diagnosis.Rd
d5e82535ed8b3fceab4cc7509b156a4b *man/map.Rd
c3ea0d729406c8ed3ddfd2694d8b46ae *man/map2.Rd
06f6848a69722cf63ab62ac3da08f89b *man/output_to_df.Rd
8a1b07ebc43dbc50a23939802275b475 *man/plot.WH_1d.Rd
bd29980fbd8d37f235cf65a15555308a *man/plot.WH_2d.Rd
283d764e69419d9dcba4233388ceea48 *man/portfolio_LTC.Rd
c2269a20aa5c5f6839e2a2cf9a355d04 *man/portfolio_mort.Rd
83455467c459d81b4cc7ed8952fe3a65 *man/predict.WH_1d.Rd
6f2f320f3946cbb76e0f0099ea4aeee4 *man/get_diagnosis.Rd
e19a925c5ec6459c97c66ff91fb12a64 *man/map.Rd
f4d10b90920ef1541549e7f1036dafd8 *man/map2.Rd
91b8bdf7bfee88584e9fde5ec02a535b *man/output_to_df.Rd
102c1700bbfad0c56ff69e7debb5aeaa *man/plot.WH_1d.Rd
03806d2b9477eb8de24e893055a3b70b *man/plot.WH_2d.Rd
b6b8cc174374e3cbecd75761864cef86 *man/portfolio_LTC.Rd
7a2d7205f04fae4319cb1e5d75fc822a *man/portfolio_mort.Rd
b4d07169f108d39f74ad3dc610d07eb4 *man/predict.WH_1d.Rd
b82976558c28dc55d3cc2a4562b7faf9 *man/predict.WH_2d.Rd
9a98438678dfc5b9ee8d219f97e5515e *man/print.WH_1d.Rd
c4ed3089c4af14ec341cdcaa83e2841c *man/print.WH_2d.Rd
b2865b8db63c0d26a7c26949ea3ddcb7 *man/print.WH_1d.Rd
b654d5a850d9572005cab559927c5119 *man/print.WH_2d.Rd
332173f20d20942c02019350ea4dcadc *tests/spelling.R
828d0a66030e7522cf399e9e2c90bca4 *tests/testthat.R
98b0b2097af4a4ed1574e915654f2ed5 *tests/testthat/test-1D.R
e430db3a04daae6211dac97fd26ca510 *tests/testthat/test-2D.R
b2438c9365b57f8dc207cffc3b229c80 *vignettes/WH.Rmd
ecfe2ac0176df273cadfa9e69fdb6815 *vignettes/Whittaker_Henderson_plots.R
dbb34774c5dc559070651d626ded7e1a *tests/testthat/test-1D.R
4b8cf2f662743c39bc58b3b108854fa9 *tests/testthat/test-2D.R
8f7e3bd1c1dfd1fa0c370e3a8e2c5900 *vignettes/WH.Rmd
5f5187a8555f27efd51e5cfc43d0a846 *vignettes/biblio.bib
94 changes: 49 additions & 45 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,49 @@
# WH 1.1.0

* Made significant changes to the extrapolation methods provided by be `predict.WH_1d` and `predict.WH_2d` functions. It turns out that the formula used for the extrapolation ignored the innovation error caused by the prior on the extrapolated region, resulting in smaller credibility intervals than they should have been. This now has been fixed.

# WH 1.0.7

* Removed tests of the form `expect_equal(f(x), f(x))` after confirmation they do not work with MKL BLAS

# WH 1.0.6

* Further improved test robustness

* Added tests of the form `expect_equal(f(x), f(x))` for testing purposes

# WH 1.0.5

* Further improved tests robustness

# WH 1.0.4

* Simplified computation of the matrix `tUWU` by using the `crossprod` function, which should reduce memory usage (by half) and computation time (slightly)

* Fixed an issue with the `WH_2d` plot and the what = "edf" argument

* Improved tests robustness

# WH 1.0.3

* Replaced backquotes by normal quotes in the description field of the DESCRIPTION file

# WH 1.0.2

* Updated the package description to link it to the paper whose methods are used in the package

# WH 1.0.1

* Fixed an issue in the author field of the DESCRIPTION file

# WH 1.0.0

* Official candidate for CRAN release

# WH 0.1.0

* Added a `NEWS.md` file to track changes to the package
# WH 1.1.1

* Increased tolerance to remove a lone failing test which only occurs when using MKL BLAS

# WH 1.1.0

* Made significant changes to the extrapolation methods provided by be `predict.WH_1d` and `predict.WH_2d` functions. It turns out that the formula used for the extrapolation ignored the innovation error caused by the prior on the extrapolated region, resulting in smaller credibility intervals than they should have been. This now has been fixed.

# WH 1.0.7

* Removed tests of the form `expect_equal(f(x), f(x))` after confirmation they do not work with MKL BLAS

# WH 1.0.6

* Further improved test robustness

* Added tests of the form `expect_equal(f(x), f(x))` for testing purposes

# WH 1.0.5

* Further improved tests robustness

# WH 1.0.4

* Simplified computation of the matrix `tUWU` by using the `crossprod` function, which should reduce memory usage (by half) and computation time (slightly)

* Fixed an issue with the `WH_2d` plot and the what = "edf" argument

* Improved tests robustness

# WH 1.0.3

* Replaced backquotes by normal quotes in the description field of the DESCRIPTION file

# WH 1.0.2

* Updated the package description to link it to the paper whose methods are used in the package

# WH 1.0.1

* Fixed an issue in the author field of the DESCRIPTION file

# WH 1.0.0

* Official candidate for CRAN release

# WH 0.1.0

* Added a `NEWS.md` file to track changes to the package
3 changes: 1 addition & 2 deletions R/WH-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
#' original smoothing algorithm to maximum likelihood estimation, automatically
#' selects the smoothing parameter(s) and extrapolates beyond the range of data.
#'
#' @docType package
#' @name WH-package
NULL
"_PACKAGE"

#' Agregated Mortality Dataset
#'
Expand Down
2 changes: 1 addition & 1 deletion R/main.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#' @param method Method to be used to find the optimal smoothing parameter.
#' Default to `"fixed_lambda"` if `lambda` is supplied, meaning no
#' optimization is performed. Otherwise, default to the most reliable
#' `"outer"` methodbased on the `optimize` function from package `stats`.
#' `"outer"` method based on the `optimize` function from package `stats`.
#' @param q Order of penalization. Polynoms of degrees `q - 1` are considered
#' completely smooth and are therefore unpenalized. Should be left to the
#' default of `2` for most practical applications.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ are mandatory for those functions:
two-dimension case) whose dimensions should match those of `d`. The
contribution of each individual to the portfolio central exposure
corresponds to the time the individual was actually observed with
corresponding age (and duration in the two-dimension cas). It always
corresponding age (and duration in the two-dimension case). It always
ranges from 0 to 1 and is affected by individuals leaving the
portfolio, no matter the cause, as well as censoring and truncating
phenomena.
Expand Down
Binary file modified build/vignette.rds
Binary file not shown.
3 changes: 2 additions & 1 deletion inst/CITATION
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ bibentry(
bibtype = "Unpublished",
title = "Revisiting Whittaker-Henderson Smoothing",
author = person("Guillaume Biessy"),
note = "Submitted to Insurance: Mathematics and Economics in June 2023"
note = "Working Paper",
year = 2023
)
66 changes: 66 additions & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
Agregated
BLAS
CMD
Carballo
Dae
Diag
Eigen
Fellner
Jin
LTC
Lapply
MKL
ORCID
Polynoms
Schall
TP
TW
Whittaker
agregated
agregating
arXiv
argmax
argmin
bidimensional
bmatrix
boldsymbol
cas
ddots
diag
doi
durations
ec
edf
eigen
exponentiating
frac
ggplot
inputed
invertible
lbrace
ldots
le
leq
ln
mathbb
mathbf
mathcal
mathsf
ne
neq
odot
optim
otimes
overset
pmatrix
posteriori
propto
purrr
rbrace
textbf
underset
unidimensional
vdots
vec
vectorized
widehat
2 changes: 1 addition & 1 deletion inst/doc/WH.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ WH_2d_df <- WH_2d_fit |> output_to_df()

### How to obtain credibility intervals?

From the explicit solution of WH smoothinh, $\mathbb{E}(\hat{\mathbf{y}}) = (W + P_{\lambda})^{-1}W\mathbb{E}(\mathbf{y}) \ne \mathbb{E}(\mathbf{y})$ when $\lambda \ne 0$. This implies that penalization introduces a smoothing bias, which prevents the construction of a confidence interval centered around $\mathbb{E}(\mathbf{y})$. Therefore, in this section, we turn to a Bayesian approach where smoothing can be interpreted more naturally.
From the explicit solution of WH smoothing, $\mathbb{E}(\hat{\mathbf{y}}) = (W + P_{\lambda})^{-1}W\mathbb{E}(\mathbf{y}) \ne \mathbb{E}(\mathbf{y})$ when $\lambda \ne 0$. This implies that penalization introduces a smoothing bias, which prevents the construction of a confidence interval centered around $\mathbb{E}(\mathbf{y})$. Therefore, in this section, we turn to a Bayesian approach where smoothing can be interpreted more naturally.

Let us suppose that $\mathbf{y} | \boldsymbol{\theta}\sim \mathcal{N}(\boldsymbol{\theta}, W^{-})$ and $\boldsymbol{\theta} \sim \mathcal{N}(0, P_{\lambda}^{-})$ where $P_{\lambda}^{-}$ denotes the pseudo-inverse of the matrix $P_{\lambda}$. The Bayes' formula allows us to express the posterior likelihood $f(\boldsymbol{\theta} | \mathbf{y})$ associated with these choices in the following form:

Expand Down

0 comments on commit 195b488

Please sign in to comment.