twexp and twgravity: Estimating exponential regression models with two-way fixed effects

Vincenzo Verardi, Koen Jochmans

Research output: Contribution to journalArticle


We introduce the commandstwexpandtwgravitythat implement theestimators developed in Jochmans (2017) for exponential regression models withtwo-way fixed effects.twexpis applicable to genericn×mpanel data.twgravityiswritten for the special case where the data is a cross-section on dyadic interactionsbetweennagents. A prime example of the latter is cross-sectional bilateral tradedata, where the model of interest is a gravity equation with importer and exportereffects. Bothtwexpandtwgravitycan deal with data wherenandmare large,that is, the case of many fixed effects. They make use ofMataand are very fast toexecute.
Original languageEnglish
Number of pages14
JournalStata Journal
Publication statusAccepted/In press - 2019



  • exponential regression
  • gravity model
  • panel data
  • two-way fixed effects

Cite this