Dear Statalists,
I'm trying to fit a multinomial multilevel logistic regression on the propensity for voting a populist party.
The data I'm using is the integrated European Social Survey dataset to which I added several country and year level variables (example with dataex below).
Even after reading several ( if not all the) examples provided by the manual I still can't figure out how to specify such a model with gsem.
This is because I don't understand how to specify the corresponding level for each variable. Individuals should be nested in countries and countries should be nested in years.
If I were to fit the model using xtmixed (as I didi until now) the model would be:
(In this case I reorganized the dependent variable to have just two outcomes)
Here is an example of the data:
Can someone help me? I don't need the full model, just the general rules for specifying it!
Thanks to everyone in advance also for your patience (first post!)
Giovanni
I'm trying to fit a multinomial multilevel logistic regression on the propensity for voting a populist party.
The data I'm using is the integrated European Social Survey dataset to which I added several country and year level variables (example with dataex below).
Even after reading several ( if not all the) examples provided by the manual I still can't figure out how to specify such a model with gsem.
This is because I don't understand how to specify the corresponding level for each variable. Individuals should be nested in countries and countries should be nested in years.
If I were to fit the model using xtmixed (as I didi until now) the model would be:
(In this case I reorganized the dependent variable to have just two outcomes)
Code:
quietly xtmixed PTV gndr agec edulvla polintr freehms attimm eminority /// gincdif tvtotrlgdgr radical urban individualism income /// c_socgloind c_persgloind c_infoglind c_cultgloind gdp /// c_unemp c_gini c_cpi c_socspe imminfrate m_imp_comp if good /// || country: c_socgloind c_persgloind c_infoglind c_cultgloind gdp c_unemp /// c_gini c_cpi c_socspe imminfrate m_imp_comp, /// || year: c_socgloind c_persgloind c_infoglind c_cultgloind gdp c_unemp /// c_gini c_cpi c_socspe imminfrate m_imp_comp, var mle est store model4 predict lfit4
Code:
clear input float ptv double(gndr edulvla) long country float gdp double year 0 1 3 1 42058.75 2006 0 0 2 1 42058.75 2002 0 1 3 1 42058.75 2004 0 1 3 1 42058.75 2004 0 1 3 1 42058.75 2004 0 1 1 1 42058.75 2014 0 1 3 1 42058.75 2002 0 1 3 1 42058.75 2006 1 1 3 1 42058.75 2006 0 1 3 1 42058.75 2004 0 0 5 1 42058.75 2004 0 0 3 1 42058.75 2002 0 1 2 1 42058.75 2002 0 0 3 1 42058.75 2006 0 0 4 1 42058.75 2004 0 1 4 1 42058.75 2006 0 0 3 1 42058.75 2002 0 1 3 1 42058.75 2002 0 1 3 1 42058.75 2004 0 0 3 1 42058.75 2006 0 0 3 1 42058.75 2006 0 1 2 1 42058.75 2004 0 1 3 1 42058.75 2004 0 0 3 1 42058.75 2004 1 0 4 1 42058.75 2006 0 0 3 1 42058.75 2014 0 1 3 1 42058.75 2002 0 0 3 1 42058.75 2006 0 1 5 1 42058.75 2002 0 1 3 1 42058.75 2004 0 1 5 1 42058.75 2014 0 1 3 1 42058.75 2004 0 0 3 1 42058.75 2002 0 1 3 1 42058.75 2004 0 0 3 1 42058.75 2002 . 0 2 1 42058.75 2006 0 0 3 1 42058.75 2002 0 0 3 1 42058.75 2006 0 0 5 1 42058.75 2002 1 1 3 1 42058.75 2014 0 0 3 1 42058.75 2006 0 0 5 1 42058.75 2014 0 0 3 1 42058.75 2006 0 1 3 1 42058.75 2006 0 0 3 1 42058.75 2006 0 1 3 1 42058.75 2006 0 1 3 1 42058.75 2006 0 1 3 1 42058.75 2014 0 1 3 1 42058.75 2006 0 0 5 1 42058.75 2004 0 0 2 1 42058.75 2004 0 1 3 1 42058.75 2002 0 1 3 1 42058.75 2006 0 0 3 1 42058.75 2006 . 0 3 1 42058.75 2004 0 1 5 1 42058.75 2002 0 1 2 1 42058.75 2006 0 1 3 1 42058.75 2006 0 1 3 1 42058.75 2014 0 1 2 1 42058.75 2002 0 1 3 1 42058.75 2006 0 1 3 1 42058.75 2006 0 1 3 1 42058.75 2006 0 1 3 1 42058.75 2004 0 1 5 1 42058.75 2002 0 1 3 1 42058.75 2004 0 1 3 1 42058.75 2004 0 1 5 1 42058.75 2004 0 1 3 1 42058.75 2006 0 1 3 1 42058.75 2002 1 1 3 1 42058.75 2014 0 0 3 1 42058.75 2014 . 1 2 1 42058.75 2006 0 1 5 1 42058.75 2002 0 1 3 1 42058.75 2004 0 1 3 1 42058.75 2006 0 1 2 1 42058.75 2014 0 0 4 1 42058.75 2006 0 0 3 1 42058.75 2006 0 0 3 1 42058.75 2002 0 0 3 1 42058.75 2014 0 1 2 1 42058.75 2002 0 0 5 1 42058.75 2006 0 0 3 1 42058.75 2006 0 1 3 1 42058.75 2014 0 1 2 1 42058.75 2006 . 1 2 1 42058.75 2002 0 1 3 1 42058.75 2004 0 1 3 1 42058.75 2014 0 1 5 1 42058.75 2002 0 0 3 1 42058.75 2002 0 0 3 1 42058.75 2006 0 1 3 1 42058.75 2002 0 1 3 1 42058.75 2014 0 1 3 1 42058.75 2006 0 0 3 1 42058.75 2002 0 1 5 1 42058.75 2014 0 0 3 1 42058.75 2006 0 1 5 1 42058.75 2014 0 0 3 1 42058.75 2002 end label values ptv ptv label def ptv 0 "Not populist", modify label def ptv 1 "Right wing populist", modify label def ptv 2"Left wing populist", modify label values gndr gndr label def gndr 1 "Male", modify label values edulvla edulvla label def edulvla 1 "Less than lower secondary education (ISCED 0-1)", modify label def edulvla 2 "Lower secondary education completed (ISCED 2)", modify label def edulvla 3 "Upper secondary education completed (ISCED 3)", modify label def edulvla 4 "Post-secondary non-tertiary education completed (ISCED 4)", modify label def edulvla 5 "Tertiary education completed (ISCED 5-6)", modify label values country country label def country 1 "Austria", modify label values year essround
Can someone help me? I don't need the full model, just the general rules for specifying it!
Thanks to everyone in advance also for your patience (first post!)
Giovanni
Comment