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).
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:
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.
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.
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 calculates the following fertility indicators:
The fert function uses the DHS IR individual (women's) recode files
fert can calculate Total Fertility Rate (TFR) based on all women AWIR70 data
(TFR <- fert(AWIR70,Indicator="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"))
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"))
fert can calculate ASFR and estimate SE, DEFT, RSE and CI based on all women AWIR70 data
(ASFR <- fert(AWIR70,Indicator="asfr"))
you can calculate sub-national TFR by using the "Class" argument.
(TFR <- fert(AWIR70,Indicator="tfr",JK="Yes", Class="v025"))
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 chmort function calculates the following childhood mortality indicators:
The chmort function uses the DHS BR birth recode files
chmort can calculate five-year childhood mortality rates based on birth ADBR70 data
(chmort(ADBR70))
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 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))
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"))
Similar to fert, in chmort the Class can be used to produce domain level indicators.
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
chmortp can calculate five-year childhood mortality probabilities based on birth ADBR70 data
(chmortp(ADBR70))
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.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.