Thanks for your response. I understand the procedure, so just to be clear, I have two related questions:
Q1: Given that I am combining the data for both men and women, are the following codes ok now?
**************** STAGE A ********************
* 7: Prepare the adjusted final/individual adjusted weight for men and women: dividing population of women or men by the appropriate number interviewed; de-normalize the final weight */
gen newwt =.
replace newwt =(v005/1000000)*(4764000/10060) if sex==1
replace newwt =(v005/1000000)*(5538000/5135) if sex==2
label variable newwt "Population adjusted sample weight"
************ STAGE B: APPROXIMATE LEVEL-1 AND LEVEL-2 WEIGHTS ************
/*Step 1: De-normalize the final weight, using approximated normalization factor. */
gen d_HH = newwt * (M/m_c)
/* Step 2: Approximate the level-2 weight (get f variation factor; set alpha based equal split method (α=0.5), then generate wt 2) */
gen f = d_HH / ((A_h/a_c_h) * (M_h/S_h))
scalar alpha = 0.5
gen wt2 = (A_h/a_c_h)*(f^alpha)
/* Step 2B - OPTIONAL: Generate a revised level-2 weight by replacing it with its geometric mean [if needed to get resolve the "weights in variable wt2 not constant within groups defined by: v001" error - based on advice by Tom here in [message #21803]:https://userforum.dhsprogram.com/index.php?t=msg& ;amp ;amp ;amp;th=9098&goto=21803&#msg_21803
gen ln_wt2=log(wt2)
egen mean_wt2=mean(ln_wt2), by(v001)
gen rev_wt2=exp(mean_wt2)
drop ln_wt2
/* Step 3: Approximate the level-1 weight */
Q2: If rev_wt2 is used, then should we adjust the formula for wt1 as well: gen rev_wt1 = d_HH/rev_wt? By the same token, should we also change to the rev_wt2 in the loop (i.e, gen wt1_`i' = d_HH/wt2_`i')?
With much appreciation for your assistance.
Cy
[Updated on: Wed, 12 July 2023 22:51]
Report message to a moderator