This repository introduces and implements the Poisson-based expectile regressions described in the article “The Tails of Gravity: Using Expectiles to Quantify the Trade-Margins Effects of Economic Integration Agreements”. The estimation method is called asymmetric Poisson pseudo maximum likelihood (APPML) estimation and is used to analyze heterogeneous effects in international trade, but it is also useful in many other applications.
The R script (appml_r2) has been adapted from the existing Stata command appmlhdfe.ado.
The R code is also an installable package (version 1.2):
# install.packages("devtools")
devtools::install_github("mwclance/APPMLHDFE")
library(APPMLHDFE)
?appml
Basic use:
fit <- appml(y ~ x + z, data = dat, expectile = 0.25,
absorb = c("id", "time"), cluster = ~id)
coef(fit)
summary(fit)
appml() returns an object of class appml, with coef(), vcov(), residuals(),
fitted(), nobs(), summary() and print() methods. When estimating a sequence of
expectiles, pass the residuals of the previous fit through start to speed up
estimation. Fixed effects are given through absorb, not in the formula.
Stata:
Matthew Clance & J.M.C. Santos Silva, 2025. “APPMLHDFE: Stata module to estimate asymmetric Poisson regression with high-dimensional fixed effects,” Statistical Software Components S459414, Boston College Department of Economics.
Data:
Bergstrand, Jeffrey; Clance, Matthew; Santos Silva, Joao (2025), “The Tails of Gravity”, Mendeley Data, V1, doi: 10.17632/n67gft8fvm.1
Expectile regressions extend the flexibility of traditional regression models by estimating effects across the entire conditional distribution of a dependent variable. Unlike quantile regressions, expectiles are global measures of location, providing robust insights into how covariates influence not just the mean but also the tails of the distribution.
The Poisson-based expectile regression approach combines the advantages of Poisson pseudo-maximum likelihood (PPML) with the ability to model heterogeneity across the distribution:
install_github. This is the version to use.print, summary, coef, vcov, residuals, fitted and nobs methods.devtools::test().source("appml_r2.R"). Function to estimate APPML is essentially a wrapper program using the fixest package’s feglm function. Note that you can estimate either a single expectile or multiple expectiles. When estimating multiple expectiles, using starting values from sequential (previous) estimates will speed up the process.