The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Dataset use in Stata » Level-weights calculation (Approximation of level-weights)
Level-weights calculation Tue, 16 November 2021 23:11
 Ugonna Messages: 26Registered: June 2020 Member
Hello,

I'm trying to calculate and approximate level-weights for multilevel analysis using 2018 Nigeria Demographic and Health Survey, but the total number of households in the country and the average EA size (i.e. average number of households per cluster) are missing from the report.

Please how do I get these information.

Thank you.
Re: Level-weights calculation [message #23732 is a reply to message #23718] Thu, 18 November 2021 10:22
 Bridgette-DHS Messages: 3080Registered: February 2013 Senior Member
Following is a response from DHS Senior Sampling Specialist, Mahmoud Elkasabi:

The calculations for the multilevel weights for Nigeria is a special case due to the lack of data about number of households. In the census frame only EA-population is available. Therefore the calculation based on the population not the households can be done as below.

```**********************************************************************
* Stage A *** Compile parameters/inputs for Level-weights calculations
**********************************************************************
* a_c_h completed clusters by strata
gen a_c_h=.
quietly levelsof v022, local(lstrata)
quietly foreach ls of local lstrata {
tab v021 if v022==`ls', matrow(T)
scalar stemp=rowsof(T)
replace a_c_h=stemp if v022==`ls'
}
* A_h total number of census clusters by strata
gen A_h = 0
*Urban
replace A_h = 2452  if v022 == 3
replace A_h = 2006  if v022 == 1
replace A_h = 5492  if v022 == 5
replace A_h = 11715  if v022 == 7
replace A_h = 2008  if v022 == 9
replace A_h = 5126  if v022 == 11
replace A_h = 3949  if v022 == 13
replace A_h = 2820  if v022 == 15
replace A_h = 2761  if v022 == 17
replace A_h = 7798  if v022 == 19
replace A_h = 1955  if v022 == 21
replace A_h = 1657  if v022 == 23
replace A_h = 3053  if v022 == 25
replace A_h = 2293  if v022 == 27
replace A_h = 9529  if v022 == 29
replace A_h = 16957  if v022 == 31
replace A_h = 6874  if v022 == 33
replace A_h = 2621  if v022 == 35
replace A_h = 2548  if v022 == 37
replace A_h = 3090  if v022 == 39
replace A_h = 2106  if v022 == 41
replace A_h = 18409  if v022 == 43
replace A_h = 11911  if v022 == 45
replace A_h = 9774  if v022 == 47
replace A_h = 10006  if v022 == 49
replace A_h = 908  if v022 == 51
replace A_h = 2628  if v022 == 53
replace A_h = 1410  if v022 == 55
replace A_h = 9008  if v022 == 57
replace A_h = 7964  if v022 == 59
replace A_h = 12480  if v022 == 61
replace A_h = 9438  if v022 == 63
replace A_h = 23922  if v022 == 65
replace A_h = 7085  if v022 == 67
replace A_h = 8588  if v022 == 69
replace A_h = 19810  if v022 == 71
replace A_h = 22405  if v022 == 73
*Rural
replace A_h = 1138  if v022 == 4
replace A_h = 20850  if v022 == 2
replace A_h = 10354  if v022 == 6
replace A_h = 4556  if v022 == 8
replace A_h = 7211  if v022 == 10
replace A_h = 18319  if v022 == 12
replace A_h = 11930  if v022 == 14
replace A_h = 9988  if v022 == 16
replace A_h = 17124  if v022 == 18
replace A_h = 16288  if v022 == 20
replace A_h = 7539  if v022 == 22
replace A_h = 8943  if v022 == 24
replace A_h = 11870  if v022 == 26
replace A_h = 18900  if v022 == 28
replace A_h = 12263  if v022 == 30
replace A_h = 19402  if v022 == 32
replace A_h = 26442  if v022 == 34
replace A_h = 14020  if v022 == 36
replace A_h = 10231  if v022 == 38
replace A_h = 13942  if v022 == 40
replace A_h = 9463  if v022 == 42
replace A_h = 3498  if v022 == 44
replace A_h = 1977  if v022 == 46
replace A_h = 4223  if v022 == 48
replace A_h = 9567  if v022 == 50
replace A_h = 16205  if v022 == 52
replace A_h = 6379  if v022 == 54
replace A_h = 14912  if v022 == 56
replace A_h = 9201  if v022 == 58
replace A_h = 4829  if v022 == 60
replace A_h = 12381  if v022 == 62
replace A_h = 2123  if v022 == 64
replace A_h = 1502  if v022 == 66
replace A_h = 7408  if v022 == 68
replace A_h = 10667  if v022 == 70
replace A_h = 6097  if v022 == 72
replace A_h = 8701  if v022 == 74

* M_h average number of population per cluster by strata
gen M_h = 0
*Urban
replace M_h = 367  if v022 == 3
replace M_h = 231  if v022 == 1
replace M_h = 202  if v022 == 5
replace M_h = 138  if v022 == 7
replace M_h = 205  if v022 == 9
replace M_h = 182  if v022 == 11
replace M_h = 221  if v022 == 13
replace M_h = 278  if v022 == 15
replace M_h = 222  if v022 == 17
replace M_h = 178  if v022 == 19
replace M_h = 276  if v022 == 21
replace M_h = 214  if v022 == 23
replace M_h = 161  if v022 == 25
replace M_h = 197  if v022 == 27
replace M_h = 294  if v022 == 29
replace M_h = 231  if v022 == 31
replace M_h = 159  if v022 == 33
replace M_h = 190  if v022 == 35
replace M_h = 288  if v022 == 37
replace M_h = 186  if v022 == 39
replace M_h = 262  if v022 == 41
replace M_h = 184  if v022 == 43
replace M_h = 153  if v022 == 45
replace M_h = 234  if v022 == 47
replace M_h = 181  if v022 == 49
replace M_h = 132  if v022 == 51
replace M_h = 156  if v022 == 53
replace M_h = 283  if v022 == 55
replace M_h = 213  if v022 == 57
replace M_h = 229  if v022 == 59
replace M_h = 193  if v022 == 61
replace M_h = 189  if v022 == 63
replace M_h = 358  if v022 == 65
replace M_h = 264  if v022 == 67
replace M_h = 187  if v022 == 69
replace M_h = 132  if v022 == 71
replace M_h = 177  if v022 == 73
*Rural
replace M_h = 445  if v022 == 4
replace M_h = 182  if v022 == 2
replace M_h = 213  if v022 == 6
replace M_h = 164  if v022 == 8
replace M_h = 202  if v022 == 10
replace M_h = 165  if v022 == 12
replace M_h = 196  if v022 == 14
replace M_h = 240  if v022 == 16
replace M_h = 236  if v022 == 18
replace M_h = 171  if v022 == 20
replace M_h = 242  if v022 == 22
replace M_h = 217  if v022 == 24
replace M_h = 154  if v022 == 26
replace M_h = 207  if v022 == 28
replace M_h = 270  if v022 == 30
replace M_h = 282  if v022 == 32
replace M_h = 178  if v022 == 34
replace M_h = 197  if v022 == 36
replace M_h = 290  if v022 == 38
replace M_h = 194  if v022 == 40
replace M_h = 242  if v022 == 42
replace M_h = 226  if v022 == 44
replace M_h = 176  if v022 == 46
replace M_h = 234  if v022 == 48
replace M_h = 221  if v022 == 50
replace M_h = 233  if v022 == 52
replace M_h = 203  if v022 == 54
replace M_h = 167  if v022 == 56
replace M_h = 239  if v022 == 58
replace M_h = 292  if v022 == 60
replace M_h = 225  if v022 == 62
replace M_h = 290  if v022 == 64
replace M_h = 358  if v022 == 66
replace M_h = 254  if v022 == 68
replace M_h = 174  if v022 == 70
replace M_h = 133  if v022 == 72
replace M_h = 185  if v022 == 74

* m_c total number of completed households (added from the HR dataset)
* For Nigeria we use instead: number of de-jure population (hv012) from HR file
gen m_c= 186450
* M total number of households in country
* For Nigeria we use instead: number of population in frame
gen M = 140444528
* S_h households selected per stratum
*For Nigeria we use instead: population selected per stratum
gen S_h = 138

*gen DHS weight
gen DHSwt = v005 / 1000000
```
Re: Level-weights calculation [message #23734 is a reply to message #23732] Thu, 18 November 2021 15:51
 Ugonna Messages: 26Registered: June 2020 Member
Hello Bridgette and Mahmoud Elkasabi,

Thank you so much for this. It's such a huge relief
Re: Level-weights calculation [message #25116 is a reply to message #23734] Thu, 01 September 2022 11:13
 jessy Messages: 8Registered: August 2022 Member
hello everyone, I am working on my thesis using the 2016 Uganda demographic and health survey.as am doing the level weight calculations at both steps of getting A_h and M_h, am getting some missing values.it seems the V022 variable is not matching with the EAs recorded in the final report. is there any thing am doing wrong?

Re: Level-weights calculation [message #25132 is a reply to message #25116] Fri, 02 September 2022 07:18
 Bridgette-DHS Messages: 3080Registered: February 2013 Senior Member

Following is a response from DHS Research & Data Analysis Director, Tom Pullum:

v022, which is usually the same as v023, gives the strata. The clusters or EAs are given by v021, which is usually the same as v001.
Re: Level-weights calculation [message #25137 is a reply to message #25132] Fri, 02 September 2022 13:28
 jessy Messages: 8Registered: August 2022 Member
thank you for the timely response.
actually my biggest challenge is that the number of EAs recorded in table A.2 (30) are less by four those listed in v022 (34).so we i go ahead and generate total number of census clusters by strata, I get 86 MISSING VALUES. i actually feel iam doing something wrong.

*** 1.1: Calculating the total number of completed clusters a_h^c in stratum h for all strata.
gen a_c_h=.
quietly levelsof v023, local(lstrata)
quietly foreach ls of local lstrata {
tab v021 if v023==`ls', matrow(T)
scalar stemp=rowsof(T)
replace a_c_h=stemp if v023==`ls'
}

*** 1.2:
* A_h total number of census clusters by strata***found in Table A.2 in the survey final report
gen A_h = 0
replace A_h = 3125 if v023 == 1
replace A_h = 2597 if v023 == 2
replace A_h = 5944 if v023 == 3
replace A_h = 1547 if v023 == 4
replace A_h = 6608 if v023 == 5
replace A_h = 865 if v023 == 6
replace A_h = 5978 if v023 == 7
replace A_h = 1078 if v023 == 8
replace A_h = 2635 if v023 == 9
replace A_h = 795 if v023 == 10
replace A_h = 6975 if v023 == 11
replace A_h = 301 if v023 == 12
replace A_h = 3275 if v023 == 13
replace A_h = 179 if v023 == 14
replace A_h = 2170 if v023 == 15
replace A_h = 482 if v023 == 16
replace A_h = 4947 if v023 == 17
replace A_h = 581 if v023 == 18
replace A_h = 3320 if v023 == 19
replace A_h = 509 if v023 == 20
replace A_h = 5100 if v023 == 21
replace A_h = 609 if v023 == 22
replace A_h = 3016 if v023 == 23
replace A_h = 883 if v023 == 24
replace A_h = 4394 if v023 == 25
replace A_h = 966 if v023 == 26
replace A_h = 5894 if v023 == 27
replace A_h = 440 if v023 == 28
replace A_h = 3249 if v023 == 29

*** 1.3: Add the average number of households per cluster by sampling strata according to the census data M ̅_h.obtained from table A:2 in the final report
* M_h average number of households per cluster by sampling strata
gen M_h = 0
replace M_h = 132 if v023 == 1
replace M_h = 147 if v023 == 2
replace M_h = 111 if v023 == 3
replace M_h = 143 if v023 == 4
replace M_h = 94 if v023 == 5
replace M_h = 139 if v023 == 6
replace M_h = 99 if v023 == 7
replace M_h = 48 if v023 == 8
replace M_h = 115 if v023 == 9
replace M_h = 83 if v023 == 10
replace M_h = 43 if v023 == 11
replace M_h = 111 if v023 == 12
replace M_h = 88 if v023 == 13
replace M_h = 127 if v023 == 14
replace M_h = 65 if v023 == 15
replace M_h = 93 if v023 == 16
replace M_h = 75 if v023 == 17
replace M_h = 108 if v023 == 18
replace M_h = 70 if v023 == 19
replace M_h = 110 if v023 == 20
replace M_h = 81 if v023 == 21
replace M_h = 124 if v023 == 22
replace M_h = 115 if v023 == 23
replace M_h = 115 if v023 == 24
replace M_h = 98 if v023 == 25
replace M_h = 140 if v023 == 26
replace M_h = 74 if v023 == 27
replace M_h = 106 if v023 == 28
replace M_h = 81 if v023 == 29

Re: Level-weights calculation [message #25147 is a reply to message #25137] Tue, 06 September 2022 07:56
 Bridgette-DHS Messages: 3080Registered: February 2013 Senior Member

Following is a response from DHS Research & Data Analysis Director, Tom Pullum:

If you enter "label list V023" you will see that two strata (strata 2 and 3) have the same name, "South Buganda". In Tables A1 and A2 they are combined as "South Central". Another two strata (strata 4 and 5) have the same name, "North Buganda", and they are combined as "North Central". It looks like v023= 30 and 31 have also been aggregated with South Central and v023=32 and 33 have also been aggregated with North Central. It looks like v023=34 has been aggregated with Busoga. (You can confirm this with "tab v023 if v024<=3"

I think the best option for you would be to redefine v023 to match up with the combinations of v024 and v025, for which you have the necessary numbers in A2 and A3, and then proceed. Ideally you would have more numbers in A2 and A3, and wouldn't have to do this.

In general, that is, in most surveys, v023 is the same as the combinations of v024 and v025. This survey appears to be an exception to that, probably because North Central, South Central, and Busoga have large populations and there was a desire to subdivide them.

Re: Level-weights calculation [message #25192 is a reply to message #25147] Mon, 12 September 2022 09:56
 jessy Messages: 8Registered: August 2022 Member
thaks dear,this has been a life saver
 Previous Topic: Skilled assistance at birth- Kenya and Senegal Next Topic: Unique ID Error
Goto Forum:

Current Time: Thu Jun 13 12:21:13 Coordinated Universal Time 2024