Good morning, sorry this is a repost of my previously unanswered question -- I am adding explanations - to help with responses
I am fitting a multilevel model examining HIV risk behaviors using a pooled data from the DHS, in which individuals (level 1) are nested into clusters (level 2).
DHS provides only one total weight variable (perweight=v005 or hiv05). One approach is to set the level 2 weights to a constant, which I have done below
Code:
gen weight=hiv05/1000000 gen weight2=1 svyset idhspsu, weight(weight) strata(idhsstrata) singleunit(centered) || _n, weight(weight2)
When I run my basic melogit,
Code:
svy: melogit condomless_spouse sex || idhspsu:
I am not sure what I am doing wrong here, i thought it is the level2 weights that have to be constant within the grouping variable (clusters). i would be very grateful for some advice on the correct SVYSET specification of 2-level models.
Thanks in advance of your assistance.
A scratch of my data produced by dataex is below:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float country double sample long v001 int(v002 v003) double(idhspsu idhsstrata) float idregion long hiv05 float(condomless_spouse sex) int v106_education_r 148 14803 165 21 4 14803000165 1480300016 35 1377418 0 1 1 231 23104 57 286 1 23104000057 2310400001 67 416029 1 0 2 324 32404 15 29 5 32404000015 3240400015 96 1438448 1 1 0 324 32404 313 31 5 32404000313 3240400011 94 886109 1 1 0 426 42603 169 81 2 42603000169 4260300011 102 1373706 0 1 2 426 42603 240 71 3 42603000240 4260300006 97 . 0 1 1 454 45405 754 41 2 45405000754 4540500037 111 . 1 1 1 466 46605 204 193 2 46605000204 4660500008 135 . 1 1 0 466 46605 227 261 1 46605000227 4.6605e+09 134 742800 1 0 1 466 46605 304 316 1 46605000304 4660500001 135 1190701 0 0 2 516 51604 465 18 3 51604000465 5160400009 146 . 1 1 0 716 71606 314 2 2 71606000314 7160600002 242 1969120 1 1 2 834 83405 246 525 4 83405000246 8340500020 199 826069 0 0 1 894 89405 388 623 2 89405000388 8940500016 234 1328452 1 1 2 894 89405 499 357 1 89405000499 8940500001 237 997602 1 0 0 end label values country COUNTRY label def COUNTRY 148 "chad", modify label def COUNTRY 231 "ethiopia", modify label def COUNTRY 324 "guinea", modify label def COUNTRY 426 "lesotho", modify label def COUNTRY 454 "malawi", modify label def COUNTRY 466 "mali", modify label def COUNTRY 516 "namibia", modify label def COUNTRY 716 "zimbabwe", modify label def COUNTRY 834 "tanzania", modify label def COUNTRY 894 "zambia", modify label values sample sample_lbl label def sample_lbl 14803 "Chad 2014", modify label def sample_lbl 23104 "Ethiopia 2016", modify label def sample_lbl 32404 "Guinea 2018", modify label def sample_lbl 42603 "Lesotho 2014", modify label def sample_lbl 45405 "Malawi 2016", modify label def sample_lbl 46605 "Mali 2012", modify label def sample_lbl 51604 "Namibia 2013", modify label def sample_lbl 71606 "Zimbabwe 2015", modify label def sample_lbl 83405 "Tanzania 2010", modify label def sample_lbl 89405 "Zambia 2013", modify label values v003 LINENO label def LINENO 1 "1", modify label def LINENO 2 "2", modify label def LINENO 3 "3", modify label def LINENO 4 "4", modify label def LINENO 5 "5", modify label values idregion reg_label_gen label def reg_label_gen 35 "chad", modify label def reg_label_gen 67 "ethiopia somali", modify label def reg_label_gen 94 "guinea labe", modify label def reg_label_gen 96 "guinea nzerekore", modify label def reg_label_gen 97 "lesotho berea", modify label def reg_label_gen 102 "lesotho mohale's hoek", modify label def reg_label_gen 111 "malawi chradzulu", modify label def reg_label_gen 134 "mali bamako", modify label def reg_label_gen 135 "mali kayes and koulikoro", modify label def reg_label_gen 146 "namibia omaheke", modify label def reg_label_gen 199 "tanzania Mara", modify label def reg_label_gen 234 "zambia eastern, northern, and muchinga", modify label def reg_label_gen 237 "zambia north-western", modify label def reg_label_gen 242 "zimbabwe manicaland", modify label values sex gender label def gender 0 "male", modify label def gender 1 "female", modify label values v106_education_r edu label def edu 0 "no education", modify label def edu 1 "primary", modify label def edu 2 "secondary or higher", modify
0 Response to SVYSET Specification for 2-Level HLM Model
Post a Comment