makeConsistent: Make a demographic account internally consistent.

Description Usage Arguments Details Value See Also

Description

Adjust the population counts and components of a demographic account so that all cells in the account conform to the basic demographic accounting identity: poulation at end of period = population at beginning of period + entries - exits. Births and in-migrations are examples of entries, and deaths and out-migrations are examples of exists.

Usage

1
2
3
4
makeConsistent(object, adjust = TRUE, scale = 0.1, fixed = character())

## S4 method for signature 'Movements'
makeConsistent(object, adjust = TRUE, scale = 0.1, fixed = character())

Arguments

object

An object of class DemographicAccount.

adjust

If TRUE, components such as births and deaths are adjusted to avoid negative populations.

scale

A non-negative number governing the size of the steps if components are adjusted.

fixed

Names of components that should not be adjusted.

Details

makeConsistent obtains consistency by starting with the population at the start of the period, and working forward, adding entries and subtracting exits.

Sometimes the original entries and exits imply negative population counts. If adjust is FALSE, an error is raised. If adjust is TRUE, entries are adjusted upwards, and exits are adjusted downwards, until positive population counts are obtained. The size of the steps in this adjustment process is governed by scale.

Value

A consistent DemographicAccount.

See Also

To test whether an account is consistent, use isConsistent.

population <- Counts(array(c(10, 15, 13, 16), dim = c(2, 2), dimnames = list(age = c("0-29", "30+"), time = c(1970, 2000)))) births <- Counts(array(14, # changed from 13 dim = c(1, 1), dimnames = list(age = "30+", time = "1971-2000"))) deaths <- Counts(array(c(0, 9), dim = c(2, 1), dimnames = list(age = c("0-29", "30+"), time = c("1971-2000")))) inconsistent.account <- Movements(population = population, births = births, exits = list(deaths = deaths)) inconsistent.account isConsistent(inconsistent.account) consistent.account <- makeConsistent(inconsistent.account) consistent.account isConsistent(consistent.account)


StatisticsNZ/dembase documentation built on Dec. 25, 2021, 4:49 p.m.