Hi,
I'm relatively new to STATA, and am struggling to understand a particular code that explains how covariates can be entered into crossed effects models at both levels.
xtmixed asset || _all: R.country tax || industry: size
Where 'tax' is the covariate that is specified to have a random slope for each country (country level). However, this syntax includes 'tax' at the _all: level and so doesn't really do the job. The author of this syntax has then written the following which is what I cannot understand.
tab country, gen(id_country) unab idvar: id_country* foreach v of local idvar {
gen tax_`v ́ = tax*`v ́ }
xtmixed asset || _all: R.country ||_all: tax_*, cov(identity) nocons /// || industry: size
What does the gen (id_country) syntax do? Because it is not generating a new variable in the dataset, so what is its purpose?
And also, foreach v of local idvar... code..
I've tried reading up the syntax manual for STATA but am still unable to get any clarity. Can someone explain this? Or has anyone used a similar syntax and can shed some light?
Thank you.
Ahuti
Related Posts with Crossed effects models with covariates
Calculating residuals in a multinomial regression as part of 2SRII am attempting to do a 2 stage residual inclusion (2SRI) model where the first stage is estimating …
Double fixed effects Yes/No with estoutI need to declare two fixed effects at bottom of regression table, but second fixed effect (Time FE)…
Randomly Assigning TreatmentI have person-year level data, and I am utilizing DiD that exploits state-level shocks. Each person …
reshapeHi everyone, I have a long dataset and used this code to reshape it to wide format: Code: ds hhidpn…
Problems with local macros in finding an excel fileHello Statalisters, I've being working all day in a code and i couldn't make it work. Because i'm re…
Subscribe to:
Post Comments (Atom)
0 Response to Crossed effects models with covariates
Post a Comment