timriffe / DemoTools

Tools for the evaluation, adjustment, and standardization of demographic data
https://timriffe.github.io/DemoTools
Other
59 stars 31 forks source link

extrap to 130 could find nLx=0 at last ages #250

Closed IvanWilli closed 3 years ago

IvanWilli commented 3 years ago

I noted that when extrapolating to 130 for closing-out sometimes last nLx could be zero for low mortality years. I suggest to relax that condition to be non-negatives when creating Sx function.

timriffe commented 3 years ago

agree

On Thu, Aug 19, 2021 at 4:23 PM Iván Williams @.***> wrote:

@.**** commented on this pull request.

In R/lt_id.R https://github.com/timriffe/DemoTools/pull/250#discussion_r692159325:

@@ -291,7 +291,7 @@ lt_id_Ll_S <- function(nLx, lx = NULL, Age, AgeInt = NULL, N = 5) { radix <- ifelse(nLx[1]>1, 10^nchar(trunc(nLx[1])), 1) }

validate nLx

  • stopifnot(all(nLx>0, nLx[-n] < (radix*N)))
  • stopifnot(all(nLx>=0, nLx[-n] < (radix*N)))

Something like nLx>=0 & nLx[Age<100]>0 ? Checking first same length on nLx and Age (probably already checked in parent function)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/timriffe/DemoTools/pull/250#discussion_r692159325, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG43GYLDLRXELACPYXHCBLT5UHURANCNFSM5COJWMBA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .