[R] r and fixed effect modeling

Cristina Cametti cristina.cametti at gmail.com
Mon Jul 11 10:00:49 CEST 2016


Dear all,

I am having problem finding a reliable code for my country fixed effects model.
I have 21 countries in my database and individuals nested within them. I am running a multilevel analysis first, and then I am using the fixed effects approach to check the robustness of my findings. At this point, I need to include in my model some cross-level interaction effects between the country level factors and individual level variables. However, I am not sure if my r code is right:

model1<-lm(safety ~ mixed_neigh + ethnic_neigh + age + gndr + eduyrs + domicil + partner + 
           tvpol + income + victim + trust + trustXprison_pop + trustXforeign_pop + victimXprison_pop + 
           victimXforeign_pop + mixed_neighXprison_pop + mixed_neighXforeign_pop + ethnic_neighXprison_pop + 
           ethnic_neighXforeign_pop + factor(cntry)-1, data=mydata)
As you can see, the interaction are between a individual level variable (such as trst, victim, mixed_neigh and ethnic_neigh) and two country level variables (prison population and foreign population). The code runs fine, so I don’t have warning messages and it is all spelled correctly. I just want to know if you think that this is the right code to do a fixed effect analysis (only cross sections and not cross time). Indeed, I I used the lm and not ppm because my dataset is from only one year. Do you think it is correct?

Thank you very much for your attention,

Cristina 
	[[alternative HTML version deleted]]



More information about the R-help mailing list