Skip to content
Snippets Groups Projects
Commit b54cb929 authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

Add utility function mortalityTable.onceAndFuture

parent a5b9c7ab
Branches
No related tags found
No related merge requests found
...@@ -13,6 +13,7 @@ export(mortalityTable.jointLives) ...@@ -13,6 +13,7 @@ export(mortalityTable.jointLives)
export(mortalityTable.mixed) export(mortalityTable.mixed)
export(mortalityTable.observed) export(mortalityTable.observed)
export(mortalityTable.once) export(mortalityTable.once)
export(mortalityTable.onceAndFuture)
export(mortalityTable.period) export(mortalityTable.period)
export(mortalityTable.trendProjection) export(mortalityTable.trendProjection)
export(mortalityTable.zeroes) export(mortalityTable.zeroes)
......
...@@ -49,3 +49,17 @@ mortalityTable.once = function(transitionAge, name = "Deterministic mortality ta ...@@ -49,3 +49,17 @@ mortalityTable.once = function(transitionAge, name = "Deterministic mortality ta
) )
} }
#' Generate a (deterministic) mortality table with all probabilities starting at a given age set to 1
#'
#' @param transitionAge The age where the deterministic transition occurs
#' @param name The name of the table
#' @param ages The ages of the table
#'
#' @export
mortalityTable.onceAndFuture = function(transitionAge, name = "Deterministic mortality table", ages = 0:99) {
mortalityTable.period(
name = name,
ages = ages,
deathProbs = sapply(ages, function(x) { if (x >= transitionAge) 1 else 0})
)
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mortalityTable.period.R
\name{mortalityTable.onceAndFuture}
\alias{mortalityTable.onceAndFuture}
\title{Generate a (deterministic) mortality table with all probabilities starting at a given age set to 1}
\usage{
mortalityTable.onceAndFuture(transitionAge,
name = "Deterministic mortality table", ages = 0:99)
}
\arguments{
\item{transitionAge}{The age where the deterministic transition occurs}
\item{name}{The name of the table}
\item{ages}{The ages of the table}
}
\description{
Generate a (deterministic) mortality table with all probabilities starting at a given age set to 1
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment