Author: Mahmoud Elkasabi, Ph.D.
Date: 2024-01-11

# Introduction to the DHS.rates package

#### Mahmoud Elkasabi, Ph.D.

#### 2024-01-11

# Overview

The package was developed to calculate key indicators based on the Demographic and Health Survey data. In addition to calculating the indicators on the national level, the DHS.rates allows for domain level indicators.

In addition to the indicators, the ‘DHS.rates’ package estimates precision indicators such as Standard Error (SE), Design Effect (DEFT), Relative Standard Error (RSE) and Confidence Interval (CI).

The package is developed according to the DHS methodology of calculating the DHS indicators outlined in the “DHS Guide to Statistics” (Croft, Trevor N., Aileen M. J. Marshall, Courtney K. Allen, et al. 2018, https://dhsprogram.com/Data/Guide-to-DHS-Statistics/index.cfm) and the DHS methodology of estimating the sampling errors indicators outlined in the “DHS Sampling and Household Listing Manual” (ICF International 2012, https://dhsprogram.com/pubs/pdf/DHSM4/DHS6_Sampling_Manual_Sept2012_DHSM4.pdf).

# Datasets

First you need to install the package from the CRAN as follows:

    install.packages("DHS.rates")

Call any of the following datasets provided with the package:

1. The “AWIR70” for all women 15-49: an artificial dataset of a DHS survey where all women age 15-49 were eligible for the survey.

2. The “EMIR70” for ever-married women 15-49 an artificial dataset of a DHS survey where only ever-married women age 15-49 were eligible for the survey. In ever-married women surveys, inflation factors called All-women factors have to be considered to produce indicators for all women.

3. The “ADBR70” for all Births: an artificial dataset of a DHS survey that include all birth for interviewed women age 15-49.

    library(DHS.rates)
    data("AWIR70")
    data("EMIR70")
    data("ADBR70")

You can use your own DHS IR individual (women’s) recode files or BR births recode files downloaded from https://dhsprogram.com/data/available-datasets.cfm

in this case you will need to install and use the “haven” library to read the data. In the example below, I’m reading a Stata file:

    library(haven)
    XXIR70 <- read_dta("C:\\Users\\.............................\\XXIR7HFL.DTA")
    XXIR70 <- as.data.frame(XXIR70)

# The fert function

The fert function calculates the following fertility indicators:

1. Total Fertility Rate (TFR)
2. General Fertility Rate (GFR)
3. Age Specific Fertility Rate (ASFR).

The fert function uses the DHS IR individual (women’s) recode files

## Examples

### Total Fertility Rate (TFR):

fert can calculate Total Fertility Rate (TFR) based on all women AWIR70 data

    (TFR <- fert(AWIR70,Indicator="tfr"))

    ##
    ##  The current function calculated TFR based on a reference period of 36 months
    ##  The reference period ended at the time of the interview, in 2015.75 OR Jul - Dec 2015
    ##  The average reference period is 2014.25

    ##        TFR    N   WN
    ## [1,] 4.011 8442 8625

#### Jackknife SE for TFR

in the previous example you can use the JK argument to estimate SE, DEFT, RSE and CI. the SE is based on Jackknife variance estimation

    (TFR <- fert(AWIR70,Indicator="tfr",JK="Yes"))

    ##
    ##  The current function calculated TFR based on a reference period of 36 months
    ##  The reference period ended at the time of the interview, in 2015.75 OR Jul - Dec 2015
    ##  The average reference period is 2014.25

    ##        TFR    SE    N   WN  DEFT   RSE   LCI   UCI iterations
    ## [1,] 4.011 0.142 8442 8625 1.207 0.035 3.732 4.289        120

### General Fertility Rate (GFR)

fert can calculate GFR and estimate SE, DEFT, RSE and CI based on ever-married women EMIR70 data

For ever-married samples, you need to call the EverMW argument and use AWFact to define the variable name of the All-women factor

    (GFR <- fert(EMIR70,Indicator="gfr",EverMW="YES",AWFact="awfactt"))

    ##
    ##  The current function calculated GFR based on a reference period of 36 months
    ##  The reference period ended at the time of the interview, in 2014.67 OR Jun - Oct 2014
    ##  The average reference period is 2013.17

    ##         GFR   SE    N   WN  DEFT   RSE   LCI     UCI
    ## [1,] 91.983 4.19 9472 6710 1.497 0.046 83.77 100.196

### Age Specific Fertility Rates (ASFR)

fert can calculate ASFR and estimate SE, DEFT, RSE and CI based on all women AWIR70 data

    (ASFR <- fert(AWIR70,Indicator="asfr"))

    ##
    ##  The current function calculated ASFR based on a reference period of 36 months
    ##  The reference period ended at the time of the interview, in 2015.75 OR Jul - Dec 2015
    ##  The average reference period is 2014.25

    ##     AGE    ASFR     SE    N   WN  DEFT   RSE     LCI     UCI
    ## 0 15-19 111.102  7.689 1789 1829 1.091 0.069  96.032 126.173
    ## 1 20-24 207.647 10.357 1554 1566 1.110 0.050 187.347 227.947
    ## 2 25-29 188.508 10.712 1490 1552 1.220 0.057 167.513 209.504
    ## 3 30-34 158.503 10.762 1386 1431 1.196 0.068 137.411 179.596
    ## 4 35-39 104.737  9.207 1070 1126 0.953 0.088  86.692 122.782
    ## 5 40-44  24.797  6.285  800  780 1.078 0.253  12.478  37.116
    ## 6 45-49   6.848  4.496  354  340 1.027 0.657   0.000  15.659

### Sub-national indicators

you can calculate sub-national TFR by using the “Class” argument.

    (TFR <- fert(AWIR70,Indicator="tfr",JK="Yes", Class="v025"))

    ##
    ##  The current function calculated TFR based on a reference period of 36 months
    ##  The reference period ended at the time of the interview, in 2015.75 OR Jul - Dec 2015
    ##  The average reference period is 2014.25

    ##   Class   TFR    SE    N   WN  DEFT   RSE   LCI   UCI iterations
    ## 1 rural 4.573 0.104 4462 5122 1.132 0.023 4.369 4.778         68
    ## 2 urban 3.197 0.189 3980 3503 1.458 0.059 2.827 3.568         52

### Sub-national indicators for Ever-married samples

When Class is used, you might need to use the relevent AWFact as below; “awfactu” is used to produce indicators on the urban/rural level, “v025”.

    (GFR <- fert(EMIR70,Indicator="gfr", EverMW="YES",AWFact="awfactu", Class="v025"))

    ##
    ##  The current function calculated GFR based on a reference period of 36 months
    ##  The reference period ended at the time of the interview, in 2014.67 OR Jun - Oct 2014
    ##  The average reference period is 2013.17

    ##   Class    GFR    SE    N   WN  DEFT   RSE    LCI    UCI
    ## 1 rural 97.851 4.127 7230 5661  1.25 0.042 89.762 105.94
    ## 2 urban 63.971 7.362 2203  989 1.509 0.115 49.541 78.401

# The chmort function

The chmort function calculates the following childhood mortality indicators:

1. Neonatal Mortality Rate (NNMR)
2. Post-neonatal Mortality Rate (PNNMR)
3. Infant Mortality Rate (IMR)
4. Child Mortality Rate (CMR)
5. Under-5 Mortality Rate (U5MR).

The chmort function uses the DHS BR birth recode files

## Examples

### childhood mortality rates:

chmort can calculate five-year childhood mortality rates based on birth ADBR70 data

    (chmort(ADBR70))

    ##
    ##  The current function calculated Childhood Mortality Rates based on a reference period of 60 months
    ##  The reference period ended at the time of the interview, in 2015.75 OR Jul - Dec 2015
    ##  The average reference period is 2013.25

    ##           R   N  WN
    ## NNMR  29.72 800 877
    ## PNNMR 24.04 782 862
    ## IMR   53.76 800 885
    ## CMR   18.79 700 774
    ## U5MR  71.53 738 809

#### Jackknife SE for childhood mortality rates

in the previous example you can use the JK argument to estimate SE, RSE and CI. the SE is based on Jackknife variance estimation

    (chmort(ADBR70,JK="Yes"))

    ##
    ##  The current function calculated Childhood Mortality Rates based on a reference period of 60 months
    ##  The reference period ended at the time of the interview, in 2015.75 OR Jul - Dec 2015
    ##  The average reference period is 2013.25

    ##           R    SE   N  WN DEFT  RSE   LCI   UCI iterations
    ## NNMR  29.72  6.91 800 877 1.24 0.23 16.18 43.26         50
    ## PNNMR 24.04  5.75 782 862 1.13 0.24 12.77 35.31         50
    ## IMR   53.76  7.63 800 885 0.97 0.14 38.81 68.71         50
    ## CMR   18.79  4.75 700 774 1.07 0.25  9.48 28.10         50
    ## U5MR  71.53 10.22 738 809 1.29 0.14 51.50 91.56         50

The study period in the previous examples are the default 60 months (5 years) previous to the survey. The ten-year children mortality rates can be calculated using the Period argument as follows

    (chmort(ADBR70,Period = 120))

    ##
    ##  The current function calculated Childhood Mortality Rates based on a reference period of 120 months
    ##  The reference period ended at the time of the interview, in 2015.75 OR Jul - Dec 2015
    ##  The average reference period is 2010.75

    ##           R    N   WN
    ## NNMR  32.18 1476 1621
    ## PNNMR 24.79 1408 1553
    ## IMR   56.97 1452 1601
    ## CMR   24.25 1248 1369
    ## U5MR  79.83 1342 1466

In the previous examples the study period ends at the time of the survey. To change the ending date to September 2013, PeriodEnd can be used as follows

    (chmort(ADBR70,Period = 120, PeriodEnd = "2013-09"))

    ##
    ##  The current function calculated Childhood Mortality Rates based on a reference period of 120 months
    ##  The reference period ended in 2013.75 OR Sep 2013
    ##  The average reference period is 2008.75

    ##           R    N   WN
    ## NNMR  35.09 1400 1541
    ## PNNMR 24.44 1337 1462
    ## IMR   59.53 1384 1521
    ## CMR   24.51 1172 1271
    ## U5MR  82.59 1252 1369

Similar to fert, in chmort the Class can be used to produce domain level indicators.

# The chmort function

The chmortp function calculates childhood childhood mortality probabilities for 8 age segments 0, 1-2, 3-5, 6-11, 12-23, 24-35, 36-47, and 48-59 months.

The chmortp function uses the DHS BR birth recode files

## Example

### childhood mortality probabilities:

chmortp can calculate five-year childhood mortality probabilities based on birth ADBR70 data

    (chmortp(ADBR70))

    ##
    ##  The current function calculated the childhood component death probabilities based on a reference period of 60 months
    ##  The reference period ended at the time of the interview, in 2015.75 OR Jul - Dec 2015
    ##  The average reference period is 2013.25

    ##       PROBABILITY W.DEATHS W.EXPOSURE DEATHS EXPOSURE
    ## 0          0.0297    26.06     876.71   18.5    799.5
    ## 1-2        0.0056     4.77     851.37    3.5    779.0
    ## 3-5        0.0042     3.54     837.97    6.0    768.5
    ## 6-11       0.0151    12.76     844.47   10.0    764.5
    ## 12-23      0.0116     9.62     830.28    7.5    748.5
    ## 24-35      0.0037     2.92     788.19    3.5    720.5
    ## 36-47      0.0019     1.41     749.57    1.0    686.0
    ## 48-59      0.0017     1.20     705.34    1.0    642.5

Similar to chmort, in chmortp the Period and PeriodEnd can be used to change the calculation reference period and the Class can be used to produce domain level indicators.