Skip to contents

Create an object of class "bage_ssvd" from age-specific fertility data from the the Human Fertility Database.

Usage

ssvd_hfd(data, age_min_max = 15, age_max_min = 50, n_comp = 5)

Arguments

data

A data frame containing HFD data.

age_min_max,

age_max_min Every age classification must at least span the range [age_min_max, age_max_min). Defaults are 15 and 50.

n_comp

Number of SVD components to include in result. Default is 5.

Value

An object of class "bage_ssvd"

Lowest and highest ages

The original HFD data contains age groups "12-" (ie 12 and younger) and "55+" (ie 55 and older). We treat these as closed intervals "12" and "55".

If an age classification in the return value covers a narrower range than the data itself, then the youngest age group in the return value includes ASFRs from younger age groups in the data, and the oldest age group in the return value includes ASFRs from older age groups in the data. For instance, if the classification in the return value starts at age 15, but the data starts at age 12, the ASFR for age 15 includes ASFRs from ages 12, 13, and 14.

This shifting of ASFRs is common in analyses of fertility.

Usage

Step 1: Download data

Register or log in at the Human Fertility Database, and go to page ZippedDataFiles. Go to the "By statistic" table, and download the file from the "Age-specific fertility rate" row.

Step 2: Call function 'ssvd_hfd'

Extract the file asfrRR.txt from the downloaded data, and read in the contents,

data <- readr::read_table("asfrRR.txt", skip = 2)

Step 3: Call function 'ssvd_hfd'

HFD <- ssvd_hfd(data)

See also

  • hfd_tidy() Tidy raw data, but do not process into SVD object.

  • ssvd_lfp() Created scaled SVD object from OECD labour force participation rate data.

  • bage::SVD(), bage::SVDS() to use an object of class "bage_ssvd" in a prior.

Examples

HFD_small <- ssvd_hfd(asfr)
#> Error in if (n < min) cli::cli_abort(c("{.arg {nm_n}} is less than {min}.",     i = "{.arg {nm_n}} is {.val {n}}.")): argument is of length zero