The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Fertility » R code for TFR estimation -SAE perspective (small area estimation at sub-county level )
R code for TFR estimation -SAE perspective [message #24732] Wed, 29 June 2022 10:18 Go to next message
DIO is currently offline  DIO
Messages: 2
Registered: March 2020
I am trying to calculate TFR in DHS.rates using Kenya DHS data 2014 with purpose of attempting further modelling in small area estimation (SAE). However I am getting the following error:

> setwd("~/scountytfr")
> library(DHS.rates)
> library(haven)
> KEIR2014sbset <- read_dta("C:/Users/DAVID/Documents/scountytfr/KEIR2014sbset.dta ")
> fert(KEIR2014sbset,Indicator = "tfr", JK = "Yes", Class="Sub_Countyn")

The current function calculated TFR based on a reference period of 36 months
The reference period ended at the time of the interview, in 2014.58 OR May - Oct 2014
The average reference period is 2013.08
Error in matrix(0, nrow = max(as.numeric(Dat$DomID)), ncol = 10) :
invalid 'nrow' value (too large or NA)

What to do?
Re: R code for TFR estimation -SAE perspective [message #24753 is a reply to message #24732] Wed, 06 July 2022 09:34 Go to previous message
Janet-DHS is currently offline  Janet-DHS
Messages: 200
Registered: April 2022
Senior Member
Following is a response from DHS Research & Data Analysis Director, Tom Pullum:

The TFR is a synthetic measure for an aggregate and cannot be calculated for small areas. The calculation requires the number of births and the women-years of exposure for each of the 7 age-specific fertility rates. I believe this error message comes up because at least one of your areas has no women-years of exposure (the denominator) for at least one of the age-specific rates. You have two options. One is to increase the size of the areas so that all the age-specific rates will have valid denominators. The other option, which I recommend, is to switch to a simpler measure of fertility, such as just the number of births in the past three years, with the number of women age 15-49 at the time of the survey, as the denominator. This will be very highly correlated with any more complicated measure that you could come up with.
Previous Topic: Informed Choice (Method Information Index)
Next Topic: Wanted Total Fertility Rate in DHS
Goto Forum:

Current Time: Tue Oct 4 02:05:02 Coordinated Universal Time 2022