make_account: Make an initial demographic account

Description Usage Arguments Details Value Examples

View source: R/make_account.R

Description

Make the initial values for a demographic account consisting of population, deaths, and births

Usage

1
make_account(popn, mort_rates, fert_rates, time_start, time_end)

Arguments

popn

A Counts object.

mort_rates

A Values array giving mortality rates by age and sex.

fert_rates

A Values array giving mean fertility rates by age and sex. Typically generated using function make_stationary_fert_rates.

time_start

The first year for the account.

time_end

The last year for the account.

Details

The account will not typically be consistent - that is, the demographic accounting equations will not typically be satisfied. The account can be made consistent using function makeConsistent.

If Lx and propn_age_fert use 5-year time steps, then time_end - time_start should be a multiple of 5.

If popn, mort_rates, or fert_rates do not have a time dimension, make_account adds one.

Value

A DemographicAccount.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
Lx <- dembase::Counts(Lx_west[ , , 20])
mort_rates <- dembase::Values(mx_west[ , , , 20])
propn_age_fert <- dembase::Values(propn_age_fert_booth)
popn <- make_stationary_popn(popn_size = 100,
                             Lx = Lx,
                             sex_ratio = 105,
                             time_start = 1000,
                             time_end = 1020)
fert_rates <- make_stationary_fert_rates(Lx = Lx,
                               propn_age_fert = propn_age_fert,
                               sex_ratio = 105)
account <- make_account(popn = popn,
                        mort_rates = mort_rates,
                        fert_rates = fert_rates,
                        time_start = 1000,
                        time_end = 1020)
dembase::summary(account)

johnrbryant/agesim documentation built on Dec. 31, 2021, 11:56 a.m.