The DHS Program User Forum
Discussions regarding The DHS Program data and results

Home » Data » Dataset use in Stata » Multi-level mixed effect Poisson regression in Stata
Re: Multi-level mixed effect Poisson regression in Stata [message #31929 is a reply to message #23236] Mon, 29 June 2026 08:49 Go to previous message
Khawar is currently offline  Khawar
Messages: 22
Registered: April 2023
Member
I am working on multilevel Poisson. I also face a problem with the svy command when I run mepoisson. As I am working on the DHS in Pakistan. Average household size per cluster is also not available. I have calculated this from this formula: Empirically derived from the 2017 Census: 32,205,111 total households / 168,943 total EBs. The first question is, 'Is it correct?' This table is my coding scheme for 2-level calculations according to DHS report 27.

************************************************************ **********
* Stage A *** Compile parameters/inputs for Level-weights calculations
************************************************************ **********
* 1. a_c_h completed clusters by 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'
}

* 2. A_h total number of census clusters by strata
gen A_h = 0

* Punjab
replace A_h = 26958 if v023 == 1 // Punjab Urban
replace A_h = 60048 if v023 == 2 // Punjab Rural

* Sindh
replace A_h = 21916 if v023 == 3 // Sindh Urban
replace A_h = 17223 if v023 == 4 // Sindh Rural

* KPK
replace A_h = 3221 if v023 == 5 // KPK Urban
replace A_h = 18777 if v023 == 6 // KPK Rural

* Balochistan
replace A_h = 1826 if v023 == 7 // Baluchistan Urban
replace A_h = 8386 if v023 == 8 // Baluchistan Rural

* Islamabad
replace A_h = 727 if v023 == 9 // Islamabad Urban
replace A_h = 787 if v023 == 10 // Islamabad Rural

* FATA
replace A_h = 43 if v023 == 11 // FATA Urban
replace A_h = 3763 if v023 == 12 // FATA Rural


*** 3. Average household size per cluster (M_h) ***
* Empirically derived from 2017 Census: 32,205,111 total households / 168,943 total EBs
gen M_h = 190.63

*** 4. Define Population Denominator (M) ***
* Based on Census 2017 total minus AJK/GB households
* (Calculation: 32,205,111 total - 1,004,241 AJK/GB)
gen M = 31200870

*** 5. Total number of completed households (m_c) ***
* verified this is 14,540 from the Household (HR) file
gen m_c = 11869

*** 6. Households selected per cluster (S_h) ***
gen S_h = 28

*** 7 ***************************
gen DHSwt = d005 / 1000000

************************************************************ **********
* Stage B *** Approximate Level-weights ***
************************************************************ **********
* Steps to approximate Level-1 and Level-2 weights from Household or Individual Weights

*Step 1. De-normalize the final weight, using approximated normalization factor
gen d_HH = DHSwt * (M/m_c)
*Step 2. Approximate the Level-2 weight
* f the variation factor
gen f = d_HH / ((A_h/a_c_h) * (M_h/S_h))

scalar alpha = 0.5
gen wt2_05 = (A_h/a_c_h) * (f^alpha)
gen wt1_05 = d_HH / wt2_05

First I am working for Alpha 0.5

* Create a constant cluster-level weight
bysort v001: egen wt2_05_constant = mean(wt2_05)
mepoisson children_born i.dv_any_violence i.region v012 i.education ///
i.marriage_age_group i.terminated_preg i.ethnicity_final ///
i.wealth_3cat i.residence i.ever_used_binary ///
lom_prof_community ///
[pweight=wt1_05] || v001:, pweight(wt2_05_constant) irr vce(robust)

My code is correct for multilevel Poisson, as the svy command does not support the mepoisson command. Also, I have followed the Stata manual for multilevel Poisson modelling to create the above command. your kind response will be very appreciated.

Regards,
KA
 
Read Message
Read Message
Read Message
Previous Topic: Family structure in DHS
Next Topic: MULTILEVEL WEIGHT FOR POISSON
Goto Forum:
  


Current Time: Mon Nov 09 09:12:41 EST 2026