From 90d8ba7e7c5fbdf0fbdd536f7144abd7a121ecc7 Mon Sep 17 00:00:00 2001 From: Reinhold Kainhofer <reinhold@kainhofer.com> Date: Thu, 13 Oct 2016 15:01:39 +0000 Subject: [PATCH] Move loading to the very end of the calculations --- R/deathProbabilities.R | 6 +++--- R/periodDeathProbabilities.R | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/R/deathProbabilities.R b/R/deathProbabilities.R index 4968754..820adcc 100644 --- a/R/deathProbabilities.R +++ b/R/deathProbabilities.R @@ -68,9 +68,9 @@ setMethod("deathProbabilities","mortalityTable.improvementFactors", #' life table given the birth year (if needed) setMethod("deathProbabilities","mortalityTable.mixed", function (object, ..., YOB = 1975) { - qx1 = deathProbabilities(object@table1, ..., YOB) * (1 + object@loading); - qx2 = deathProbabilities(object@table2, ..., YOB) * (1 + object@loading); - mixedqx = (object@weight1 * qx1 + object@weight2 * qx2)/(object@weight1 + object@weight2); + qx1 = deathProbabilities(object@table1, ..., YOB); + qx2 = deathProbabilities(object@table2, ..., YOB); + mixedqx = (object@weight1 * qx1 + object@weight2 * qx2)/(object@weight1 + object@weight2) * (1 + object@loading); object@modification(mixedqx) }) diff --git a/R/periodDeathProbabilities.R b/R/periodDeathProbabilities.R index cbe2220..3423faa 100644 --- a/R/periodDeathProbabilities.R +++ b/R/periodDeathProbabilities.R @@ -62,9 +62,9 @@ setMethod("periodDeathProbabilities", "mortalityTable.improvementFactors", #' of the life table for a given observation year setMethod("periodDeathProbabilities", "mortalityTable.mixed", function (object, ..., Period = 1975) { - qx1 = periodDeathProbabilities(object@table1, ..., Period = Period) * (1 + object@loading); - qx2 = periodDeathProbabilities(object@table2, ..., Period = Period) * (1 + object@loading); - mixedqx = (object@weight1 * qx1 + object@weight2 * qx2) / (object@weight1 + object@weight2); + qx1 = periodDeathProbabilities(object@table1, ..., Period = Period); + qx2 = periodDeathProbabilities(object@table2, ..., Period = Period); + mixedqx = (object@weight1 * qx1 + object@weight2 * qx2) / (object@weight1 + object@weight2) * (1 + object@loading); object@modification(mixedqx) }) -- GitLab