Adding country-pair fixed effects to regression analyses

classic Classic list List threaded Threaded
1 message Options
ai
Reply | Threaded
Open this post in threaded view
|

Adding country-pair fixed effects to regression analyses

ai
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.