roportion of existing nets that have been used the previous night [message #12338] |
Wed, 03 May 2017 08:37 |
Nelly_WHO
Messages: 6 Registered: March 2017
|
Member |
|
|
Hi Cameron,
I am trying to match DHS stat compiler data on the Proportion of existing nets that have been used the previous night. Am I using the correct variables? hml10 and hml21?
Thank your very much,
Below is an extract of my code.
Melly
// Whether each bed net owned by the household is an ITN
cap confirm variable hml10_01
if _rc == 0 {
forvalues n = 1/9 {
cap rename hml10_0`n' bednet_is_itn`n'
}
forvalues n = 10/100 {
cap rename hml10_`n' bednet_is_itn`n'
}
}
cap confirm variable hml10_1
if _rc == 0 {
forvalues n = 1/9 {
cap rename hml10_`n' bednet_is_itn`n'
}
forvalues n = 10/100 {
cap rename hml10_`n' bednet_is_itn`n'
}
}
// Determine whether the survey has the ITN variable
cap confirm variable bednet_is_itn1
if _rc == 0 {
summ bednet_is_itn1
if `r(N)' != 0 {
// number of ITNs
local ITNvar bednet_is_itn*
egen nbITN = rowtotal(`ITNvar')
cap confirm variable net_slept_under1
if _rc != 0 {
cap confirm variable hml21_01
if _rc == 0 {
forvalues n = 1/9 {
rename hml21_0`n' net_slept_under`n'
}
forvalues n = 10/100 {
cap rename hml21_`n' net_slept_under`n'
}
}
cap confirm variable hml21_1
if _rc == 0 {
forvalues n = 1/9 {
cap rename hml21_`n' net_slept_under`n'
}
forvalues n = 10/100 {
cap rename hml21_`n' net_slept_under`n'
}
}
forvalues n = 1/100 {
cap replace net_slept_under`n' = . if net_slept_under`n' > 1
}
}
// make a variable for how many ITNs were slept under the night before
forvalues n = 1/100 {
cap gen itn_slept_under`n' = 1 if net_slept_under`n' == 1 & bednet_is_itn`n' == 1
cap replace itn_slept_under`n' = 0 if net_slept_under`n' == 0 | bednet_is_itn`n' == 0
}
// calculate the total number of ITNs that were slept under
egen total_itns_slept_under = rowtotal(itn_slept_under*)
// calculate the fraction of available nets that were used the night before
gen frac_nets_used = total_itns_slept_under / nbITN
// loop through to calculate survey-weighted means & SEs
svyset [pweight=sample_weight], psu(cluster_n)
local m frac_nets_used
// TOTAL
svy: mean `m'
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: roportion of existing nets that have been used the previous night [message #12409 is a reply to message #12338] |
Thu, 11 May 2017 14:41 |
Liz-DHS
Messages: 1516 Registered: February 2013
|
Senior Member |
|
|
A response from malaria expert, Cameron Taylor:
Quote:
Hi Nelly,
For this indicator the denominator/unit of analysis is nets. While you could probably calculate it without having to reshape the dataset, reshaping helps get the unit of analysis to be ITNs.
Here is an example of calculating this indicator using Uganda 2014-15 MIS data.
use "UGHR72FL.DTA", clear
*Weighting the data
gen wt=hv005/1000000
*Reshaping the dataset to a long format
reshape long hml10_ hml21_ ,i(hhid) j(idx)
gen sleepnet=0
replace sleepnet=1 if hml21_==1
gen ownnet=0
replace ownnet=1 if hml10_==1
tab sleepnet if ownnet==1 [iweight=wt]
|
|
|