data-arg: Data argument for data models

Description Details Warning

Description

data is a data frame containing observations for a single dataset.

Details

columns

data must always have the following variables (in any order): age, cohort, time, count. It must also have a sex column or a gender variable, but not both. It can optionally have a region variable.

classification variables

age, cohort, time, sex, gender, and region are all classification variables. These variables cannot contain NAs. age, cohort, and time must consist of non-negative whole numbers. The classification variables cannot contain any duplicate rows - for instance, in a data frame with age, cohort, time, and gender, variables, there must not be two rows with the same combination of values for age, cohort, time, and gender.

count variable

count must consist of non-negative whole numbers. It can contain NAs.

Warning

With the partial exception of births (described below), combinations of classification variables not included in data are treated as missing rather than zero. by functions in package account. For instance, if data does not contain a row for cohort 2005, age 10, gender "Female", and time 2020, then, internally, the count variable for this combination of characteristics is set to NA rather than 0. If the observed count for a combination of variables is zero, then this zero should be included in data.

Datasets describing births are treated slightly different. Births outside the reported age range (eg 15-49) and births to the sex/gender not coded as "dominant" (GIVE LINK) are assumed to be zero.


ONSdigital/Bayesian-demographic-accounts documentation built on Jan. 10, 2022, 12:34 a.m.