The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Weighting data » Why I am getting different total observations when using iweight for tabulating a variable
Re: Why I am getting different total observations when using iweight for tabulating a variable [message #26536 is a reply to message #26135] Thu, 30 March 2023 07:02 Go to previous messageGo to previous message
sujata is currently offline  sujata
Messages: 18
Registered: May 2019
Member
Dear Tom,
In addition to the above queries, I am facing another issue while applying the normalized weight to compute fractional rank. the fractional rank is r_i=∑ w_j+w_i/2
where j varies from 0 to i-1. for the same, I applied the following commands, but the mean of the fractional rank is not exactly 0.5. It is 0.4857. sv271 is the wealth index factor score for state-level studies. My study is on the Indian state of Punjab. I am following the world bank document "Analyzing health equity using household survey data" for your reference.

sort sv271s
egen raw_rank=rank(sv271s), unique
sort raw_rank

qui sum wgt_shweight_PR
gen wi = wgt_shweight_PR/r(sum)
gen cusum = sum(wi)
gen wj= cusum[_n-1]
replace wj=0 if wj==.
gen rank_CE=wj+0.5*wi

here wgt_shweight_PR is generated so that the mean is equal to 1. below are the commands used to normalize the weights in PR file:

gen unwtd=1000000
total unwtd shweight
matrix B=e(b)
matrix list B
scalar sfactor=B[1,1]/B[1,2]
scalar list sfactor
gen shweight_PR=round(sfactor*shweight)
gen wgt_shweight_PR= shweight_PR/1000000

Please let me know where I am going wrong.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Multilevel model with region random effects
Next Topic: Response rate and weights
Goto Forum:
  


Current Time: Fri Jul 26 14:46:24 Coordinated Universal Time 2024