The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Malaria » IRS in last 12 months
IRS in last 12 months [message #12116] Wed, 29 March 2017 10:08 Go to next message
Nelly_WHO is currently offline  Nelly_WHO
Messages: 6
Registered: March 2017
Member
Hello,
I am trying to reproduce the same figures as those published in the Statcompiler on the % of households with IRS in last 12 months. For some reasons, my figures do not align with yours.
Would it be possible to share the stata/sas code that have been used to calculate those figures so I can compare?

With the following code, the % for Kenya, 2014 is 2.5%. In Stata compiler it is 0.8%. what am I doing wrong? Is anyone can help?

Thank you very much,
Nelly

// Determine whether the survey has the variables of interest: IRS
cap confirm variable hv253
if _rc == 0 {
summ hv253
if `r(N)' != 0 {

rename hv253 irs_in_last_12mo
replace irs_in_last_12mo = . if irs_in_last_12mo > 1

gen sample_weight = hv005 / 1000000

rename hv001 cluster_num


keep iso3 startyear endyear module survey cluster_num hv023 sample_weight irs_in_last_12mo

// loop through to calculate survey-weighted means & SEs
svyset [pweight=sample_weight], psu(cluster_num) strata(hv023)

local m irs_in_last_12mo
svy: mean `m'
ereturn list
matrix mean_IRS = e(b)
matrix variance_IRS = e(V)
matrix N_IRS = e(N_psu)
local mean = mean_IRS[1,1]
local se = sqrt(variance_IRS[1,1])
local N = N_IRS[1,1]
gen mean_`m' = `mean'
gen semean_`m' = `se'
gen uci_`m' = mean_`m' + 1.96*semean_`m'
gen lci_`m' = mean_`m' - 1.96*semean_`m'
gen N = `N'
drop semean*

keep iso3 startyear endyear module survey mean_* uci* lci* N
keep in 1

save " ${outdir}/${iso3}_${startyear}_${endyear}_${survey}_${module }_IRS.dta ", replace
Re: IRS in last 12 months [message #12140 is a reply to message #12116] Fri, 31 March 2017 17:33 Go to previous message
Liz-DHS
Messages: 1516
Registered: February 2013
Senior Member
Dear User,
A response from malaria expert, Cameron Taylor:
Quote:

Dear User,
Your code looks right except for you also need to account for the variables hv253a-hv253c which are specifying who sprayed the dwelling in your IRS variable. I also noticed in your code you are using the mean command and creating locals from that. You could shorten your code dramatically by using the estpost command which automatically stores results such as LB and UB from the command. Just sharing some helpful Stata tips!


svyset [pw=wt], psu(hv001) strata(hv023) singleunit(centered)
g irs=0
replace irs=1 if hv253==1 & (hv253a==1|hv253b==1|hv253c==1)

estpost svy: tab irs
ereturn list


Quote:


Thanks
Cameron

Previous Topic: Maternal education variable
Next Topic: Households with at least 1 ITN in all countries
Goto Forum:
  


Current Time: Thu Dec 26 01:34:37 Coordinated Universal Time 2024