ccp_open0: Cohort Component Population Projection Model based on a...

Description Usage Arguments Value Examples

Description

A cohort component projection model based on a closed population,

N(t+5) = L[t,t+5] ≤ft( N(t) + \frac{1}{2} I[t,t+5] \right) + \frac{1}{2} I[t,t+5]

where the Leslie matrix, eqnL, is created given user defined age specific fertility and survivorship rates.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
ccp_open0(n = NULL, x = NULL, p = NULL, Nx_f = NULL, Nx_m = NULL,
  sx_f = NULL, sx_m = NULL, fx = NULL, sn_f = NULL, sn_m = NULL,
  sex_ratio = 1/(1 + 1.05), ex_f = NULL, ex_m = NULL, Ix_f = NULL,
  Ix_m = NULL, tidy_output = TRUE, age_lab = x, gender_lab = c("Female",
  "Male"), ...)

ccp_open(n = NULL, x = NULL, p = NULL, Nx_f = NULL, Nx_m = NULL,
  sx_f = NULL, sx_m = NULL, fx = NULL, sn_f = NULL, sn_m = NULL,
  sex_ratio = 1/(1 + 1.05), ex_f = NULL, ex_m = NULL, Ix_f = NULL,
  Ix_m = NULL, tidy_output = TRUE, age_lab = x, gender_lab = c("Female",
  "Male"), ...)

Arguments

n

Numeric value for the number of projection steps.

x

Vector containing a character string of age group labels.

p

Numeric value for step size of the population projection.

Nx_f, Nx_m

Vectors containing numeric values of the initial female and male population size in each age group (x).

sx_f, sx_m, fx, ex_f, ex_m, Ix_f, Ix_m

Vector containing numeric values of the age specific female and male survival, fertility and female and male emigration rates and immigration counts.

If ccp_open0 is used a single vector is required.

If ccp_open is used a matrix of period specific rates (or counts for immigration) is required, where rows represent age groups (females in top rows, males in bottom rows) and columns future periods. If a single vector is passed to ccp_open a matrix based on constant assumptions in all future rates and migration counts will be constructed.

sn_f, sn_m, sex_ratio

Numeric value of the female and male survivorship of new-born babies from birth to the end of the interval and the sex ratio at birth of new-born babies.

If ccp_open0 is used a single value is required.

If ccp_open is used a vector of period specific values is required. If a single value is passed to ccp_open a vector based on constant assumptions in all future rates will be constructed.

tidy_output

Logical value to indicate if projection output should be in a tidy data format (TRUE, the default) or as a matrix where rows represent age and gender groups and columns the projection year.

age_lab, gender_lab

Vector containing a character string of age and gender group labels. Only used if projection output is in a tidy data format. See tidy_pp for more details.

...

Additional arguments passed to tidy_pp to build a tidy data frame (if chosen from tidy_output).

Value

Projected populations by age and gender for n future steps, given the age specific fertility, survivorship and emigration rates and immigration counts. Depending on the tidy_output value the projections will be returned as either a matrix or a tibble. Both versions contain the initial population sizes given in Nx.

ccp_open0 produces population projections based strictly on constant future rates.

ccp_open produces population projections based non-constant future rates.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
library(dplyr)
df0 <- sweden1993 %>%
   # immigration from estimated count and net age pattern
   mutate(Ix_f = 138000 * Mx_f/sum(Mx_f),
          Ix_f = round(Ix_f),
          Ix_m = Ix_f,
          #emigration as remainder
          Ex_f = Ix_f - Mx_f ,
          #emigration rate for projection model
          ex_f = Ex_f/Nx_f,
          ex_m = ex_f)

# matrix output
ccp_open0(n = 5, x = df0$x, p = 5,Nx_f = df0$Nx_f, Nx_m = df0$Nx_m,
          sx_f = df0$sx_f, sx_m = df0$sx_m,
          fx = df0$fx, sn_f = df0$Lx_f[1]/(5*100000), sn_m = df0$Lx_m[1]/(5*100000),
          ex_f = df0$ex_f, ex_m = df0$ex_m, Ix_f = df0$Ix_f, Ix_m = df0$Ix_m,
          tidy_output = FALSE)

# tidy data frame output
ccp_open0(n = 5, x = df0$x, p = 5,Nx_f = df0$Nx_f, Nx_m = df0$Nx_m,
          sx_f = df0$sx_f, sx_m = df0$sx_m,
          fx = df0$fx, sn_f = df0$Lx_f[1]/(5*100000), sn_m = df0$Lx_m[1]/(5*100000),
          ex_f = df0$ex_f, ex_m = df0$ex_m, Ix_f = df0$Ix_f, Ix_m = df0$Ix_m,
          year0 = 1993, age_lab = df0$age)

# setting up non-constant future male immigrant counts
II <- matrix(df0$Ix_m, nrow = length(df0$Ix_m), ncol = 5)
II <- sweep(II, 2, seq(from = 1, to = 1.5, length = 5), "*")
# male immigration increase
colSums(II)
# run projection with increasing net migration, fx and sx remains constant
ccp_open(n = 5, x = df0$x, p = 5, Nx_f = df0$Nx_f, Nx_m = df0$Nx_m,
         sx_f = df0$sx_f, sx_m = df0$sx_m,
         fx = df0$fx, sn_f = df0$Lx_f[1]/(5*100000), sn_m = df0$Lx_m[1]/(5*100000),
         ex_f = df0$ex_f, ex_m = df0$ex_m, Ix_f = df0$Ix_f, Ix_m = II,
         tidy_output = FALSE)

gjabel/demoproj documentation built on May 17, 2019, 6:01 a.m.