diff --git a/R/HelperFunctions.R b/R/HelperFunctions.R index c0c80f5e9e983e5414ebdb44e7e3626118163929..e43c2f6c493ea02eb8f3ace80e6d69c52a339f9b 100644 --- a/R/HelperFunctions.R +++ b/R/HelperFunctions.R @@ -1,3 +1,11 @@ +library(abind); + +mergeValues = function(starting, ending, t) { + rbind(starting[1:t,], ending[-1:-t,]) +} +mergeValues3D = function(starting, ending, t) { + abind(starting[1:t,,], ending[-1:-t,,], along=1) +} # Caution: px is not neccessarily 1-qx, because we might also have dread diseases so that px=1-qx-ix! However, the ix is not used for the survival present value calculatePVSurvival = function(px=1-qx, qx=1-px, advance, arrears=c(0), ..., m=1, mCorrection = list(alpha=1, beta=0), v=1) { # assuming advance and arrears have the same dimensions...