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
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
Comment