Dear Stata Listserv,
I’m seeking help with how to lag variables in a three-level mixed effects model using the mixed command. Level 1 is individuals, level 2 is the country-year, and level 3 is the country.
Before my current project, I was working with country-year (pooled time-series) data, using the mixed command. With these data, it was a simple matter to xtset the data <xtset country year> and then use the L. operator to lag any time-varying variables. More recently, however, I merged in individual-level data from the World Values Survey into this existing country-year dataset. So the basic unit of analysis is now the individual person (nested within survey years, nested within countries). With the individual-level data merged in, Stata (version 15) is no longer allowing me to xtset the data, so I can’t use the L. operator. However, I still want to lag my country-level time-varying variables by one year or more. How can I do that?
Thanks a lot,
Louisa
Related Posts with How to Lag Variables in a Three-Level Mixed Effects Model
precoin error 3301When I run precoin using the sample data of 100 obs, it works successfully. However , it doesn't wor…
Stata 17 snapspan does not workAfter I upgraded to Stata 17, I experienced an error message when I ran snapspan syntax. I believe i…
CI 95% generated by Meta set is slightly different than the CI generated by Metan codeI have been using STATA 14 for so long and I have run a lot of meta-analysis with no trouble. Recent…
multiple imputation (MICE) and varying estimation sample!Hello, I am building a regression model for ethnicity as a categorical exposure variable and death a…
reshape from wide to long with string variable defining new variables in long formatHello all, I am struggeling with reshaping my data from wide to long. I want to use a string variabl…
Subscribe to:
Post Comments (Atom)
0 Response to How to Lag Variables in a Three-Level Mixed Effects Model
Post a Comment