The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Fertility » DHSRates R Standard Errors
DHSRates R Standard Errors [message #28407] Fri, 29 December 2023 14:09 Go to next message
Anne Huercanos is currently offline  Anne Huercanos
Messages: 4
Registered: November 2023
Member
Hello,
I am working with the R package DHS rates to produce subnational TFR estimates for several countries. The program seems to work for some countries, but not for others. For all regions in all countries, it produces TFR estimates, but it only produces SEs for some regions.
For example, using Benin 2017-18:

library(DHS.rates)
df <- read.dta("BJIR71FL.dta", convert.factors = FALSE)
df.subnat <- fert(df,Indicator="tfr", JK="Yes", Period= 36, Class="v024")

produces TFR estimates for all 12 regions, yet it only produces a SE for the first region. For all other regions, it produces a SE of 0. The same is true for a number of countries.

By contrast, it produces TFR estimates and SEs for all regions for the Rwanda 2019-20 data (and for some other countries). There seems to be no obvious reason or pattern between the countries for which it works and the countries for which it doesn't.

Please help,
Anne
Re: DHSRates R Standard Errors [message #28408 is a reply to message #28407] Fri, 29 December 2023 16:01 Go to previous messageGo to next message
Anne Huercanos is currently offline  Anne Huercanos
Messages: 4
Registered: November 2023
Member
And in lieu of the DHS rates program being fixed in a timely manner, would someone be able to guide me through calculating SE's for the TFR?

I have successfully calculated the ASFRs and SE's at the regional level in R using the following template:
https://github.com/DHSProgram/DHS-Indicators-R/blob/main/Cha p05_FE/FE_TFR.R

I'm unsure, however, how to go from the SE's of the ASFRs to the SE of the TFR. (I have correctly calculated the point estimate for the TFRs at the regional level).

Thanks in advance!

Re: DHSRates R Standard Errors [message #28416 is a reply to message #28408] Tue, 02 January 2024 10:10 Go to previous messageGo to next message
Anne Huercanos is currently offline  Anne Huercanos
Messages: 4
Registered: November 2023
Member
Follow-up:
I have tried calculated SEs for TFRs from ASFRs in the following: 1) multiplying the SEs by 5 and dividing by 1,000 2) Squaring this value 3) summing the squared values. This produces something similar in magnitude, yet distinctly lower than the standard error numbers published in your reports.

I have tried using the fert program (used here: https://github.com/DHSProgram/DHS-Indicators-R/blob/main/Cha p05_FE/FE_TFR.R) to calculate SEs directly.

The following:
Total_Fertility_Rate <- fert(
IRdata,
Indicator = "tfr",
JK = "Yes",
Class ="v024"
)
produces something several orders of magnitude lower than the SEs published in your reports. (I.e. for Malawi 2015-16 this produced an SE ~0.075 for the TFR of the Northern region while the report has a published SE of 0.134.

Please advise,
Anne

Re: DHSRates R Standard Errors [message #28440 is a reply to message #28416] Mon, 08 January 2024 10:29 Go to previous message
Janet-DHS is currently offline  Janet-DHS
Messages: 698
Registered: April 2022
Senior Member
Following is a response from DHS staff member, Tom Pullum:

I am sorry, but DHS staff cannot help with this issue, at least not quickly. This program was written by Mahmoud Elkasabi, who left DHS more than two years ago. The other fertility rates programs that we have posted on GitHub do not include the calculation of standard errors. I expect that they will eventually be updated to include standard errors, but not soon.

Your 3-step approach (which would be followed by taking the square root of the sum) has two problems with it. The first is that it ignores the covariances among the asfrs, and they can be non-negligible. The second issue is that the procedure should be on the scale of the logs of the rates.
Previous Topic: Not matching with Table
Next Topic: Age at first birth
Goto Forum:
  


Current Time: Sat Apr 27 15:27:56 Coordinated Universal Time 2024