The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Fertility » Error in computing TFR from DHS.rates package
Error in computing TFR from DHS.rates package [message #25961] Tue, 17 January 2023 07:30 Go to next message
sarojaadhikari2@gmail.com is currently offline  sarojaadhikari2@gmail.com
Messages: 2
Registered: May 2019
Member
I am trying to compute TFrs by residence and education in DHS countries. However, I got the following error in many countries. How can I address this error? Please help.

Error in svydesign.default(id = ~v021, strata = ~v022, weights = ~rweight, :
Clusters not nested in strata at top level; you may want nest=TRUE.
Re: Error in computing TFR from DHS.rates package [message #25964 is a reply to message #25961] Tue, 17 January 2023 16:32 Go to previous messageGo to next message
Janet-DHS is currently offline  Janet-DHS
Messages: 286
Registered: April 2022
Senior Member
Thank you for submitting your question. Could you please provide some more detailed information so we can better advise you?

Can you let us know:
• Which survey you are using (Include country name and year)?
• Which data files you are referring to?
• Which software you are using (Stata, SPSS, R, etc.)?

If you are trying to match a Table in a final report, please also indicate which table and which estimate you are trying to match.
Re: Error in computing TFR from DHS.rates package [message #26008 is a reply to message #25964] Thu, 26 January 2023 07:25 Go to previous messageGo to next message
sarojaadhikari2@gmail.com is currently offline  sarojaadhikari2@gmail.com
Messages: 2
Registered: May 2019
Member
I am using India's DHS data from the 2005-06 survey. I am using individual recode files to calculate TFR by using the DHS.rates package to calculate TFR in R.
following is the code I used
fert(data,"tfr",JK="Yes",CL=95,class="education")

I used the same function for other countries and it was working fine.
Re: Error in computing TFR from DHS.rates package [message #26014 is a reply to message #26008] Fri, 27 January 2023 07:28 Go to previous message
Janet-DHS is currently offline  Janet-DHS
Messages: 286
Registered: April 2022
Senior Member
Following is a response from DHS staff member, Tom Pullum:

I suspect the problem is that the case identifiers in all the India surveys must include the region variable, which is hv024 in the PR file and v024 in the IR file. The easiest way to take this into account could be as follows. Open the IR file and construct a new variable for cluster, called v001r, which is all combinations of v024 and v001 (in Stata this would be "egen v001r=group(v024 v001)"). Then replace v001 with v001r and save with a different filename. Run the rates program on this file. Please let us know whether this does or does not work.
Previous Topic: Son preference
Next Topic: Calculation of Sex ratio at birth and chld sex ratio using DHS survey
Goto Forum:
  


Current Time: Mon Feb 6 08:24:37 Coordinated Universal Time 2023