Description Usage Arguments Details Value Examples
Test whether the components and population counts counts of a
DemographicAccount
conform to the accounting identity
that population at the end of a period equals population at the beginning
of a period plus entries minus exits, along with the constraint
that population counts and the number of people reaching each exact
age, are always non-negative. Entries include events such as
births and in-migration, and exits include events such as deaths
and out-migration. The accounting identities are applied cell by cell.
1 2 3 4 | isConsistent(object)
## S4 method for signature 'Movements'
isConsistent(object)
|
object |
A |
The return value is an array of logical values. To test whether
every cell in an account is consistent, without identifying the
inconsistent cells, use function all
, as in
all(isConsistent(myaccount))
An array of logical values.
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 | ## A consistent account
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(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"))))
account <- Movements(population = population,
births = births,
exits = list(deaths = deaths))
isConsistent(account)
all(isConsistent(account))
## An inconsistent account
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"))))
account <- Movements(population = population,
births = births,
exits = list(deaths = deaths))
isConsistent(account)
all(isConsistent(account))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.