The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Fertility » Calculating fertility rates
Calculating fertility rates Tue, 26 February 2013 09:55
 DHS user Messages: 100Registered: February 2013 Senior Member
I'm working on estimating several indicators using the DHS including age-specific fertility rates; total fertility rates. I've been using the Guide to DHS Statistics which has been really helpful. However, I've been unable to match the indicators I'm generating with the indicators in the DHS reports. My numbers are very close but not the same.

Do you have any resources on how to calculate these indicators particularly in Stata? Or any advice on how to use the weights for this data?

Re: Calculating fertility rates [message #207 is a reply to message #107] Tue, 26 March 2013 16:22
 Reduced-For(u)m Messages: 291Registered: March 2013 Senior Member

Not sure if these suggestions will help, but thought I'd mention a couple of tricky parts.

First, did you divide all the weights by 1000000? It shouldn't make much of a difference, but I think it could lead to mathematically slightly different answers if Stata is trying to deal with really big weight numbers. Also, how are you actually weighting these? (I don't really know exactly how you should, other than it might involve the all woman factor, but seems like you'd have to re-calculate the denominator and numerator by summing across woman-years times weight instead of just the woman-years).

Second, getting the timing so that women-years are properly balanced between age-groups is tricky. The DHS method seems to truncate age to age-in-round-years, so maybe you are rounding differently than they do.

Third, there is another approach to calculating TFRs (and age-specific rates) that is a "person period" approach. You can find a discussion here http://paa2012.princeton.edu/papers/122446 but I don't think the package is totally ready yet (once it is, that will be handy). This will almost certainly not return the DHS numbers, and the interpretation is probably slightly different, but it's not clear to me that the DHS numbers are in any sense "better" than what you'd get from this method.

In general, it seems to be pretty hard to get exactly the numbers that the DHS gets. If yours are not meaningfully different (economically/epidemilogically/etc) from the published ones, it might just be an alogrythm thing about how Stata computes things and uses weights.

If you post a .do file, I might be able to take a look. I've found the process difficult myself, and maybe I could learn something from how you are trying to do it. Hope something here was helpful.
Re: Calculating fertility rates [message #499 is a reply to message #207] Thu, 30 May 2013 09:51
 schoumaker Messages: 49Registered: May 2013 Location: Belgium Member
Hello - I prepared a Stata module (called tfr2) to compute fertility rates in a variety of ways. It was developed to be used mainly with DHS data, so the default options allow computing fertility rates like in DHS very easily (and the results - if you choose the default options - will be the same as in the DHS reports).

The module and the paper presenting it can be downloaded from the Demographi Research journal's website (http://www.demographic-research.org/volumes/vol28/38/).

Best regards,

Bruno

Bruno Schoumaker
Centre for Demographic Research
Université catholique de Louvain
Re: Calculating fertility rates [message #3859 is a reply to message #499] Wed, 25 February 2015 12:16
 amaustin Messages: 20Registered: February 2015 Member
Is there a SAS Macro similar to the tfr2 STATA program that was developed by Bruno Schoumaker? I am trying to develop state-level TFR estimates for Nigeria in 2008 and 2013.
Thank you!
Re: Calculating fertility rates [message #3876 is a reply to message #3859] Fri, 27 February 2015 03:19
 schoumaker Messages: 49Registered: May 2013 Location: Belgium Member
SAS and SPSS syntaxes for fertility rates used to be available on the DHS website - but I cannot find them anymore.
Beso,
Bruno

Bruno Schoumaker
Centre for Demographic Research
Université catholique de Louvain
Re: Calculating fertility rates [message #3879 is a reply to message #3876] Fri, 27 February 2015 11:28
 amaustin Messages: 20Registered: February 2015 Member
Thanks, Bruno!
I also remembered them being available- but no luck.
All the best,
Anne
Re: Calculating fertility rates [message #3882 is a reply to message #3879] Fri, 27 February 2015 13:52
 Trevor-DHS Messages: 713Registered: January 2013 Senior Member
You can find the old programs linked to the questions about reproducing fertility under Dataset Indicators at the old DHS Program site here: http://legacy.dhsprogram.com/accesssurveys/dataset_faqs.cfm
However, these programs are old and have limitations, so user beware. They should though give you enough information to reproduce the results in the reports.
Re: Calculating fertility rates [message #4434 is a reply to message #107] Tue, 26 May 2015 12:25
 annfitz Messages: 5Registered: April 2015 Member
Hi i downloaded the program tfr2 , and ran againgst the kenya 2008 data file in stata, using stat12 , unfortunately i did not match the results in the report, can anyone advise whether they have been able to match the fertility rates as shown, thanks

Dr Ann fitzmaurice
Re: Calculating fertility rates [message #4436 is a reply to message #4434] Tue, 26 May 2015 14:34
 schoumaker Messages: 49Registered: May 2013 Location: Belgium Member
Hi,

have you used the individual recode data file (KEIR52FL)?

This is the result I get when running tfr2 with that file - and they match perfectly the rates published in the Kenya report (p.47).

Best,

Bruno

. tfr2
weight variable is v005
Preparing table of events and exposure for 3 year(s) preceding the survey
Period covered: 12/2005 to 11/2008
Central date is 2007.4636
Number of cases (women): 8421
Number of person-years (weighted): 23658.801
Number of events (weighted): 3609.3125

ASFRs - TFR

events Coef. Std. Err. z P>z [95% Conf. Interval]

Rate_1519 .1029641 .0043925 23.44 0.000 .0943549 .1115733
Rate_2024 .2378978 .007007 33.95 0.000 .2241644 .2516313
Rate_2529 .2155345 .0071216 30.26 0.000 .2015764 .2294926
Rate_3034 .1751397 .0073817 23.73 0.000 .1606718 .1896076
Rate_3539 .1178257 .0068037 17.32 0.000 .1044907 .1311607
Rate_4044 .0504861 .004728 10.68 0.000 .0412194 .0597528
Rate_4549 .011841 .0031293 3.78 0.000 .0057076 .0179743
TFR 4.558445 .0793782 57.43 0.000 4.402866 4.714023

Bruno Schoumaker
Centre for Demographic Research
Université catholique de Louvain
Re: Calculating fertility rates [message #10805 is a reply to message #4436] Mon, 19 September 2016 04:38
 mianrashid Messages: 13Registered: February 2016 Location: Pau, France Member
Dear Sir,
I want to calculate TFR of Pakistan DHS 2012-2013, as well as by place of residence, Region/Provincial background, level of education and by wealth status. Please let me know the command which if have to use to calculate this in TFR2 module package by bruno?
Thanks you.

MianRashid
Re: Calculating fertility rates [message #10808 is a reply to message #10805] Mon, 19 September 2016 08:51
 Liz-DHS Messages: 1515Registered: February 2013 Senior Member
Dear User,
Here is a link http:// userforum.dhsprogram.com/index.php?t=msg&th=63&goto= 499&#msg_499 from Dr. Schoumaker previously posted on the forum on this subject.
Thank you!
Re: Calculating fertility rates [message #10809 is a reply to message #10805] Mon, 19 September 2016 09:00
 schoumaker Messages: 49Registered: May 2013 Location: Belgium Member
Hello,

tfr2 computes rates for the 3 preceding years by default.

Just typing tfr2 will thus compute the rates for the three years preceding the survey

Actually, it is a shortcut for:

tfr2 [pw=v005], dates(v008) bvar(b3*) wb(v011) len(3) ageg(5) awf(awfactt)

In Pakistan, you should be careful to use the correct all-women factors for sub-populations.

For instance, to compute rates for rural and urban areas, you can use the following command

by v025, sort: tfr2, awf(awfactu)

If you want to compute these rates for a 5- year period, it would become

by v025, sort: tfr2, len(5) awf(awfactu)

Best, Bruno

Bruno Schoumaker
Centre for Demographic Research
Université catholique de Louvain
Re: Calculating fertility rates [message #11060 is a reply to message #10809] Mon, 24 October 2016 04:09
 Kirwana Venantius Bbaale Messages: 6Registered: October 2016 Location: kampala Member
what do I do?
Re: Calculating fertility rates [message #11061 is a reply to message #11060] Mon, 24 October 2016 04:12
 schoumaker Messages: 49Registered: May 2013 Location: Belgium Member
Hello,

ssc install tfr2

Best regards,

Bruno

Bruno Schoumaker
Centre for Demographic Research
Université catholique de Louvain
Re: Calculating fertility rates [message #11062 is a reply to message #11061] Mon, 24 October 2016 07:41
 Kirwana Venantius Bbaale Messages: 6Registered: October 2016 Location: kampala Member
Thanks Bruno, I managed to install it but I am getting a different TFR for Uganda DHS data 2011
Re: Calculating fertility rates [message #11063 is a reply to message #11062] Mon, 24 October 2016 07:42
 schoumaker Messages: 49Registered: May 2013 Location: Belgium Member
Thank you,
Can you send the syntax and the output ?
Did you use the Individual Recode data file ?
Bruno

Bruno Schoumaker
Centre for Demographic Research
Université catholique de Louvain
Re: Calculating fertility rates [message #11066 is a reply to message #11063] Mon, 24 October 2016 09:26
 Kirwana Venantius Bbaale Messages: 6Registered: October 2016 Location: kampala Member
Quote:

. tfr2
weight variable is v005
Preparing table of events and exposure for 3 year(s) preceding the survey
Period covered: 8/2008 to 7/2011
Central date is 2010.1332
Number of cases (women): 28609
Number of person-years (weighted): 85763.883
Number of events (weighted): 42221.082

ASFRs - TFR

------------------------------------------------------------ ------------------
events | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+---------------------------------------------- ------------------
Rate_1519 | .2282156 .0083323 27.39 0.000 .2118846 .2445466
Rate_2024 | .3761918 .0061126 61.54 0.000 .3642114 .3881722
Rate_2529 | .4757862 .0054558 87.21 0.000 .465093 .4864794
Rate_3034 | .4690061 .0053467 87.72 0.000 .4585268 .4794854
Rate_3539 | .5036195 .0052258 96.37 0.000 .493377 .5138619
Rate_4044 | .5500663 .0065024 84.59 0.000 .5373218 .5628108
Rate_4549 | .6933619 .0089963 77.07 0.000 .6757293 .7109944
TFR | 16.48124 .0888354 185.53 0.000 16.30712 16.65535
------------------------------------------------------------ ------------------

I used individual data sets
Re: Calculating fertility rates [message #11067 is a reply to message #11066] Mon, 24 October 2016 09:34
 schoumaker Messages: 49Registered: May 2013 Location: Belgium Member
Hello,
What is the name of your data file ?
Best regards,
Bruno

Bruno Schoumaker
Centre for Demographic Research
Université catholique de Louvain
Re: Calculating fertility rates [message #11069 is a reply to message #11066] Mon, 24 October 2016 10:00
 schoumaker Messages: 49Registered: May 2013 Location: Belgium Member
You should use UGIR60FL.DTA as below.
Bruno

. use "C:\12.DATA\DHS\IR\UGIR60FL.DTA", clear

. tfr2
weight variable is v005
Preparing table of events and exposure for 3 year(s) preceding the survey
Period covered: 8/2008 to 7/2011
Central date is 2010.1378
Number of cases (women): 8634
Number of person-years (weighted): 23918.096
Number of events (weighted): 4916.5352

ASFRs - TFR

events Coef. Std. Err. z P>z [95% Conf. Interval]

Rate_1519 .1344827 .0048509 27.72 0.000 .1249751 .1439904
Rate_2024 .3132275 .008087 38.73 0.000 .2973772 .3290778
Rate_2529 .2914675 .0082319 35.41 0.000 .2753333 .3076017
Rate_3034 .2323487 .0085758 27.09 0.000 .2155404 .249157
Rate_3539 .1716094 .0077221 22.22 0.000 .1564743 .1867444
Rate_4044 .0742423 .0063143 11.76 0.000 .0618665 .0866181
Rate_4549 .0230467 .0043584 5.29 0.000 .0145044 .031589
TFR 6.202124 .0933726 66.42 0.000 6.019117 6.385131

Bruno Schoumaker
Centre for Demographic Research
Université catholique de Louvain
Re: Calculating fertility rates [message #11072 is a reply to message #11069] Mon, 24 October 2016 11:02
 Kirwana Venantius Bbaale Messages: 6Registered: October 2016 Location: kampala Member
Thank you Bruno
Re: Calculating fertility rates [message #11073 is a reply to message #11069] Mon, 24 October 2016 11:04
 Kirwana Venantius Bbaale Messages: 6Registered: October 2016 Location: kampala Member
Thank you Bruno
Re: Calculating fertility rates [message #11078 is a reply to message #11069] Tue, 25 October 2016 06:19
 Kirwana Venantius Bbaale Messages: 6Registered: October 2016 Location: kampala Member
Thanks Bruno.
Are there also variable for abortion in the DHS data sets
Re: Calculating fertility rates [message #11081 is a reply to message #11078] Tue, 25 October 2016 06:54
 schoumaker Messages: 49Registered: May 2013 Location: Belgium Member
I think there are limited data on abortion in the Uganda 2011 DHS, but no pregnancy history.
Bruno

Bruno Schoumaker
Centre for Demographic Research
Université catholique de Louvain
Re: Calculating fertility rates [message #13246 is a reply to message #11081] Mon, 09 October 2017 02:31
 rajaram Messages: 3Registered: March 2013 Location: mumbai Member
Hi i downloaded the program tfr2 , and ran againgst the India 2005-06 (NFHS-3) data file (IABR50FL)in stata, using stat13 , unfortunately i did not match the results in the report, can anyone advise whether they have been able to match the fertility rates as shown, If possible please post syntax and result. thanks
Re: Calculating fertility rates [message #13247 is a reply to message #13246] Mon, 09 October 2017 02:42
 schoumaker Messages: 49Registered: May 2013 Location: Belgium Member
Hello,
You should use the individual recode data file (IAIR52FL.dta), and not the BR file.
Below are the results you get - which are the same as the ones in Table 4.1 of the report.
Best regards,
Bruno

. use IAIR52FL.dta, clear

. tfr2
weight variable is v005
Preparing table of events and exposure for 3 year(s) preceding the survey
Period covered: 3/2003 to 2/2006
Central date is 2004.7274
Number of cases (women): 124148
Number of person-years (weighted): 350470.53
Number of events (weighted): 33513.922

ASFRs - TFR

------------------------------------------------------------ ------------------
events | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+---------------------------------------------- ------------------
Rate_1519 | .0903105 .0011011 82.02 0.000 .0881523 .0924686
Rate_2024 | .2093305 .0017732 118.05 0.000 .2058551 .2128059
Rate_2529 | .1387952 .0015334 90.52 0.000 .1357899 .1418006
Rate_3034 | .0623592 .0010966 56.87 0.000 .0602099 .0645085
Rate_3539 | .0247464 .0007418 33.36 0.000 .0232925 .0262002
Rate_4044 | .007229 .0004504 16.05 0.000 .0063462 .0081118
Rate_4549 | .0029555 .0004062 7.28 0.000 .0021593 .0037517
TFR | 2.678631 .0148564 180.30 0.000 2.649513 2.70775
------------------------------------------------------------ ------------------

Bruno Schoumaker
Centre for Demographic Research
Université catholique de Louvain
Re: Calculating fertility rates [message #13258 is a reply to message #13247] Tue, 10 October 2017 05:17
 rajaram Messages: 3Registered: March 2013 Location: mumbai Member
Thanks a lot sir. I was trying it for one week and was worry for not getting the accurate results. Now i am very happy to get reply from you.
Re: Calculating fertility rates [message #15605 is a reply to message #11081] Tue, 21 August 2018 10:32
 Jayanta Messages: 27Registered: September 2017 Member
Dear Bruno,

I was looking at the report on "Quality and Consistency of DHS Fertility Estimates,1990 to 2012" done by you and want the understand how to work in Stata for reconstructed fertility estimate with pooled birth histories (birth histories corrected for birth displacement). Whether we have to work with women data files or birth history data files? I have seven years DHS survey data to see the trend of TFR.

Can you please share the stata code for the same?

Regards,
Jayanta
Re: Calculating fertility rates [message #17995 is a reply to message #15605] Mon, 12 August 2019 05:10
 adasgupta Messages: 1Registered: August 2019 Member
Dear Bruno

I need to calculate TFR at district level for India by 3 rounds (Round 1,2 and 4 have district identifiers for India). Can you let me know if:

(i) TFR2 command would give reliable estimates at district level
(ii) how do I collate the rates in a single dta/excel file.

A
Re: Calculating fertility rates [message #17996 is a reply to message #17995] Mon, 12 August 2019 10:34
 schoumaker Messages: 49Registered: May 2013 Location: Belgium Member
Hello,

For the most recent DHS, you can use the following syntax to compute the TFR and the standard error of the TFR by district, and to save them to an excel file. In this example, I compute it for 5-year windows to reduce standard errors.

I cannot tell you if these district-level estimates are trustworthy; you should look at the confidence intervals, documentation on sampling, etc.

For the 1999 Indian DHS, you would need to use an all-women factor, and to my knowledge they are not available for at the district level in the data file. You could compute them yourself, but there may be a good reason for not making them available in the data file.

Best regards,

Bruno

****
use "IAIR74FL.DTA", clear

putexcel set "tfr2_district.xls", replace
putexcel A1=("District") B1=("TFR") C1=("S.E.")

levelsof sdistri, local(levels)

local i=1
foreach d of local levels {
tfr2 if sdistri==`d', len(5) norates
local i=`i'+1
putexcel A`i'="`d'" B`i'=_b[TFR] C`i'=_se[TFR]
}

Bruno Schoumaker
Centre for Demographic Research
Université catholique de Louvain
 Previous Topic: NFHS-4 Median Birth interval Next Topic: cannot reproduce TFR using R-package DHS.rates
Goto Forum:

Current Time: Thu Aug 13 20:02:08 Eastern Daylight Time 2020