ccmppR: Simulate cohort component population projection

View source: R/RcppExports.R

ccmppRR Documentation

Simulate cohort component population projection

Description

Simulate cohort component population projection

Usage

ccmppR(basepop, sx, fx, gx, srb, age_span, fx_idx)

ccmpp_leslieR(basepop, sx, fx, gx, srb, age_span, fx_idx)

Arguments

basepop

vector of baseline population size.

sx

a matrix of survivorship probabilities.

fx

a matrix of fertility rates, only amongst fertile ages.

gx

a matrix of proportion of migrants during projection period.

srb

a vector of sex ratio at birth.

age_span

the interval for age and projection time step.

fx_idx

first in

Details

Arguments 'sx', 'fx', and 'gx' are matrices with one column for each projection period, and 'srb' is a vector of length number of projection periods.

The number of age groups in the deaths array are one greater than then number of age groups because deaths are counted separately for those ageing into the open ended age group and survivors in the open ended age group.

Value

'ccmppR()' returns a list with matrices for population, (cohort) deaths, births by age, number of infants, and migrations.

'ccmpp_leslieR()' simulates the same population projection using a Leslie matrix formulation and returns a matrix of population. This is exactly equal to 'population' returned by 'ccmppR()' (see examples).

Examples


library(popReconstruct)
data(burkina_faso_females)

bf_basepop <- as.numeric(burkina.faso.females$baseline.pop.counts)
bf_sx <- burkina.faso.females$survival.proportions
bf_fx <- burkina.faso.females$fertility.rates[4:10, 1]
bf_gx <- burkina.faso.females$migration.proportions
bf_srb <- rep(1.05, ncol(burkina.faso.females$survival.proportions))

pop_leslie <- ccmpp_leslieR(basepop = bf_basepop, sx = bf_sx, fx = bf_fx,
                            gx = bf_gx, srb = bf_srb, 
                            age_span = 5, fx_idx = 4)
pop_proj <- ccmppR(basepop = bf_basepop, sx = bf_sx, fx = bf_fx,
                   gx = bf_gx, srb = bf_srb, 
                   age_span = 5, fx_idx = 4)

all(pop_leslie == pop_proj$population)


mrc-ide/ccmpp.tmb documentation built on May 2, 2022, 12:15 a.m.