This R script, developed for the paper "A Spatial-Filtering Zero-Inflated Approach to the Estimation of the Gravity Model of Trade" (Econometrics, 2018), performs a backward stepwise selection for spatial filters in zero inflated gravity models for trade, that is based on robust (sandwich) p-values and does not require likelihood-based indicators.

The developed function is called be.zeroinfl.filt.full.adj1, because it is a development of the fuction be.zeroinfl in pscl

 

This R script, called WDistCutOff, takes as input a square distance weight matrix and it replaces the values of the matrix to zero if the distance is below a certain (specified by the user) cut-off, with the constraint that at least a specified number (by the user) of values by row and by column must be different from zero