#' Create a vector of mortality rates generated by a heterogeneous gompertz model
#'
#' This function produces a vector of mortality rates for a heterogeneous population containing n sub-populations.
#' @param rho0 Numeric vector of length n of initial fractions of sub-populations within total population.
#' @param m0 Numeric vector of length n of initial sub-population mortality rates.
#' @param beta Numeric vector of length n of sub-population rates of mortality dynamics.
#' @param age_vec Numeric vector of ages from 0 to upper age limit of population, \omega.
#' @return Outputs a numeric vector of mortality rates for the heterogeneous population
#' of length 0:\omega.
#' @keywords population mortality rates gompertz demographics
#' @export
#' @examples
#' age_vec <- 0:110; rho0 <- c(0.5, 0.5); m0 <- c(0.05, 0.02); beta <- (0.039, 0.039)
#' mrates <- gompertz(rho0, m0, beta, age_vec)
#' plot(age_vec, mrates)
gompertz <- function(rho0, m0, beta, age_vec){
rho <- rho(rho0, m0, beta, age_vec)
return(m_i(rho, m0, beta, age_vec))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.