{'fraction_non_alphanumeric': 0.02775074782859408, 'fraction_numerical': 0.013947453778786896, 'mean_word_length': 4.911376224968044, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 0, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Bilateral trade flows and comparative advantage: does the size matter?

The paper applies a variant of the gravity model to test whether there is a positive link between the size of trade flows and the extent to which they follow the pattern of comparative advantage. Using UNCTAD’s 2016 trade data for every country in the world, and 255 merchandise items, we show that countries trading more with each other tend to follow the patterns of comparative advantages more than countries with smaller mutual trade flows. While smaller trade flows can be easily influenced by business decisions of individual companies or one-off trade contracts going against trade pattern predictions, this is not the case with larger flows. We also find signs that holding trade volume constant, more distant countries trade less than geographically proximate countries, in line with predictions from comparative advantage. The results are valid for the whole database of all country pairs in world trade, but the goodness of fit increases with the number of items these country pairs trade in. The paper is the first insight into the topic and can be expanded to a higher level of disaggregation and more variables in future research.


INTRODUCTION
Two centuries have passed since Ricardo and Torrens discovered the principle of comparative advantage, and more than fifty years since Balassa developed its "revealed" version. While the former has become a staple of international economics, the latter is now probably the most widely-known (if not theoretically consistent) simple mathematical expression of specialization patterns in international trade. Numerous authors have used Balassa's Revealed Comparative Index (RCA) and its derivatives to study global or local trade patterns. Papers on different industries (Bojnec -Ferto 2009;Han et al. 2009), regional aspects (Hoekman -Djankov 1997;Bojnec 2001;Worz 2005), alternative measures (Vollrath 1991;Hoen -Oosterhaven 2006;Yu et al. 2009), or statistical properties of the index (Hinloopen -Van Marrewijk 2001) abound. However, quite surprisingly, with the sole partial exception of Peterson (1988), to our knowledge there are no studies which would explore possible links between RCA and the volume of bilateral trade flows.
This paper follows a simple logic. Given the method of calculation of RCA as an ex-post numerical representation of a country's trade patterns, each country's total trade is necessarily fully in line with its RCA. That certainly does not mean that all the country's trade flows are in line with its RCA. Some bilateral exports are small by volume. Some are much larger and constitute an important part of the country's exports, sometimes even an important share of global exports. We expect to find that the latter flows tend to be more in line with RCA than the former -given the very specific method of calculating RCA, this is not mathematically self-evident. Wider flows normally include more commodities and more participants, and it can be expected that they should be governed by a principle of mutual benefit (in trade very often represented by comparative advantage); more so than narrower flows. Should this not be the case, one could argue that comparative advantages are an irrelevant concept in actual trade. Hence, the main hypothesis of the present paper is that there is a positive link between the size of trade flows and the extent to which they follow the pattern of comparative advantage.
The rest of the paper is structured as follows: in the next section a brief literature review is offered focusing on RCA. Section three details data and the methodology of the research. Section four presents the results and offers discussion. Finally, the last section concludes. Society and Economy 41 (2019)

LITERATURE REVIEW
The concept of Revealed Comparative Advantage surely does not need to be introduced at length. Originally presented in Balassa's 1965 paper, it has opened a topic which has been prominent in the literature in the last five decades. The index can be calculated as where x is country c's total exports of product i. Simply said, it is ratio of a product's share in a country's exports relative to the product's share in global exports, and it can take values from zero to infinity. Values larger than 1 mean the country has a relative comparative advantage in the product, and vice versa. While RCA is not exactly a flawless indicator, it has numerous advantages: It is simple, relatively easy to calculate at any level of aggregation, and it generates possible cross-country and cross-sector rankings (Balance et al. 1987). As a result, dozens of economists have adopted it for multitudes of uses. At first, the index was mostly utilized to study countries' specialization patterns. It has probably already been applied to every single country in the world -starting with major industrial countries (Balassa 1977) and economic giants like China (Yue -Hua 2002) or Korea (Lee 1995), and ending with smaller economies such as Lithuania (Saboniene 2009) or Pakistan (Abbas -Waheed 2017), as well as in larger global (OECD 2011), regional (Fojtikova 2016) and cross-regional studies (Obadi -Korcek 2016).
The index has also been enormously popular in analyzing industry-level trade (Hardwick -Dou 1998;Bojnec -Ferto 2009;Han et al. 2009;Balogh -Jambor 2017;Boschma et al. 2017) and technological specialization (Meliciani 2002;Malerba -Montobbio 2003). More unorthodox applications include researching the role of RCA in investment (Feliciano -Lipsey 2017), climate policy (Boehringer -Alexeeva-Talebi 2013;Boehringer et al. 2017), or in quantitative studies of scientific output (Wang 2016). Even "trade sophistication indicators", like EXPY and PRODY, were partially derived using the index (Hausmann et al. 2007). The level of popularity of RCA can be easily demonstrated by more than 600 papers touching on the topic in the Web of Science database alone (2018). Peterson (1988) has offered the only study we are aware of which is partially related to the present paper. He "examined the factors which can cause a coun-try's share of group exports of a particular product to be a potentially unreliable ex post indicator of revealed comparative advantage" (Peterson 1988: 364) focusing on international travel services. He searched for a correlation between export shares and RCA using a similar approach to what will be introduced in the next section. However, his interest was limited to theoretical issues of measuring comparative advantage and did not study possible links between RCA and export shares in general.
A wide branch of literature is devoted to the shortcomings of the index which are already well known. They have been summarized succinctly for example in De Benedictis and Tamberi (2001) or Hinloopen and Van Marrewijk (2001). They include asymmetry, upper bound variability, mean variability, and as a result inconsistency across industries and countries (Yeats 1985). Consequently, numerous authors have tried to come up with alternative indices to overcome these issues. They include simple derivatives such as Symmetric Revealed Comparative Advantage (Laursen 1998), Weighted Revealed Comparative Advantage (Proudman -Redding 2000), Additive Revealed Comparative Advantage (Hoen -Oosterhaven 2006) or Normalized Revealed Comparative Advantage (Yu et al. 2009), as well as more complicated theoretically consistent alternatives to the RCA (Costinot et al. 2012), and gravity-based estimators (French 2017a;2017b).
There is no general consensus as to which alternative indicator is preferable. None of the indices is perfect -they all have pros and cons depending on the use (Sanidas -Shin 2010). In the present paper we will use Symmetric RCA as it has the advantage of symmetric distribution, normality of error terms, and is simple to calculate.

DATA AND METHODOLOGY
For the sake of simplicity, clarity and comparability, the paper is based on data compiled by the United Nations Conference on Trade and Development (2018). These include export and import matrices for 2016 by product based on the threedigit level of the SITC commodity classification, Revision 3 for each pair of trading partners in the world. Curacao, Holy See, San Marino and South Sudan are excluded due to unavailability of data. The final database comprises 222 countries and regions and 255 merchandise items. Non-zero data are available for more than 2.5 million cells in the exporter-importer-merchandise matrix. Export and import figures are used "as is"; net exports are computed the usual way.
The authors convert available data to percentages, and hence calculate the importance of each merchandise for each exporter, the share of each aggregate country-to-country export flow on global exports (SHARE WORLD ) and its share in total exports of the exporter (SHARE EXPORTER ). The same is done for the share in total trade defined as exports plus imports (SHARE2 WORLD and SHARE2 EXPORTER ). Obviously, a few country pairs play an important role in world trade while the majority of others are negligible. The top 10 international export flows (out of a possible maximum of 49,062) constituted over 15% of global exports in 2016 (Table 1). Next, Revealed Comparative Advantage (RCA) indices are computed using the standard method (Balassa 1965) as seen in the previous section. While there has been a lot of criticism of the measure and several new indices have been proposed in the last five decades, these tend to suffer from similar or even more serious issues than the original. We will therefore only perform Laursen's (1998;2015) adjustment to make the index symmetric, i.e. the final Symmetric Revealed Comparative Advantage (SRCA) index is calculated as (RCA-1)/(RCA+1), with values ranging from -1 to 1.
In addition to SRCA, relative SRCA is also calculated. This can be defined as the difference between exporter's SRCA and importer's SRCA for each exported item. Its values can range from 2 for the highest relative comparative advantage of the exporter to -2 for the highest disadvantage. Values are reported only if both countries export the item to at least one country in the world.
To see how well exports from country A to country B match their global comparative advantages, Pearson correlation coefficients are taken between commodity structure of exports from A to B and the array of A's RCAs for each exported item. This is done for exports and net exports on the one side, and SRCA and relative SRCA on the other side. Hence four matrices (222*222 countries) of Pearson coefficients are obtained which we label COR X/SRCA , COR X/rSRCA , COR NX/ SRCA and COR NX/rSRCA . Quite obviously, the informative value of these correlation coefficients depends on the number of products exported. For countries trading only 2 or 3 products, the Pearson coefficients are necessarily more accidental than for countries trading a wide range of items. Therefore, separate matrices are derived based on the number of exported items (calculated from UNCTAD 2018 data). While the original COR X/SRCA matrix has just over 26,000 non-zero cells, the number drops to 6,476 when only export flows with at least 100 items are considered.
These correlation coefficients show how each trade flow is in line with the countries' comparative advantages. The higher the coefficient, the higher the fit. In a hypothetical situation with a Pearson coefficient of 1.00, trade follows the structure of comparative advantages perfectly, i.e. the array of exported items ordered by trade volume is the same as the array of exported items ordered by RCA. The closest to this have been Iraqi exports to the Netherlands with the COR X/SRCA approximately equal to 0.93 (Table 2). Note that while RCA indices are computed using actual trade data, this does not invalidate the approach taken here of drawing conclusions from comparing trade volumes with RCA on a bilateral level. Owing to very different methods of calculation, even if a country exported all of its products to one partner only, this would not mathematically lead to the COR X/SRCA coefficient of this trade necessarily being equal to 1. The key word with this type of comparative advantage indices is "relative".
Once all the necessary calculations have been completed we can proceed to verify the main hypothesis. Should there be a link between the size of trade flows and the extent to which they follow the pattern of comparative advantage, there must be a correlation between SHARE WORLD or SHARE EXPORTER on one side of the equation and the Pearson coefficients introduced in the previous paragraph. In addition, gravity-type OLS regression analyses with country dummies will be performed to assess the statistical significance of the relationship. This is based on the assumption that distance -measured in kilometers between economic centers (not necessarily capital cities) and taken from the CEPII's well-known GeoDist database (2018) -between trading partners might influence the importance of comparative advantage in bilateral trade. However, we will not develop a fullfledged gravity model comprising all the standard variables as it would be far beyond the scope of the paper.
There are two opposite expectations from including distance into the model. On the one hand, it could be argued that transportation costs (and hence distance) work as a factor discouraging trade, and as a result distant countries will mostly trade goods with high levels of advantage for both of them, i.e. conforming to RCA. Conversely, geographically proximate countries face low transportation costs and their trade will therefore include a wide range of products regardless of their comparative advantages. As a result, the distance variable should have a positive sign in our models.
In a different line of argumentation, it might be the case that, ceteris paribus, distant countries' mutual trade patterns are mainly formed by intergovernmental treaties and business decisions of a small number of companies; more so than trade patterns of geographically proximate countries. These treaties and decisions do not necessarily follow the country-level RCA logic. Proximate countries are also often members of regional integration blocs which eliminate barriers to mutual trade, theoretically leading to better compliance with comparative advantage. Consequently, the role of distance might be negative.
A word of caution needs to be uttered about including the distance variable into our models. Numerous economists have shown that gravity models are generally valid, i.e. trade volumes as well as trade shares are influenced (among other factors) by distance. It follows that in our models distance is already implicitly included in the SHARE variables. However, adding a separate distance variable does not constitute a serious econometric problem and is vital to ascertain its role in influencing whether trade is RCA-compliant.

RESULTS AND DISCUSSION
The correlation matrix (Table 3) shows that in the majority of cases there is only a very weak relationship between the studied variables. In line with logical expectations, the strength of the relationship is growing with the growing number of products exported. The highest correlation coefficients have been recorded when analyzing the share of a product's export flows in a country's total exports (as opposed to share of flows in global exports) in trade lines with at least 100 or 150 products.
The low correlation coefficients appear to suggest that the link between the size of trade flows and the extent to which they follow the pattern of comparative advantage is weak or non-existent. Obviously, this will need to be thoroughly tested in regression analyses. Before we proceed, a simple exercise can be performed to show how the correlation is distributed.
In Figure 1 the whole dataset consisting of export flows with at least 100 exported products is divided into deciles based on the global share of the flow (left chart) or by flow's share in the exporter's exports (right chart). On the vertical axis the average correlation coefficient (COR X/SRCA ) is provided for each decile, along with ±1 standard deviation intervals. It can be seen that the average correlation coefficient has a growing tendency, i.e. bigger export flows are more in line with the RCA patterns than smaller export flows. This relationship is clearly visible in global exports (left) and is almost perfect when studying country-level shares (right) -the value of COR X/SRCA increases decile by decile from an average of 0.18 for the lowest 10 % to 0.35 for the highest 10 %. While the correlation is not strong, the increase is substantial.
Net export variables (COR NX/SRCA and COR NX/rSRCA ) have not been reported so far, as the results of the correlation analyses are unsatisfactory and show no traces of a strong relationship. Regression models are no exception; therefore we will limit further discussion to the export variables (COR X/SRCA and COR X/rSRCA ).

Society and Economy 41 (2019)
The main regression models are reported in Table 4. All the regression coefficients are statistically significant. The independent variables of interest (SHARE) have a positive sign, which means that, other things being equal, increasing the importance of an export flow leads to its higher compliance with the predictions of comparative advantages. While small export flows do not really have to be   Unauthenticated | Downloaded 05/29/20 08:15 PM UTC aligned with comparative advantages and can be easily influenced by factors such as business decisions of individual companies or one-off trade contracts, larger export flows seldom go against RCA. In words inspired by Adam Smith, it appears that the countries are led by an invisible hand and by trading the goods in accordance with their own comparative advantage they also promote the general good. Very interesting results can be seen when looking at the distance variable. Without exception, it is negative and statistically significant. Previously, we have noted that the expectations from including distance into the model are uncertainthere are reasons to believe the sign might be positive, but there are also reasons to believe it might be negative. The regression models suggest that the latter reasons prevail and that, holding trade volume constant, more distant countries trade less, in line with predictions from comparative advantages. This is an important conclusion that might be worth pursuing in future research.
Low values of R 2 (reaching 0.337 as a maximum) indicate that the models are far from explaining all the variability in the data around its mean. However, they do not make the models irrelevant, as the statistical significance of independent variables shows that they indeed influence the dependent variable. Moreover, the signs of the coefficients are not unexpected, and they have an economic interpretation that can be readily explained.  Note: Standard errors in parentheses. Significance: *** p < 0.01, ** p < 0.05, * p < 0.1. SHARE variables based on exports, SHARE2 variables based on total trade (X+M).

Society and Economy 41 (2019)
The results remain unchanged even when country dummies are dropped from the model (Table 5); yet the R 2 drops to almost zero, as could have been expected.
Apart from those displayed in Tables 4 and 5, dozens of other models have been estimated. Table 6 shows alternative regressions when relative SRCA is used to construct the dependent variable (hence the dependent variable is COR X/ rSRCA ). The independent variables of interest have the same sign and similar value of parameters, but an important difference can be seen in all the models compared to the previous ones -distance becomes positive, yet is still statistically significant. The same is true when country dummies are dropped, when other variables are log-transformed or when we use dependent variables with a different limit on the number of exported items (not reported here). This equals a logical contradiction: on the one hand, we have models where distance positively influences RCA-compliance ; on the other hand, we have models where distance affects RCA-compliance negatively. Obviously, both conclusions cannot hold simultaneously. Dropping the distance variable does not solve the issue either as the results remain virtually unchanged.
The solution to this "paradox" might rest in the fact that relative SRCA, which is used as the dependent variable in Table 6, is an indicator computed by subtracting the importer's SRCA from the exporter's SRCA. For each country, SRCA is calculated from a different base and using them in one equation might lead to  problems with comparability. This is a well-known criticism of revealed comparative advantage indices (Sanidas -Shin 2010) and hence relative SRCA indicators should not be used. (It is interesting to emphasize again that even in case of these regressions, the variables of interest have expected parameter signs and values.) The comparability problem is minimized in case of absolute SRCA, by calculating each country's SRCA using only its own indicators, and by applying country dummies.
To further subject our results to robustness checks, we performed separate regression analyses by continent. Models 25 to 34 (Table 7) only include the exports of the respective continent's to the whole world. All the parameters have the expected signs and values, even though in a few cases they are not statistically significant. The models for Asia, Africa and the Americas are fully in line with our main models; Europe and the Pacific region, however, show issues with statistical significance. In case of the Pacific this is not entirely surprising as it is by far the smallest region included in the analysis and is dominated by a single In what could be seen as a setback, models with SHARE WORLD variables did not lead to any statistically significant results in robustness checks (not reported here). This equals a logical contradiction: on the one hand, export flows which have higher shares in a country's total exports are more in line with RCA; on the other hand, export flows which have higher shares in global exports appear not to be related with RCA. Obviously, both shares should move in the same direction. However, the important difference consists in the fact that while SHARE EXPORTER variables are calculated from a different total for each country's exports, SHARE WORLD variables are calculated from the same base, i.e. their sum gives total global trade, or less (if the number of flows in the model is limited by number of exported products). This means that country dummies have a vital role in models featuring the country-share variable (translating into a fixed-effect model) but are not necessary in the latter case. When robustness checks with SHARE WORLD variables are re-run without country dummies, the results are similar in terms of signs and statistical significance to Table 7.
As is the case with every single research using statistical methods, the analysis is not straightforward and there are various issues that need to be considered. The most prominent issue in gravity models is the problem of zeroes, normally solved by Heckman correction or other alternative estimation methods. In our case, approximately 42% of the data lines included a zero, i.e. there was no mutual trade between the countries. We chose to drop these data. However, this does not constitute a problem; "zeroes" bear no value for the present research as it is only interested in existing trade and does not aim to explain why countries do not trade with each other. It only tries to show how trading countries trade with each other. Henceforth we were able to drop the zeroes without the usual negative statistical consequences.
In addition to dropping the zeroes, we have deliberately put a lower limit on the number of products the countries trade with (50 or 100) to avoid very narrow trade flows where the values of correlation variables can be rather accidental. This means that even more lines are excluded from the database. Obviously, the excluded data are not randomly distributed and hence their exclusion influences the results of our analysis. Therefore, the results should not be interpreted generally, but have to be understood with care, applying only to bilateral trade flows which are "sufficiently diversified". However, the results are valid even when all trading country pairs are considered; it is just the R-squared which becomes lower (see Table 8).
A possible variant of the present research would be to use the Spearman correlation coefficient instead of Pearson. The models (not reported here) are a bit more computation intensive, but the results remain unchanged in sign and statistical significance, and the coefficient of determination generally rises.

CONCLUSIONS
The study of bilateral trade and its compliance with the predictions of comparative advantages based on the trade flow size has generated some interesting results:   There is a positive link between the size of trade flows and the extent to which they follow the pattern of comparative advantages. Larger countryto-country export flows tend to be more in line with RCA than smaller export flows.    Holding trade volume constant, more distant countries trade, less in line with comparative advantage predictions, than geographically proximate countries.   The results are valid for the whole database of all country pairs in world trade, but the goodness of fit increases with the number of items these country pairs trade with. The first result might appear self-evident (due to the fact that RCA indices are computed ex post from actual trade data, and the present paper uses RCA indices in correlations with actual trade data), but mathematically this is not the case due to substantial differences in calculation. The finding means that wider trade flows can be considered more "predictable" in their composition than narrower ones, in the sense that they are more likely to conform to the expectations of comparative advantages. This fully complies with economic logic.
Another interesting finding regards distance. In usual gravity models, its negative role is interpreted as a proof that countries lying closer to each other trade more with each other. In our case the negative role means that countries lying closer to each other follow comparative advantage patterns in their mutual trade more than distant countries. This is opposite to what might have been expected. However, a combination of factors, such as regional integration, intergovernmental treaties or business decisions of a small number of companies can help explain the result.
The research can be further expanded and enhanced in multiple ways. A higher level of disaggregation can be used to calculate RCA, possibly using World Bank's HS 6-digit classification. Alternative measures of comparative advantage can be explored, such as French's gravity-based estimators (2017a; 2017b). The model can perhaps also be enlarged with other independent variables to achieve a higher goodness of fit. Any future research will necessarily be significantly more computation intensive.
Open Access. This is an open-access article distributed under the terms of the Creative Commons Attribution-NonCommercial 4.0 International License (https://creativecommons . org/licenses/by-nc/4.0/), which permits unrestricted use, distribution, and reproduction in any medium for non-commercial purposes, provided the original author and source are credited, a link to the CC License is provided, and changes -if any -are indicated.