> 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? ]]>

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.]]>