The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Dataset use (other programs) » NFHs-5, table 11.17 problems (R code results not matching with table)
NFHs-5, table 11.17 problems [message #24823] Sat, 16 July 2022 06:23 Go to next message
Lincoln is currently offline  Lincoln
Messages: 31
Registered: July 2022
Member
HI,

I am new to R environment and trying to replicate the table 11.17 in NFHS-5 country report.
I have two problems
1. The outputs are not matching with the table result.
2. The calculation to generate the variable

I am not sure where I am making the mistakes using PR file: IAPR7AFL.dta
  • Attachment: DHS.html
    (Size: 659.83KB, Downloaded 235 times)
Re: NFHs-5, table 11.17 problems [message #24849 is a reply to message #24823] Wed, 20 July 2022 16:35 Go to previous messageGo to next message
Janet-DHS is currently offline  Janet-DHS
Messages: 901
Registered: April 2022
Senior Member
Following is a response from DHS Research & Data Analysis Director, Tom Pullum:

Because the units of analysis are households, I looked for the relevant variables in the HR file. They are survey-specific variables sh73 and sh74*. You can get the table (except for recoding the states into groups) with the following commands

use hv005 hv024 sh73 sh74* using "....IAHR7AFL.DTA", clear

tab1 sh73 sh74*
label list SH73

gen not_public=0
replace not_public=100 if sh73>=30

local letters a b c d e x
foreach ll of local letters {
gen sh74`ll'_100=sh74`ll'*100
}

tabstat not_public sh74*_100 [fweight=hv005], statistics(mean) by(hv024) format(%6.1f)
Re: NFHs-5, table 11.17 problems [message #24856 is a reply to message #24849] Thu, 21 July 2022 08:54 Go to previous messageGo to next message
Lincoln is currently offline  Lincoln
Messages: 31
Registered: July 2022
Member
Thanks a lot for the kind response.

The responses are in STATA code! Will it be possible to send the corresponding R codes.

Regards
Lincoln
Re: NFHs-5, table 11.17 problems [message #24866 is a reply to message #24849] Thu, 21 July 2022 17:28 Go to previous messageGo to next message
Lincoln is currently offline  Lincoln
Messages: 31
Registered: July 2022
Member
Great help.

Please find attached the updated file. Though the results are almost same but are not exactly the same.

Not sure , what is the problem? I have used both survey and svyr packages.

Regards
Lincoln
  • Attachment: DHS.Rmd
    (Size: 7.69KB, Downloaded 527 times)
Re: NFHs-5, table 11.17 problems [message #24909 is a reply to message #24866] Mon, 01 August 2022 12:26 Go to previous messageGo to next message
Janet-DHS is currently offline  Janet-DHS
Messages: 901
Registered: April 2022
Senior Member
Following is a response from DHS Research & Data Analysis Director, Tom Pullum:

The main difference I see is that Table 11.17 omits a column for "other" reasons, given by sh74x. Perhaps the other differences are related to how that column was handled. Otherwise the differences in percentages are very small. This is a non-standard table and we cannot put more effort into trying to get an exact match.

The only necessary adjustment for the survey design is the use of weights. Adjustments for clustering and stratification do not affect point estimates.
Re: NFHs-5, table 11.17 problems [message #24916 is a reply to message #24909] Tue, 02 August 2022 13:00 Go to previous message
Lincoln is currently offline  Lincoln
Messages: 31
Registered: July 2022
Member
Thanks a lot

Regards
Previous Topic: Respondent's sex NFHS-5
Next Topic: Table 11.20 NFHS-5
Goto Forum:
  


Current Time: Wed Dec 11 15:05:01 Coordinated Universal Time 2024