[R] Adding country-pair fixed effects to regression analyses

Alex I alexierino at hotmail.com
Sun Nov 1 19:38:48 CET 2015


How does one go about including country-pair fixed effects in plm package regressions (OLS, RE, FE, and Hausman-Taylor estimators)? I am hoping to use plm because it is very easy and I'm baby-new to R. 

I have received the following code from a kind professor who I don't actually know: 

pairid <- paste(isoex,isoim) 
isoexyear <- paste(isoex,year) 
isoimyear <- paste(isoim,year) 

# do not worry about the other variables, focus on the G() portion which is using Pair FE, exporter-year, and importer-year 
felm(ln_trade~bc_o + l_bc_o  + bc_d + l_bc_d + G(pairid) + G(isoexyear) + G(isoimyear), 
            clustervar=as.factor(pairid), data=gravity_data) 

I have no idea how to implement that code at all and figure there has to be some simpler way than using a complicated method in felm. 

Be well. I appreciate your time.
	[[alternative HTML version deleted]]



More information about the R-help mailing list