Skip to content

Commit

Permalink
no more notes coming from documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
timriffe committed Oct 8, 2024
1 parent a29fd8a commit 27cc366
Show file tree
Hide file tree
Showing 16 changed files with 153 additions and 156 deletions.
26 changes: 13 additions & 13 deletions R/lt_abridged.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,19 @@
#' @importFrom dplyr case_when
#' @export
#' @return Lifetable in data.frame with columns
#' \itemize{
#' \item{Age}{integer. Lower bound of abridged age class},
#' \item{AgeInt}{integer. Age class widths.}
#' \item{nMx}{numeric. Age-specific central death rates.}
#' \item{nAx}{numeric. Average time spent in interval by those deceased in interval. }
#' \item{nqx}{numeric. Age-specific conditional death probabilities.}
#' \item{lx}{numeric. Lifetable survivorship}
#' \item{ndx}{numeric. Lifetable deaths distribution.}
#' \item{nLx}{numeric. Lifetable exposure.}
#' \item{Sx}{numeric. Survivor ratios in uniform 5-year age groups.}
#' \item{Tx}{numeric. Lifetable total years left to live above age x.}
#' \item{ex}{numeric. Age-specific remaining life expectancy.}
#' }

#' * Age integer. Lower bound of abridged age class
#' * AgeInt integer. Age class widths.
#' * nMx numeric. Age-specific central death rates.
#' * nAx numeric. Average time spent in interval by those deceased in interval.
#' * nqx numeric. Age-specific conditional death probabilities.
#' * lx numeric. Lifetable survivorship
#' * ndx numeric. Lifetable deaths distribution.
#' * nLx numeric. Lifetable exposure.
#' * Sx numeric. Survivor ratios in uniform 5-year age groups.
#' * Tx numeric. Lifetable total years left to live above age x.
#' * ex numeric. Age-specific remaining life expectancy.
#'
#' @references
#' \insertRef{greville1977short}{DemoTools}
#' \insertRef{un1982model}{DemoTools}
Expand Down
53 changes: 26 additions & 27 deletions R/lt_regroup_age.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,19 @@
#' @param nLx numeric. Vector of lifetable exposure at single ages.
#' @param ex numeric. Vector of Age-specific remaining life expectancy at single ages.
#' @param ... optional args, not currently used.
#' @return Abridged lifetable in data.frame with columns
#' \itemize{
#' \item{Age}{integer. Lower bound of abridged age class},
#' \item{AgeInt}{integer. Age class widths.}
#' \item{nMx}{numeric. Age-specific central death rates.}
#' \item{nAx}{numeric. Average time spent in interval by those deceased in interval. }
#' \item{nqx}{numeric. Age-specific conditional death probabilities.}
#' \item{lx}{numeric. Lifetable survivorship}
#' \item{ndx}{numeric. Lifetable deaths distribution.}
#' \item{nLx}{numeric. Lifetable exposure.}
#' \item{Sx}{numeric. Survivor ratios in uniform 5-year age groups.}
#' \item{Tx}{numeric. Lifetable total years left to live above age x.}
#' \item{ex}{numeric. Age-specific remaining life expectancy.}
#' }
#' @return Abridged lifetable in `data.frame` with columns
#' `Age` integer. Lower bound of abridged age class
#' `AgeInt` integer. Age class widths.
#' `nMx` numeric. Age-specific central death rates.
#' `nAx` numeric. Average time spent in interval by those deceased in interval.
#' `nqx` numeric. Age-specific conditional death probabilities.
#' `lx` numeric. Lifetable survivorship
#' `ndx` numeric. Lifetable deaths distribution.
#' `nLx` numeric. Lifetable exposure.
#' `Sx` numeric. Survivor ratios in uniform 5-year age groups.
#' `Tx` numeric. Lifetable total years left to live above age x.
#' `ex` numeric. Age-specific remaining life expectancy.
#'
#'
#' @export
#'
Expand Down Expand Up @@ -83,19 +82,19 @@ lt_single2abridged <- function(lx,
#' @inheritParams lt_abridged
#' @param ... optional arguments passed to `pclm()`. For example, if you pass an explicit `lambda` parameter via the `control` argument, you can speed up estimation
#' @return Single-year lifetable in data.frame with columns
#' \itemize{
#' \item{Age}{integer. Lower bound of single year age class},
#' \item{AgeInt}{integer. Age class widths.}
#' \item{nMx}{numeric. Age-specific central death rates.}
#' \item{nAx}{numeric. Average time spent in interval by those deceased in interval. }
#' \item{nqx}{numeric. Age-specific conditional death probabilities.}
#' \item{lx}{numeric. Lifetable survivorship}
#' \item{ndx}{numeric. Lifetable deaths distribution.}
#' \item{nLx}{numeric. Lifetable exposure.}
#' \item{Sx}{numeric. Survivor ratios.}
#' \item{Tx}{numeric. Lifetable total years left to live above age x.}
#' \item{ex}{numeric. Age-specific remaining life expectancy.}
#' }

#' * `Age` integer. Lower bound of single year age class
#' * `AgeInt` integer. Age class widths.
#' * `nMx` numeric. Age-specific central death rates.
#' * `nAx` numeric. Average time spent in interval by those deceased in interval.
#' * `nqx` numeric. Age-specific conditional death probabilities.
#' * `lx` numeric. Lifetable survivorship
#' * `ndx` numeric. Lifetable deaths distribution.
#' * `nLx` numeric. Lifetable exposure.
#' * `Sx` numeric. Survivor ratios.
#' * `Tx` numeric. Lifetable total years left to live above age x.
#' * `ex` numeric. Age-specific remaining life expectancy.

#'
#' @export
#' @importFrom ungroup pclm
Expand Down
26 changes: 13 additions & 13 deletions R/lt_single.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
#' @details Similar to \code{lt_abridged()} details, forthcoming
#' @inheritParams lt_abridged
#' @return Lifetable in data.frame with columns
#' \itemize{
#' \item{Age}{integer. Lower bound of abridged age class},
#' \item{AgeInt}{integer. Age class widths.}
#' \item{nMx}{numeric. Age-specific central death rates.}
#' \item{nAx}{numeric. Average time spent in interval by those deceased in interval. }
#' \item{nqx}{numeric. Age-specific conditional death probabilities.}
#' \item{lx}{numeric. Lifetable survivorship}
#' \item{ndx}{numeric. Lifetable deaths distribution.}
#' \item{nLx}{numeric. Lifetable exposure.}
#' \item{Sx}{numeric. Survivor ratios in uniform 5-year age groups.}
#' \item{Tx}{numeric. Lifetable total years left to live above age x.}
#' \item{ex}{numeric. Age-specific remaining life expectancy.}
#' }

#' * `Age` integer. Lower bound of abridged age class
#' * `AgeInt` integer. Age class widths.
#' * `nMx` numeric. Age-specific central death rates.
#' * `nAx` numeric. Average time spent in interval by those deceased in interval.
#' * `nqx` numeric. Age-specific conditional death probabilities.
#' * `lx` numeric. Lifetable survivorship
#' * `ndx` numeric. Lifetable deaths distribution.
#' * `nLx` numeric. Lifetable exposure.
#' * `Sx` numeric. Survivor ratios in uniform 5-year age groups.
#' * `Tx` numeric. Lifetable total years left to live above age x.
#' * `ex` numeric. Age-specific remaining life expectancy.
#'
#' @export
#' @importFrom dplyr case_when
lt_single_mx <- function(nMx,
Expand Down
25 changes: 12 additions & 13 deletions R/lt_single_qx.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,18 @@
#' @details Similar to \code{lt_abridged()} details, forthcoming
#' @inheritParams lt_abridged
#' @return Lifetable in data.frame with columns
#' \itemize{
#' \item{Age}{integer. Lower bound of abridged age class},
#' \item{AgeInt}{integer. Age class widths.}
#' \item{nMx}{numeric. Age-specific central death rates.}
#' \item{nAx}{numeric. Average time spent in interval by those deceased in interval. }
#' \item{nqx}{numeric. Age-specific conditional death probabilities.}
#' \item{lx}{numeric. Lifetable survivorship}
#' \item{ndx}{numeric. Lifetable deaths distribution.}
#' \item{nLx}{numeric. Lifetable exposure.}
#' \item{Sx}{numeric. Survivor ratios in uniform single-year age groups.}
#' \item{Tx}{numeric. Lifetable total years left to live above age x.}
#' \item{ex}{numeric. Age-specific remaining life expectancy.}
#' }
#' * `Age` integer. Lower bound of abridged age class,
#' * `AgeInt` integer. Age class widths.
#' * `nMx` numeric. Age-specific central death rates.
#' * `nAx` numeric. Average time spent in interval by those deceased in interval.
#' * `nqx` numeric. Age-specific conditional death probabilities.
#' * `lx` numeric. Lifetable survivorship
#' * `ndx` numeric. Lifetable deaths distribution.
#' * `nLx` numeric. Lifetable exposure.
#' * `Sx` numeric. Survivor ratios in uniform single-year age groups.
#' * `Tx` numeric. Lifetable total years left to live above age x.
#' * `ex` numeric. Age-specific remaining life expectancy.

#' @importFrom utils head
#' @export
lt_single_qx <- function(nqx,
Expand Down
11 changes: 5 additions & 6 deletions R/mig_rc.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@
#'
#' The first, second, third and fourth pieces of the equation represent pre-working age, working age, retirement and post-retirement age patterns, respectively.
#' Models with less parameters gradually remove terms at the older ages. Parameters in each family are:
#' \itemize{
#' \item pre-working age: {a1, alpha1}
#' \item working age: {a2, alpha2, mu2, lambda2}
#' \item retirement: {a3, alpha3, mu3, lambda3}
#' \item post retirement: {a4, lambda4}
#' }
#' * pre-working age: a1, alpha1
#' * working age: a2, alpha2, mu2, lambda2
#' * retirement: a3, alpha3, mu3, lambda3
#' * post retirement: a4, lambda4
#'
#' For a specific family to be included, values for all parameters in that family must be specified.
#'
#' @references
Expand Down
14 changes: 7 additions & 7 deletions R/nAx.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
#' @param region character. \code{"n"}, \code{"e"}, \code{"s"} or \code{"w"} for North, East, South, or West.
#'
#' @details If \code{IMR} is not given, then \code{M0} is converted to q(0) using the following approximation:
#' \enumerate{
#' \item{Find \eqn{\alpha , \beta}.}{ Look up the appropriate slope and intercept for the given sex and region.}
#' \item{calculate \eqn{a} as: }{\ifelse{html}{\out{a = M<sub>0</sub> * &beta;}}{\eqn{a = M_0 * \beta}}}
#' \item{calculate \eqn{b} as: }{\ifelse{html}{\out{b = 1 + M<sub>0</sub> *(1- &alpha;)}}{\eqn{b = 1 + M_0 * (1 - \alpha)}}}
#' \item{approximate {\ifelse{html}{\out{q<sub>0</sub>}}{\eqn{q_0}}} as:}{ \ifelse{html}{\out{q<sub>0</sub> = (b<sup>2</sup>- &radic; [b -4*a*M<sub>0</sub>]) / (2*a)}}{\eqn{q_0 = \frac{ b - sqrt(b^2 - 4 * a * M_0) }{ 2 * a } }}}
#' \item{use {\ifelse{html}{\out{q<sub>0</sub>}}{\eqn{q_0}}} as}{ IMR, and applied directly to the Coale-Demeny piecewise linear formula.}
#' }

#' 1. Find \eqn{\alpha , \beta}. Look up the appropriate slope and intercept for the given sex and region.
#' 2. calculate \eqn{a} as: \ifelse{html}{\out{a = M<sub>0</sub> * &beta;}}{\eqn{a = M_0 * \beta}}
#' 3. calculate \eqn{b} as: \ifelse{html}{\out{b = 1 + M<sub>0</sub> *(1- &alpha;)}}{\eqn{b = 1 + M_0 * (1 - \alpha)}}
#' 4. approximate {\ifelse{html}{\out{q<sub>0</sub>}}{\eqn{q_0}}} as: \ifelse{html}{\out{q<sub>0</sub> = (b<sup>2</sup>- &radic; [b -4*a*M<sub>0</sub>]) / (2*a)}}{\eqn{q_0 = \frac{ b - sqrt(b^2 - 4 * a * M_0) }{ 2 * a } }}
#' 5. use {\ifelse{html}{\out{q<sub>0</sub>}}{\eqn{q_0}}} as IMR, and applied directly to the Coale-Demeny piecewise linear formula.
#'
#' If \code{IMR} is given, then \code{M0} is disregarded, and transitivity is therefore not guaranteed. In this case, one has the option to use \code{lt_id_qm_a()} to derive \code{a(0)}, however discrepancies between these two parameters could force implausible results in \code{a(0)}, whereas the CD rule always gives something plausible.
#'
#' @references
Expand Down
16 changes: 8 additions & 8 deletions R/utilsAge.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ calcAgeN <- function(Age, N = 5, shiftdown = 0) {

#' repeat age lower bounds once for each single age
#' @description This is a frequent grouping situation. For a given vector of lower age bounds, repeat each value N times, where N is the width of the corresponding age interval. Age intervals are in this case calculated from the original Age vector.
#' @details If {OAG = TRUE} then the last value is not repeated, otherwise the final age interval is assumed to be the same width as the penultimate. Here intervals do not need to be of uniform width.
#' @details If `OAG = TRUE` then the last value is not repeated, otherwise the final age interval is assumed to be the same width as the penultimate. Here intervals do not need to be of uniform width.
#' @param Age integer. Vector of lower age bounds.
#' @param AgeInt integer vector of age group widths.
#' @param OAG logical. Whether or not the final age group open. Default \code{FALSE}. See details
Expand All @@ -105,11 +105,11 @@ age2ageN <- function(Age, AgeInt = NULL, OAG = FALSE) {
}

#' repeat age lower bounds once for each single age
#' @description This is a frequent grouping situation. For a given vector of lower age bounds, as implied by \code{AgeInt}, repeat each value N times, where N is the width of the corresponding age interval. Age intervals are in this case given, and age lower bound values are calculated from \code{AgeInt} vector.
#' @details If {OAG = TRUE} then the last value is given just once, irrespective of the final value of \code{AgeInt}, otherwise the final age interval is repeated \code{AgeInt[length(AgeInt)]} times. Here intervals do not need to be of uniform width.
#' @description This is a frequent grouping situation. For a given vector of lower age bounds, as implied by `AgeInt`, repeat each value N times, where N is the width of the corresponding age interval. Age intervals are in this case given, and age lower bound values are calculated from `AgeInt` vector.
#' @details If `OAG == TRUE` then the last value is given just once, irrespective of the final value of `AgeInt`, otherwise the final age interval is repeated `AgeInt[length(AgeInt)]` times. Here intervals do not need to be of uniform width.
#' @param AgeInt integer or numeric. Vector of age intervals.
#' @param OAG logical. Whether or not the final age group open. Default \code{FALSE}. See details
#' @return integer vector of elements of \code{Age} repeated once for each implied single age.
#' @param OAG logical. Whether or not the final age group open. Default `FALSE`. See details
#' @return integer vector of elements of `Age` repeated once for each implied single age.
#' @export
#' @examples
#' int5 <- rep(5,21)
Expand Down Expand Up @@ -155,7 +155,7 @@ calcAgeAbr <- function(Age) {
#' @param Age integer. Vector of lower bound of each age group.
#' @param vec Any vector, presumably a count, rate, or similar.
#' @param OAG logical. Whether or not the final age group open. Default \code{FALSE}.
#' @param OAvalue numeric or integer. The value to use for the final age interval if \code{OAG = TRUE}. Default \code{NA}.
#' @param OAvalue numeric or integer. The value to use for the final age interval if `OAG = TRUE`. Default `NA`.
#'
#' @details If based solely on the length of a vector, this will give erroneous results if ages
#' are anything other than standard abridged ages groups. If the final age group is open, the
Expand Down Expand Up @@ -235,10 +235,10 @@ int2age <- function(AgeInt, ageMin = 0) {
#' @description Determine age class intervals based on a vector of age class lower bounds.
#' @details If the final age group is open, it is given a value of \code{NA} by default, or else a user-determined value.
#' If the final age group is closed, it is assumed to be equal to the next-lower interval. If the final age interval is
#' known and not equal to the next lowest interval, specify \code{OAG = TRUE} and assign its value to \code{OAvalue}.
#' known and not equal to the next lowest interval, specify `OAG = TRUE` and assign its value to `OAvalue`.
#' @param Age integer or numeric. Vector of lower age group bounds .
#' @param OAG logical. Whether or not the final age group is open. Default \code{TRUE}.
#' @param OAvalue numeric or integer. The value to use for the final age interval if \code{OAG = TRUE}. Default \code{NA}.
#' @param OAvalue numeric or integer. The value to use for the final age interval if `OAG = TRUE`. Default `NA`.
#' @export
#' @return Age interval vector, of same length as \code{Age}.
#' @examples
Expand Down
2 changes: 1 addition & 1 deletion man/age2ageN.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/int2ageN.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions man/lt_abridged.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions man/lt_abridged2single.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 27cc366

Please sign in to comment.