5 This equation is estimated separately for each of the 835 product categories in the data set, yielding 835 sets of coefficients. The equation is estimated using two-stage least squares. ���� is a component of ����, so that the regressor ln����ln��� is correlated with the disturbance term �′���. We therefore use ln������ln��� as an instrument for ln����ln���.<sup>16</sup> The results are used to calculate a set of bilateral quality estimates for each country’s exports. Rearranging (1), and using the estimated coefficients, quality is calculated as the unit value adjusted for differences in production costs and for the selection bias stemming from relative distance:<sup>17</sup> As is standard, quality ���� and importers’ preference for quality _δ_ are not separately identified.<sup>18</sup> This estimation yields quality estimates for more than 20 million product-exporter-importer-year combinations.<sup>19</sup> To enable cross-product comparisons and aggregation into a multi-level database, all quality estimates are first normalized by the “world frontier”, defined as the 90<sup>th</sup> percentile in the relevant product-year combination. As a corollary, changes in quality over time are all defined relative to the world frontier. After normalization, the quality estimates are aggregated across all importers for each country, using current trade values as weights. The estimates are then aggregated to higher SITC levels (SITC 4-, 3- , 2-, and 1-digit, as well as country-level totals); aggregations are also produced based on the BEC classification, as well as for the 3 broad sectors of agriculture, non-agricultural commodities, and manufactures.<sup>20</sup> At each aggregation step, the normalization to the 90<sup>th</sup> percentile is repeated, and trade values are used as weights.

The data set is a significantly extended version of the UN–NBER data set. Starting with the COMTRADE database, we construct a trade data set for 1962–2014 by supplementing importer-reported data, generally considered more reliable, with exporter-reported data where the former do not exist.<sup>21</sup> We ensure consistency over time and in aggregating to broader categories by using the methodology of Asmundson 16 Where a unit value for the preceding year is not available (for instance, because the good was not traded), we use the unit value in the closest available preceding year, going back up to 5 years. If unit values are not available in any of the preceding 5 years, the observation is excluded from the estimation.

> 17 − ����� In (4), the term is set to its expectation of zero: it cannot be separately identified, as it constitutes part of �� �′���. As pointed out in Hallak (2006), ���� may reflect omitted factors affecting export prices in (1), such as sectorspecific technological advantages not well proxied by GDP per capita, and could persist over time. This should be borne in mind when interpreting the results.

> 18 The preference for quality parameter _δ_ will vary across sectors. Therefore, when quality estimates are later aggregated across sectors, the procedures necessarily also aggregate across these heterogeneous preferences for − ��� quality. The level term is of no significance, given our subsequent normalization of the quality estimates. ��

19 This number is smaller than the 45.3 million potential combinations in the data set because of: (i) missing observations for other regressors, primarily per capita income; and (ii) elimination of outliers (see fn. 22).

20 Changes in the higher-level (including country-level) quality estimates will in general reflect both quality changes _within_ disaggregated sectors, and reallocation _across_ sectors with different quality levels. If the composition of exports is shifting toward product lines characterized by low quality levels, it is possible for the quality of any given product to be rising sharply, but country-level quality to rise slowly (or indeed decline).

21 The only exceptions to this methodology are export flows as reported by the United States, which take precedence over importer-reported flows.

(continued...)