Hello, I am in the process of calculating level-1 and level-2 weights for a DHS survey data, based on the procedures described in this report (The DHS Program - Multilevel Modeling Using DHS Surveys: A Framework to Approximate Level-Weights (English)).
Here is the formula/syntax for both weights:
The weights depend on the level of alpha(f) (0 0.1 .25 .50 .75 0.90 1) set by the researcher. According to the report referenced above, "... high dispersion in weights is undesirable and inefficient because the results depend much more on the units with high weights than the units with low weights. As described earlier, α=0 allocates all the variation to the level-1 weight and α=1 allocates all of the variation to the level-2 weight.... As a result, the value of alpha that comes closest to replicating the true design of the survey will generally be the one that simultaneously minimizes both the dispersion of the level-1 and level-2 weights." (pg. 15).
To help the researcher, the report uses this loop to generate 7 levels-weights each, based on different levels of alphas.
This loop generated a series of weight variables, which are displayed in the boxplot below (See Figure 2 Attached). The boxplots suggest that the optimal design is best approximated with the middle value, α=0.50 for the dataset used in the report (since it is the most efficient level of alpha for producing level-1 and level-2 weights for DHS data, with the least distortion).
I am trying to generate this type of boxplot to help me select the most efficient alpha for calculating weights for a different dataset/country. A scratch data for 10 cases is produced by dataex below. I also attach the full dataset, in case it is needed.
Q1: How can I generate such a Figure 2 type of boxplot?
Q2: Is there any other way, apart from visual inspection of the boxplot to determine the alpha with the least dispersion?
Thanks in advance for your assistance.
Best, Cy
----------------------- copy starting from the next line -----------------------
------------------ copy up to and including the previous line ------------------
Here is the formula/syntax for both weights:
Code:
gen wt2 = (A_h/a_c_h)*(f^alpha) gen wt1 = d_HH/wt2
To help the researcher, the report uses this loop to generate 7 levels-weights each, based on different levels of alphas.
Code:
* Calculating the level-weights based on different values of alpha local alphas 0 0.1 .25 .50 .75 0.90 1 local i = 1 foreach dom of local alphas { gen wt2_`i' = (A_h/a_c_h)*(f^`dom') gen wt1_`i' = d_HH/wt2_`i' local ++i }
I am trying to generate this type of boxplot to help me select the most efficient alpha for calculating weights for a different dataset/country. A scratch data for 10 cases is produced by dataex below. I also attach the full dataset, in case it is needed.
Q1: How can I generate such a Figure 2 type of boxplot?
Q2: Is there any other way, apart from visual inspection of the boxplot to determine the alpha with the least dispersion?
Thanks in advance for your assistance.
Best, Cy
----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str15 caseid int(v001 v002) byte v003 float(a_c_h A_h f d_HH wt2 wt1_1 wt1_2 wt1_3 wt1_4 wt1_5 wt1_6 wt1_7 wt2_1 wt2_2 wt2_3 wt2_4 wt2_5 wt2_6 wt2_7 wt1) "" 1 3604 1 25 46309 6.042385e-09 .00004016509 .14398909 2.16832e-08 1.438807e-07 2.459355e-06 .00027894537 .03163859 .5407989 3.588517 1852.36 279.15552 16.331553 .14398909 .001269497 .00007426992 .000011192672 .00027894537 "" 1 8660 1 25 46309 6.042385e-09 .00004016509 .14398909 2.16832e-08 1.438807e-07 2.459355e-06 .00027894537 .03163859 .5407989 3.588517 1852.36 279.15552 16.331553 .14398909 .001269497 .00007426992 .000011192672 .00027894537 "" 1 8136 1 25 46309 6.042385e-09 .00004016509 .14398909 2.16832e-08 1.438807e-07 2.459355e-06 .00027894537 .03163859 .5407989 3.588517 1852.36 279.15552 16.331553 .14398909 .001269497 .00007426992 .000011192672 .00027894537 "" 1 4138 3 25 46309 6.042385e-09 .00004016509 .14398909 2.16832e-08 1.438807e-07 2.459355e-06 .00027894537 .03163859 .5407989 3.588517 1852.36 279.15552 16.331553 .14398909 .001269497 .00007426992 .000011192672 .00027894537 "" 1 1109 1 25 46309 6.042385e-09 .00004016509 .14398909 2.16832e-08 1.438807e-07 2.459355e-06 .00027894537 .03163859 .5407989 3.588517 1852.36 279.15552 16.331553 .14398909 .001269497 .00007426992 .000011192672 .00027894537 "" 1 4138 1 25 46309 6.042385e-09 .00004016509 .14398909 2.16832e-08 1.438807e-07 2.459355e-06 .00027894537 .03163859 .5407989 3.588517 1852.36 279.15552 16.331553 .14398909 .001269497 .00007426992 .000011192672 .00027894537 " 11077 2" 1 1077 2 25 46309 1.450656e-08 .00009642838 .22310415 5.205704e-08 3.164631e-07 4.743385e-06 .0004322124 .03938275 .5902981 3.588517 1852.36 304.70657 20.329023 .22310415 .0024484925 .00016335538 .000026871374 .0004322124 " 14775 2" 1 4775 2 25 46309 1.450656e-08 .00009642838 .22310415 5.205704e-08 3.164631e-07 4.743385e-06 .0004322124 .03938275 .5902981 3.588517 1852.36 304.70657 20.329023 .22310415 .0024484925 .00016335538 .000026871374 .0004322124 " 18660 4" 1 8660 4 25 46309 1.450656e-08 .00009642838 .22310415 5.205704e-08 3.164631e-07 4.743385e-06 .0004322124 .03938275 .5902981 3.588517 1852.36 304.70657 20.329023 .22310415 .0024484925 .00016335538 .000026871374 .0004322124 "" 1 1985 1 25 46309 6.042385e-09 .00004016509 .14398909 2.16832e-08 1.438807e-07 2.459355e-06 .00027894537 .03163859 .5407989 3.588517 1852.36 279.15552 16.331553 .14398909 .001269497 .00007426992 .000011192672 .00027894537 " 16317 2" 1 6317 2 25 46309 1.450656e-08 .00009642838 .22310415 5.205704e-08 3.164631e-07 4.743385e-06 .0004322124 .03938275 .5902981 3.588517 1852.36 304.70657 20.329023 .22310415 .0024484925 .00016335538 .000026871374 .0004322124 end
Comment