Package 'dfertility'

Title: District level estimation of age-specific fertility
Description: This package estimates district-level estimates of age-specific fertility from nationally representative household survey data.
Authors: Oli Stevens [aut, cre]
Maintainer: Oli Stevens <[email protected]>
License: MIT + file LICENSE
Version: 0.1.666
Built: 2024-10-14 04:48:27 UTC
Source: https://github.com/mrc-ide/dfertility

Help Index


Aggregate district level populations

Description

Aggregate district level populations to all levels of area hierarchy

Usage

area_populations(population, areas_wide, project, naomi_level)

Arguments

population

Age/sex/space/time stratified population

areas_wide

Area hierarchy in wide format


Aggregate district level cluster dataframe

Description

Aggregate a dataframe of survey clusters geolocated to an administrative to any higher administrative level

Usage

assign_cluster_area(clusters, areas_wide, area_level)

Arguments

clusters

Dataframe of geolocated survey clusters

areas_wide

Area hierarchy in wide format

area_level

Integer referring to administrative level, where 0 is national, 1 is provincial etc.

Value

Dataframe list of clusters by administrative area, one list item per survey

See Also

get_areas


Calculate fertility rates from DHS, MIS, AIS data

Description

Calculate fertility rates from DHS, MIS, AIS data

Usage

calculate_dhs_fertility(iso3, surveys, clusters, areas_wide)

Calculate fertility rates from MICS data

Description

Calculate fertility rates from MICS data

Usage

calculate_mics_fertility(iso3, mics_wm, mics_births_to_women)

Download MICS surveys

Description

Download MICS surveys

Usage

create_surveys_mics(iso3, mics_indicators)

Arguments

iso3

ISO3 code


Filter MICS datasets

Description

Filter MICS household, women, and birth history datasets to key variables, and rename to ensure consistent column names between surveys

Usage

filter_mics(dat, mics_indicators, survey_id_i)

Fit TMB model

Description

Fit TMB model

Usage

fit_sample_tmb(data, par, random)

Make area dataframes

Description

Create area hierarchy dataframes in the Naomi package format. The function will always return the area hierarchy in long format, with arguments additionally to return full and wide hierarchies

Usage

get_areas(iso3_current, naomi_data_path, full = FALSE, wide = TRUE)

Arguments

iso3_current

A string of one or more ISO-3 codes

naomi_data_path

A path to directory containing input data files

full

Boolean to return the full area heirarchy

wide

Boolean to return the area hierarchy in wide format


Get populations

Description

Returns a dataframe of area boundaries

Usage

get_boundaries(iso3_current, naomi_data_path)

Arguments

iso3_current

A string of one or more ISO-3 codes

naomi_data_path

A path to directory containing input data files


Extract area, population, boundary files from target directory

Description

Extract area, population, boundary files from target directory

Usage

get_input_files(iso3_current, naomi_data_path)

Arguments

iso3_current

A string of one or more ISO-3 codes

naomi_data_path

A path to directory containing input data files

Value

A named list of file paths


Get populations

Description

Returns a dataframe of population by district, five year age group, and sex

Usage

get_populations(iso3_current, naomi_data_path)

Arguments

iso3_current

A string of one or more ISO-3 codes

naomi_data_path

A path to directory containing input data files


Join individual recode survey datasets by area

Description

Join individual recode survey datasets by area

Usage

ir_by_area(ir, area_list, n, total)

Arguments

ir

Individual recode survey dataset

area_list

List of areas


Join household datasets with area hierarchy

Description

Join household datasets with area hierarchy

Usage

join_survey_areas(fertility_mics_data, areas, warn = FALSE)

Neighbor list

Description

Neighbor list

Usage

make_adjacency_matrix(areas, model_level)

Transform survey datasets into inputs for calc_asfr

Description

Transform survey datasets into inputs for calc_asfr

Usage

make_asfr_inputs(mics_survey_areas, mics_survey_data)

Make model frames for batch running

Description

Create model frames and aggregation matrices for TMB model.

Usage

make_model_frames_batch(lvl_map, population, asfr, areas_list, project = 2020)

Arguments

population

Age/sex/space stratified population

asfr

ASFRs by district and time

areas_list

List of area files

project

Model will by default produce estimates up to year of last survey. Integer projection year if desired, else FALSE

lvl

Dataframe of district and province levels


Make model frames

Description

Create model frames and aggregation matrices for TMB model.

Usage

make_model_frames_dev(
  iso3,
  population,
  asfr,
  areas,
  naomi_level,
  project = 2020
)

Arguments

iso3

iso3 code for country

population

Age/sex/space stratified population

asfr

ASFRs by district and time

areas

Area hierarchy

naomi_level

Area level to produce estimates at

project

Model will by default produce estimates up to year of last survey. Integer projection year if desired, else FALSE


Make random walk structure matrices

Description

Make random walk structure matrices

Usage

make_rw_structure_matrix(x, order, adjust_diagonal = TRUE)

Arguments

x

Matrix size

order

Random walk order

adjust_diagonal

Add 1E-6 to the matrix diagonal to make the matrix proper. Default = TRUE


Sample TMB

Description

Sample TMB

Usage

sample_tmb(
  fit,
  nsample = 1000,
  rng_seed = NULL,
  random_only = TRUE,
  verbose = FALSE
)

Transform MICS dataframes

Description

Convert lists by survey to lists by dataset type

Usage

transform_mics(mics_survey_data, mics_indicators)