Households with enough ITNs for every 2 people and or protected by IRS [message #12310] |
Fri, 28 April 2017 11:23 |
Nelly_WHO
Messages: 6 Registered: March 2017
|
Member |
|
|
Hi,
My results are slightly different from the results in STAT compiler. We might have a different denominator I guess, but could you let me know what is different from your code?
Thank you very much in advance,
Nelly
Households with at least one insecticide-treated mosquito net (ITN) for every two persons and/or indoor residual spraying (IRS) in the past 12 months
// number of ITNs
local ITNvar bednet_is_itn*
egen nbITN = rowtotal(`ITNvar')
// HH with at least 1 ITN
gen EnITNs=0
replace EnITNs = 1 if ((nbITN*2/hv013)>= 1)
// Determine whether the survey has the IRS variable
cap confirm variable hv253
if _rc == 0 {
summ hv253
if `r(N)' != 0 {
gen IRS12=0
replace IRS12=1 if hv253==1 & (hv253a==1|hv253b==1|hv253c==1|hv253d==1|hv253e==1|hv253f==1 |hv253g==1|hv253h==1)
}
summ hv253
if `r(N)' == 0 {
gen IRS12=.
}
}
cap confirm variable hv253
if _rc != 0 {
gen IRS12=.
}
// HH with at least 1ITN and/or IRS
gen EnITNsorIRS12=0
replace EnITNsorIRS12=1 if (EnITNs == 1 | IRS12 == 1)
// loop through to calculate survey-weighted means & SEs
svyset [pweight=sample_weight], psu(cluster_num)
local m EnITNsorIRS12
// TOTAL
svy: mean `m' if hv013>=1
ereturn list
matrix mean_matrix = e(b)
matrix variance_matrix = e(V)
local mean = mean_matrix[1,1]
local se = sqrt(variance_matrix[1,1])
gen prop_`m' = `mean'
gen seprop_`m' = `se'
gen uci_`m' = prop_`m' + 1.96*seprop_`m'
gen lci_`m' = prop_`m' - 1.96*seprop_`m'
drop seprop*
|
|
|
Re: Households with enough ITNs for every 2 people and or protected by IRS [message #12316 is a reply to message #12310] |
Fri, 28 April 2017 14:36 |
Liz-DHS
Messages: 1516 Registered: February 2013
|
Senior Member |
|
|
A response from Malaria Expert, Cameron Taylor:
Quote:
Hi Nelly,
In looking at your code I think the problem is that in the final mean statement you are restricting to In the report table the denominator is all households. I think if you get rid of this restriction you should match. If you are still not matching let me know and I can share my code.
Thanks
Cameron
|
|
|
|
Re: Households with enough ITNs for every 2 people and or protected by IRS [message #12410 is a reply to message #12331] |
Thu, 11 May 2017 14:45 |
Liz-DHS
Messages: 1516 Registered: February 2013
|
Senior Member |
|
|
A response from malaria expert, Cameron Taylor:
Quote:
Hi Nelly,
While I can't pinpoint what the issue is in your code I can express caution in that in Stata if you divide by zero Stata yields a missing value. For example some households have a 0 value for hv013 which Stata changes to missing. Not sure if that is your issue or not.
Regardless here is code using Uganda 2014-15 MIS as an example
use "UGHR72FL.DTA", clear
gen wt=hv005/1000000
**Number of ITNs per household
g numitnhh=0
forvalues x=1/7 {
generate itnhh_0`x'=(hml10_`x'==1)
}
replace numitnhh=itnhh_01 + itnhh_02 + itnhh_03 + itnhh_04 + itnhh_05 + itnhh_06 + itnhh_07
lab var numitnhh "Number of ITNs per Household"
**Number of ITNs per person (de facto household member)
g itnpp=numitnhh/hv013
replace itnpp=0 if itnpp==.
lab var itnpp "Number of ITNs per person"
**Households with at least one ITN per every 2 people (de facto household members)
g uc=(itnpp>=0.5)
lab var uc "Households with at least one ITN per every 2 people (de facto household members)"
**IRS
**Was the household sprayed in the past 12 months by someone other than a household member
g irs=0
foreach x in a b c d e f g h {
replace irs=1 if hv253==1 & hv253`x'==1
}
lab var irs "Household sprayed in the past 12 months by someone other than a household member"
**ITN or IRS
**Does the household own at least one ITN OR was it sprayed by IRS in past 12 months?
g anyprot = 0
replace anyprot=1 if (irs==1|uc==1)
lab var anyprot "household own at least one ITN OR was it sprayed by IRS in past 12 months"
tab anyprot [iweight=wt]
|
|
|