The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Weighting data » Weighing SPA data Tanzania
Weighing SPA data Tanzania [message #11825] Tue, 14 February 2017 16:07 Go to next message
Nadia is currently offline  Nadia
Messages: 6
Registered: February 2017
Member
Hello,
I am working on the SPA data, specifically on TSPA.
I would like to assess the access to electricity by the health facilities in Tanzania (all facilities and by type of facilities).
I used stata to exctract the data. However, I cannot retrieve the percentages given in the report.
E.g: for the hospitals the report reports 91% but using stata and extracting the data for access to electricity for hospitals,
Tab factype if q341==1, I find something 32.6% for the different type of hospitals.
I am interested in the weighted variables( for the whole country). I tried different combinations without any success.
Could you please help me on that? I would like to understand how you obtained the percentages of electricity access by factype in the report.
Thanks a lot,
BR,
Nadia
Re: Weighing SPA data Tanzania [message #11828 is a reply to message #11825] Wed, 15 February 2017 10:25 Go to previous messageGo to next message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3016
Registered: February 2013
Senior Member
Following is a response from DHS Senior Data Specialist, Claudia Marchena:

To get the results published in the report, you need to take the footnotes on the published table 3.3 into consideration.

Footnote:
1 Facility is connected to a central power grid and there has not been an interruption in power supply lasting for more than two hours at a time during normal working hours in the seven days before the survey, or facility has a functioning generator with fuel available on the day of the survey, or else facility has back-up solar power.

As explained in the footnote, the column on "Regular electricity" in table 3.3, uses the following logic to get the results published:

Logic:
(Q340=1 & Q341=1) or (poschar("AB",Q343) and Q345=1 and Q346=1) or pos("C",Q343)

Further explanations for logic:
Poschar("AB",Q343) is Q343 = A or Q343 = B
pos("C",Q343) is Q343 = C
The parenthesis are essential to delimit the conditions.

Regarding the weights and how to use them, they are explained in the survey documentation, TZSP71.doc. But basically each level of analysis has its own weights, Facility in variable FACWT, Provider in variable PROVWT, and client in variable CLIENTWT.

Re: Weighing SPA data Tanzania [message #11832 is a reply to message #11828] Wed, 15 February 2017 13:53 Go to previous messageGo to next message
Nadia is currently offline  Nadia
Messages: 6
Registered: February 2017
Member
Hello,
Thanks a lot for your quick reply and help.
I tried ou the logic advise but it is not working (or and the different parenthesis). Is it possible that some parenthesis are missing in your logic?
What the or stand for? Is it one expression or different alternative ones?
Also the variable FACWT is not available for the TZFC71FLSP. Does this mean that the results are already weighted here and there is no need for it (from the table 3.3 of the report the number of facilities corresponding to the different results reported are in fact the weighted facilities).
Thanks a lot in advance.
Kind Regards
Nadia
Re: Weighing SPA data Tanzania [message #11842 is a reply to message #11825] Fri, 17 February 2017 02:28 Go to previous messageGo to next message
Nadia is currently offline  Nadia
Messages: 6
Registered: February 2017
Member
I finally found the facwt variable in the TZFC71FLSP 2014-2015. However, I still do not know if I need to weight the results of the table 3.3 or they already are the weighted values since the number of facilities corresponding to the different results reported are in fact the weighted number of facilities.

Regarding the replication of the results of the above mentioned table 3.3 and the code you provided,

tab factype if (q340==1 & q341==1) | (( q343=="A" | q343=="B") & q345==1 & q346==1) | (q343=="C"),[/b]

we get to far lower percentages than what reported in table 3.3

Thanks again for your help.

BR,
Nadia
Re: Weighing SPA data Tanzania [message #11846 is a reply to message #11828] Fri, 17 February 2017 10:41 Go to previous messageGo to next message
Nadia is currently offline  Nadia
Messages: 6
Registered: February 2017
Member
Bridgette-DHS wrote on Wed, 15 February 2017 10:25
Following is a response from DHS Senior Data Specialist, Claudia Marchena:

To get the results published in the report, you need to take the footnotes on the published table 3.3 into consideration.

Footnote:
1 Facility is connected to a central power grid and there has not been an interruption in power supply lasting for more than two hours at a time during normal working hours in the seven days before the survey, or facility has a functioning generator with fuel available on the day of the survey, or else facility has back-up solar power.

As explained in the footnote, the column on "Regular electricity" in table 3.3, uses the following logic to get the results published:

Logic:
(Q340=1 & Q341=1) or (poschar("AB",Q343) and Q345=1 and Q346=1) or pos("C",Q343)

Further explanations for logic:
Poschar("AB",Q343) is Q343 = A or Q343 = B
pos("C",Q343) is Q343 = C
The parenthesis are essential to delimit the conditions.

Regarding the weights and how to use them, they are explained in the survey documentation, TZSP71.doc. But basically each level of analysis has its own weights, Facility in variable FACWT, Provider in variable PROVWT, and client in variable CLIENTWT.



I finally found the facwt variable in the TZFC71FLSP 2014-2015. However, I still do not know if I need to weight the results of the table 3.3 or they already are the weighted values since the number of facilities corresponding to the different results reported are in fact the weighted number of facilities.

Regarding the replication of the results of the above mentioned table 3.3 and the code you provided,

tab factype if (q340==1 & q341==1) | (( q343=="A" | q343=="B") & q345==1 & q346==1) | (q343=="C"),[/b]

we get to far lower percentages than what reported in table 3.3

Thanks again for your help.

BR,
Nadia
Re: Weighing SPA data Tanzania [message #11851 is a reply to message #11846] Mon, 20 February 2017 13:20 Go to previous messageGo to next message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3016
Registered: February 2013
Senior Member
Following is another response from DHS Senior Data Specialist, Claudia Marchena:

Weighted and unweighted number of facilities (total facilities) are expected to be the same, because normalization process is done in order to do weights. You need to weight the data using the variable I sent in the previous response, and please reference the explanations on how to use weights that are in the documentation (also mentioned).

If you still have problems, please share the logic you are using, to help us find the mistake.

Re: Weighting SPA data Tanzania [message #11852 is a reply to message #11851] Mon, 20 February 2017 13:47 Go to previous messageGo to next message
Nadia is currently offline  Nadia
Messages: 6
Registered: February 2017
Member
Bridgette-DHS wrote on Mon, 20 February 2017 13:20
Following is another response from DHS Senior Data Specialist, Claudia Marchena:

Weighted and unweighted number of facilities (total facilities) are expected to be the same, because normalization process is done in order to do weights. You need to weight the data using the variable I sent in the previous response, and please reference the explanations on how to use weights that are in the documentation (also mentioned).

If you still have problems, please share the logic you are using, to help us find the mistake.



Thank you for your email. We cannot replicate the results of the table 3.3 based on the previously shared logic:

tab factype if (q340==1 & q341==1) | ((q343=="A" | q343=="B") & q345==1 & q346==1) | (q343=="C")

generate wgt = facwt/1000000

tab factype [iweight=wgt]


We found for the first two type of facilites (hospitals and health centers) lower percentages than those in the table (and higher % for the others).

Thanks for your help.

Nadia.

[Updated on: Tue, 21 February 2017 02:46]

Report message to a moderator

Re: Weighting SPA data Tanzania [message #11873 is a reply to message #11852] Wed, 22 February 2017 13:47 Go to previous messageGo to next message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3016
Registered: February 2013
Senior Member
Following is the logic in Stata that replicates the CSPro logic for that column. This was provided by Senior DHS Stata Specialist, Wenjuan Wang.

gen wt=facwt/1000000

gen q343a=regexm(q343, "A") 
gen q343b=regexm(q343, "B") 
gen q343c=regexm(q343, "C") 

gen elec=0
replace elec=1 if q340==1 & q341==1
replace elec=1 if (q343a==1 | q343b==1) & q345==1 & q346==1
replace elec=1 if q343c==1
ta elec [iw=wt]
Re: Weighing SPA data Tanzania [message #11897 is a reply to message #11825] Mon, 27 February 2017 11:06 Go to previous message
Nadia is currently offline  Nadia
Messages: 6
Registered: February 2017
Member
It works.
Thanks a lot for your help!
BR,
Nadia
Previous Topic: Using region as a predictor in a regression analysis different from sample strata
Next Topic: Weights for regression analysis
Goto Forum:
  


Current Time: Thu Mar 28 07:47:38 Coordinated Universal Time 2024