From 021dcf85fc7778815846c437851053f929ae9733 Mon Sep 17 00:00:00 2001 From: timriffe Date: Fri, 29 Dec 2023 17:46:58 +0100 Subject: [PATCH] . --- NEWS.md | 7 +++++-- R/extra_mortality.R | 17 +++-------------- man/lt_rule_m_extrapolate.Rd | 16 ++-------------- 3 files changed, 10 insertions(+), 30 deletions(-) diff --git a/NEWS.md b/NEWS.md index 36e00656..e1b87183 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,14 +1,17 @@ # Changes in this update -2018-08-15 + +## 2018-08-15 - NEWS.md file added. When a first release comes out, major functionality and features will be listed here at that time. -2019-11-28 +## 2019-11-28 - new function mig_calculate_rc() added - several function names harmonized, see ?DemoTools-renamed - graduate_sprague() and other graduation functions no longer support matrix inputs +## 2023-12-29 + - minor fixes to pass checks \ No newline at end of file diff --git a/R/extra_mortality.R b/R/extra_mortality.R index 6b498e21..9f374178 100644 --- a/R/extra_mortality.R +++ b/R/extra_mortality.R @@ -54,7 +54,8 @@ #' f2 <- lt_rule_m_extrapolate(mx, x, x_fit, x_extr, law = "kannisto_makeham") #' f3 <- lt_rule_m_extrapolate(mx, x, x_fit, x_extr, law = "gompertz") #' f4 <- lt_rule_m_extrapolate(mx, x, x_fit, x_extr, law = "ggompertz") -#' f5 <- lt_rule_m_extrapolate(mx, x, x_fit, x_extr, law = "makeham") +#' # makeham falls back to gompertz for this data +#' suppressWarnings(f5 <- lt_rule_m_extrapolate(mx, x, x_fit, x_extr, law = "makeham")) #' f6 <- lt_rule_m_extrapolate(mx, x, x_fit, x_extr, law = "beard") #' f7 <- lt_rule_m_extrapolate(mx, x, x_fit, x_extr, law = "beard_makeham") #' f8 <- lt_rule_m_extrapolate(mx, x, x_fit, x_extr, law = "quadratic") @@ -126,19 +127,7 @@ #' lty = c(NA, NA, 1:8), pch = c(16, 16, rep(NA, 8)), #' col = c(1, 4, 2:9), lwd = 2, pt.cex = 2) #'} -#' # ---------------------------------------------- -#' # Example 3 - Extrapolate mortality for multiple years at once -#' -#' # Create some data -#' mx_matrix <- matrix(rep(mx1, 3), ncol = 3) %*% diag(c(1, 1.05, 1.1)) -#' dimnames(mx_matrix) <- list(age = x1, year = c("year1", "year2", "year3")) -#' -#' # TR: temporary warning suppression until case handling is fixed -#' # in MortalityLaws package -#' F1 <- suppressWarnings(lt_rule_m_extrapolate(mx_matrix, x = x1, x_fit, x_extr, law = "kannisto")) -#' F1 -#' ls(F1) -#' coef(F1) + #' @author Marius D. Pascariu #' @export lt_rule_m_extrapolate <- function(mx, diff --git a/man/lt_rule_m_extrapolate.Rd b/man/lt_rule_m_extrapolate.Rd index 8e71dc2d..bcd4668f 100644 --- a/man/lt_rule_m_extrapolate.Rd +++ b/man/lt_rule_m_extrapolate.Rd @@ -73,7 +73,8 @@ f1 <- lt_rule_m_extrapolate(mx, x, x_fit, x_extr, law = "kannisto") f2 <- lt_rule_m_extrapolate(mx, x, x_fit, x_extr, law = "kannisto_makeham") f3 <- lt_rule_m_extrapolate(mx, x, x_fit, x_extr, law = "gompertz") f4 <- lt_rule_m_extrapolate(mx, x, x_fit, x_extr, law = "ggompertz") -f5 <- lt_rule_m_extrapolate(mx, x, x_fit, x_extr, law = "makeham") + # makeham falls back to gompertz for this data +suppressWarnings(f5 <- lt_rule_m_extrapolate(mx, x, x_fit, x_extr, law = "makeham")) f6 <- lt_rule_m_extrapolate(mx, x, x_fit, x_extr, law = "beard") f7 <- lt_rule_m_extrapolate(mx, x, x_fit, x_extr, law = "beard_makeham") f8 <- lt_rule_m_extrapolate(mx, x, x_fit, x_extr, law = "quadratic") @@ -145,19 +146,6 @@ legend("topleft", bty = "n", lty = c(NA, NA, 1:8), pch = c(16, 16, rep(NA, 8)), col = c(1, 4, 2:9), lwd = 2, pt.cex = 2) } -# ---------------------------------------------- -# Example 3 - Extrapolate mortality for multiple years at once - -# Create some data -mx_matrix <- matrix(rep(mx1, 3), ncol = 3) \%*\% diag(c(1, 1.05, 1.1)) -dimnames(mx_matrix) <- list(age = x1, year = c("year1", "year2", "year3")) - -# TR: temporary warning suppression until case handling is fixed -# in MortalityLaws package -F1 <- suppressWarnings(lt_rule_m_extrapolate(mx_matrix, x = x1, x_fit, x_extr, law = "kannisto")) -F1 -ls(F1) -coef(F1) } \seealso{ \code{\link[MortalityLaws]{MortalityLaw}}