How do countries specialize in agricultural production? A complex network analysis of the global agricultural product space

Using a complex-network perspective, this paper empirically explores the determinants of the process through which countries, given their capabilities, specialize in agricultural production. Using production data from the Food and Agriculture Organization (FAO) for the period 1993–2013, we characterize the agricultural production space as a time-sequence of bipartite networks, connecting countries to the agricultural products they produce. We then project this representation in the agricultural production spaces, linking countries or products according to their similarity in production profiles, and we identify properties and determinants underlying their evolution. We find that, despite the unprecedented pressure that food systems have been undergoing in recent years, the agricultural production space is a very dense network displaying well-defined and stable communities of countries and products. We also show that the observed country community structures are not only shaped by environmental conditions, but also by economic, socio-political, and technological factors. We conclude by discussing the implications of such findings on our understanding of the complex relationships involving production capabilities and specialization patterns.


Introduction
The importance of specialization in agricultural production and its central role in shaping food systems has been widely acknowledged in the literature from different perspectives. This paper builds on previous studies modeling food systems as complex evolving networks, and uses bipartite network analysis to understand how countries employ their agricultural production capabilities.
This allows us to discuss several relevant implications, useful to achieve a better understanding of agricultural trade, food consumption, and food systems in general. Food systems are indeed increasingly recognized as central for developing policies achieving food security, improving nutrition, and moving towards sustainable systems [1]. However, our understanding of how food systems are shaped and evolve is still recent and incomplete [2]. Studying food systems has proved in fact to be a difficult task, due to their complex, dynamic, and highly interconnected nature. This is mainly because exploring the functioning of food systems typically involves taking care of several processes, including production, processing, transport, and consumption of food, often carried out by a high number of very heterogeneous stakeholders [3,4]. Furthermore, food systems are typically shaped and affected by multiple factors, including the governance of food production and trade, food supply and distribution, intellectual property rights, sustainability, food waste, biodiversity, and the impact of food on population health [5][6][7][8]. Additionally, food systems have been recently placed under an unprecedented pressure due to population growth [9], dietary changes [10][11][12], rising food prices and agricultural production shocks [13,14], over-exploitation of natural resources [15], climate change [16,17], and increasing biofuels and biomass use [18,19].
As a result, an increasing agreement among scholars has emerged towards the need for a comprehensive and holistic perspective for studying food systems [20]. Following such a perspective, substantial progress in understanding the features and evolution of food systems has been recently made employing a complex network approach [2,21]. However, most of the existing contributions have focused on the global food trade side, representing the web of international trade flows for food products as multi-layer networks where nodes are countries, and studying how these network topological properties impact food security and sustainability [22][23][24][25].
Instead, complex-network tools have been much less employed to understand how countries, given their capabilities, specialize in agricultural production, and which are the determinants of their specialization patterns. In this paper, we apply a complexnetwork approach to country-level agricultural production data, which allows us to reveal how country agricultural capabilities and specialization patterns interact.
Why and how countries produce and how this affects their development are fundamental questions that have been explored in economics from different perspectives. One widely diffused approach derives from Ricardo's ideas of comparative advantages and predicts that different factors of production specialize in different economic activities based on their relative productivity differences [26,27]. Thus, in this view, the endowments of countries determine their specialization patterns. Other perspectives consider capabilities in a broad sense as part of those endowments [28]. A limitation of these approaches derives from the difficulty of measuring those endowments or capabilities.
We base our study on the methodology proposed in recent studies, which use bipartite network analysis to build the world product space [29][30][31][32][33][34][35]. We implement a data-driven approach that has the advantage of identifying country capabilities for agricultural production without measuring production factors. In our analysis, specialization patterns derive from specific characteristics of fundamental endowments (such as environmental conditions, infrastructure, educational and political systems, and technology), which are called capabilities and represent all the economic and environmental resources as well as the features of the social-political organization of a country [32]. This broad notion of capabilities determine the revealed comparative advantages (RCAs) of countries in agricultural production.
This analysis might shed light on our understanding of how countries use agricultural production capabilities and the gaps in country abilities to produce food. Although countries may resort to imports to meet their domestic demand for food, comparative advantages within a country can be heterogeneous, and gains from trade and opportunities for adjustment within countries are important [36]. Indeed, we are primarily interested in country agricultural specialization patterns, and their evolution. We analyze if countries specialize in the production of technologically related agricultural products, or if instead, they diversify their production baskets with products requiring different capabilities. Furthermore, we explore whether observed specialization patterns depend on the trade-off between the exploitation of natural conditions necessary for agricultural production and the development of institutional, political, economic, and technological capabilities (in the absence of 'optimal' natural conditions).
Our work, by revealing different diversification trajectories, allows quantitatively to recognize the links and the distance between products in terms of required capabilities. This can provide a map indicating the necessary capabilities and the path towards producing new types of products-that is, to upgrade or diversify country agricultural production baskets.
We suggest that a better understanding of how and why countries use their capabilities to specialize in agricultural production can be useful to understand recent changes in global agricultural production and consumption trends. As an example, consider the recently-observed increase in diversification of food consumption due to dietary changes towards more diverse food and different nutrient composition [10], which made country agricultural production profiles more diversified, but also more similar in their composition and concentrated in a few generic commodities [12,37], although not all countries possess the natural conditions to produce them.

Theoretical background
How and what countries produce, and how this affects their development are key issues in economic theory. One of the approaches proposed to address this problem was introduced by Heckscher and Ohlin [27], based on Ricardo's ideas of comparative advantages [26]. Ricardo predicts that different factors of production specialize in different economic activities based on their relative productivity differences. Therefore, the development of a country is a consequence of its endowments, such as land, labor, and capital. Based on these ideas, it could be predicted that countries will focus on a limited number of products for which they have abundant production factors. Interestingly, empirical evidence points out that richer and more competitive countries are also characterized by high diversification of their production and export baskets, challenging what could be expected from Ricardo's ideas. Moreover, relative productivity, which is the key explanatory variable in this theory, cannot be hardly observed [38].
A more recent approach has indicated that country capabilities, which are to be understood in a broad sense, are those that allow them to produce different products and shape their development paths [28]. These capabilities, which also determine relative productivity between activities and countries, are, by definition, difficult to be measured. Therefore, several recent studies have used a complex-network approach to measure the intangible elements that drive country specialization and competitiveness.
Our analysis builds on these ideas, and the concept of product space networks [29][30][31][32][33][34][35]. These contributions empirically show that country capabilities shape the production of different commodities and foster economic development [39]. Thus, economies develop by upgrading the products they produce and export. In this framework, technology, capital, institutions, and skills-needed to make newer products-are more easily adapted from some products than others. More sophisticated products are located in a densely connected core of the network, as they involve several capabilities shared with other products. In contrast, less sophisticated products occupy a less-connected periphery. Moving towards the core is difficult, but it helps economic development.
Interestingly, several products in the periphery of the world product space are agricultural commodities [see, the world product space in : 29]. Although they might not be relevant to reach products in the core, agricultural production is undoubtedly one of the main determinants of food supply at the country level. Therefore, we apply here this methodology, for the first time, to study the agricultural production system. Agricultural production requires not only technology, capital, institutions, infrastructure, and skills, which are certainly challenging to be quantified, but it also depends on natural conditions necessary to produce agricultural products. Identifying natural characteristics, like any type of endowment, is not an easy task. Indeed, natural, environmental, and climatic conditions can be very heterogeneous within countries, allowing them to diversify their agricultural production baskets. However, the fact that different countries produce identical products might indicate that they share the capabilities needed to produce these products.
Several efforts have been made to quantify the distribution of environmental conditions in the world. Notably, the Global Agro-Ecological Zone (GAEZ) project maps the distribution of essential inputs such as water, soil, and climatic conditions [40]. This environmental characterization, together with agricultural inputs and management conditions, can reflect differences in agricultural productivity. However, other capabilities, such as tacit knowledge, learning processes, and (partly) technological change, which are relevant in agricultural production [41][42][43], may still not be captured by this approach.
An advantage of using revealed comparative advantages is that there is no need to measure capabilities because we can assume that they reveal how country capabilities are used for agricultural production. This approach does not necessarily reflect the full potential of agricultural production because countries might not exploit all of their potential capabilities. Instead, it provides an empirically determined measure of country capabilities.
In this paper, we use a measure of relatedness or similarity between countries and between products to quantify the presence of diverse environmental characteristics and other capabilities, which in turn determine agricultural production baskets.

Data and definitions
To study how countries specialize in agricultural production, we introduce the concept of the Agricultural Production Space (APS), which can be represented, in each year t, by a bipartite graph with adjacency matrix C × P X t , where rows represent the C countries, columns are the P products, and non-zero entries X t ik indicate that country i produces product k in year t (i.e. if production Q t ik is strictly larger than zero). We build APS networks for the period 1993-2013 using production data (in tonnes) from FAO [44] for 169 countries and 219 food products (see Supplementary tables SI.1 and SI.2 (stacks.iop.org/ERL/15/124006/mmedia)). We focus on the period 1993-2013 as in those years data are more reliable and complete. Indeed, before 1993 and after 2013, data at the product level display a huge number of missing values for several countries. Note also that production data allow us to have a more precise definition of country agricultural capabilities than trade data, which are commonly used in the product space literature.
In our work, an agricultural or food product means any product or commodity, raw or processed, which can be used for human consumption. This includes all primary crops, which FAO classifies in four main groups: crops, crops processed, livestock primary, and livestock processed [44]. We exclude live animal production because data are in stocks of animal heads, which is not comparable with the rest of agricultural production. We also exclude fibers for textiles and other products for non-food uses. Notice, however, that some agricultural products can be either used for food or other purposes, such as energy or animal feed. In this work, we consider all products that can potentially be used as food for human consumption. All data are in tonnes: therefore, to have comparable measures for food supply, we transform all figures into kilocalories (henceforth, Kcal), fat, and protein content, using conversion tables provided by [45].

Identification of relevant producers
The APS matrices X t only describe whether a country produces a given product, without discriminating between 'relevant' and 'irrelevant' producers. One possible way to detect 'relevant' producers is to use the concept of revealed comparative advantage (RCA) [46]. Following [29,30,34,47], we compute RCAs for each agricultural product and each country. Since agricultural production is expressed in tonnes, we compute RCAs using gross production value (GPV), obtained multiplying gross production in physical terms by output prices at the farm gate (in constant 2004-2006 million dollars) [44]. Thus, our RCA indicator reads: where Q is production, k is products, i is countries, t is years, and GPV is the agricultural GPV. Here, RCA t ik ≥ 1 means that country i is a 'relevant' producer of product k at time t. This procedure, which is a standard practice in the economics literature, delivers quite a robust definition of 'relevant' producers. Indeed, previous studies have assessed that small variations around the unity threshold do not qualitatively change the main results [31].
We then obtain the RCA-filtered bipartite APS matrices Y t whose generic entry y t ij reads: (2)

Product and country similarity
Next, we project APS matrices Y t into productproduct and country-country spaces by defining a measure of similarity between products and between countries. We define the agricultural product space network (APSN) as a network-based representation of global agricultural production, where nodes represent agricultural products and ties among them indicate their degree of similarity. The fact that a set of countries jointly produces different products allows us to infer that some capabilities are common for those countries and pairs of products. Thus, the similarity between a pair of goods derives from the fact that they are commonly produced together. Similarly, we define the agricultural country space network (ACSN) as a network that links countries according to their similarity in the revealed capabilities to produce agricultural products. In this network, nodes are countries, and ties represent the degree of similarity of their agricultural production baskets. Our similarity measure is based on the Jaccard index [48], which has been widely used as a relatedness measure to detect co-occurrences in data sets (see [49][50][51] for a discussion). In the product case, and suppressing time superscripts for simplicity, similarity P between products (k, k ′ ) reads: where V kk ′ = ∑ i y ik y ik ′ is the number of times two different countries are relevant producers of products k and k ′ together, and V k = ∑ i y ik is the total number of countries that are relevant producers of product k. The resulting matrix P is used to define the APSN, where nodes are products and weighted links P kk ′ measure similarity between them.
Following the same strategy, we define the ACSN, where nodes are countries and a link between countries i and i ′ is weighted by the corresponding Jaccard index C ii ′ , which measures similarity between country production baskets. To compute the Jaccard index between countries, we simply replace V kk ′ and V k in equation (3) e. the number of products in which countries i and i ′ together are relevant producers) and Λ i = ∑ k y ik (i.e. the total number of products in which country i is a relevant producer).

Link-weight filtering
Both the APSN and ACSN are highly dense by construction, making it difficult to detect their structural and topological properties. This is because many, possibly noise-induced, links are included. The reason is that most countries tend to produce a relatively wide variety of products, which makes similarity between any pair of products or countries greater than zero. Several filtering techniques have been proposed to deal with high-density complex networks [52]. Here, we assess whether similarity links are statistically significant adopting a null statistical model based on the hypergeometric filter [53,54]. More specifically, we define node strength as the sum of inward or outward link weights of a node. Let s u and s v be the node strength of nodes u and v (either products or countries) and M the sum of node strengths for all the nodes (i.e. the network volume). For simplicity, all node strengths are multiplied by 100 and rounded to the nearest integer. We assess the statistical significance of any given link weight w uv against the statistical benchmark defined by the hypergeometric distribution, i.e. the probability of observing a link weight w uv under the null hypothesis of random co-occurrence-that is to say, row entries are equally probable across column entries given their strength, and vice-versa [55]. This probability reads: .
The corresponding p-value can be written as: The hypergeometric null hypothesis takes directly into account the heterogeneity of countries and products concerning the total intensity of their interactions with other countries or products. For each pair of nodes uv, we then independently evaluate the significance of its link weight w uv according to whether the corresponding p-value is lower than a 1% threshold. Thus, non-significant links are removed (i.e. the entry in the matrix is set to zero), and significant ones are kept with their original weights.

Community structure detection
We detect communities in the APSN and the ACSN with the Louvain algorithm, a widely employed community-detection algorithm for large graphs [56]. The algorithm optimizes a function known as 'modularity' over the possible partitions (or communities) of a network. Modularity aims to capture the degree to which a network can be partitioned in groups of nodes, with higher interaction within groups than between them. The algorithm incorporates a statistical null model (known as the configuration model) to compare the existence of a link with its theoretical probability of existence, which depends on the network's structural attributes. The modularity function compares the withincommunity share of common links in the observed network with its expected value in a null model (i.e. the within-community share of common links occurring by chance provided that some structural constraints given by the observed network are satisfied on average). We use the weighted version of the Louvain algorithm to consider link weights in both the APSN and the ACSN.

Modeling membership in detected communities
To quantitatively explore the determinants of country co-occurrence in the same detected community and, therefore, the emergence of such communities, we run a set of logit cross-section regressions. We regress the probability of country co-occurrence in the same community as a function of a set of covariates aiming at capturing country-pair similarity along geographical, technological, socio-political, and economic dimensions. More formally, we estimate the following model: where ψ ij is a dummy that indicates if a pair of countries i and j belong to the same community; Λ is the logistic function; α is a constant term; λ i and λ j are country fixed effects; and Z is a vector of covariates including: the log of the geographical distance between a pair of countries; the log of the difference in the latitudes of two countries, as a proxy of differences in climate and agroecological zones; a variable indicating if two countries belong to the same geographical region; the log of the difference in countries GDP per capita; the difference in the level of human capital of two countries; the difference in the political systems of a pair of countries; and four additional variables related with agricultural inputs that, for a pair of countries, denote differences in: agricultural labor, agricultural machinery, fertilizers consumption, and irrigated land, all of them expressed over agricultural land and in logarithms (see Supplementary tables SI.6 and SI.7). Except for distance and same region, all variables are in absolute values of the differences.

The Agricultural Product Space Network (APSN)
In the APSN, nodes are products and links represent the RCA-based bipartite country-product matrix's projection into a between-product similarity measure computed with the Jaccard index.  figure SI.3 shows that linkweight distributions scale exponentially, quicker than a log-normal, and are best proxied by either a Gamma or a Weibull density). The strong heterogeneity in similarity scores maps into a remarkable feature of the APSNs: even before validating the links with the hypergeometric filter, they display three or four well-defined communities. In fact, after the hypergeometric validation, we always observe four communities that remain intensively connected and concentrate a great extent of the total density: 76% in 1993 and 78% in 2013 (see additional network statistics in Supplementary table SI.5). This evidence means that the network architecture reveals high modularity after non-significant links have been removed. Figure 1 shows the community structure of the APSN in 2013, after filtering with the hypergeometric filter at the 1% level of significance (Supplementary figure SI.1 shows the APSN in 1993). This analysis allows us to detect whether different products are jointly produced because they share the need for similar natural conditions and capabilities for their production, net of statistical noise.
These four well-defined detected communities of agricultural products are portrayed in different colors in figure 1 and labeled, for illustrative purposes, as: 'Crops and livestock' (blue), 'Vegetables and fruits' (green), 'Tropical fruits and crops' (purple), and 'Special livestock, oils and crops' (orange). These communities connect highly related products. For example, in purple, mainly tropical fruits and crops, such as mangoes, coconuts, plantains, and coffee, appear embedded in a single community. In blue, we observe crops such as wheat and barley, processed crops, and processed livestock products, such as butter and cheese. In green, most products are vegetables, nuts, and fruits from the Mediterranean or sub-tropical regions. Finally, in orange, a smaller community groups products with a low relevance in global food production (quinoa, safflower seeds and oil, camelids and rodents meat, and mate) and a few relevant products in terms of global consumption, such as soybeans. In essence, it is possible to identify similarity in the production needs for the products in the communities. For example, many products in the 'Crops and livestock' community require machinery for extensive production, the 'Tropical fruits and crops' community primarily includes products that require environmental conditions that are present in the tropics, while 'Vegetables and fruits' groups goods that might be produced in different environments.
The composition of the agricultural products communities is relatively stable during the period of twenty-one years. Comparatively, the smaller community changes its composition more deeply in different years, while the other communities maintain their main products during the whole period (see Supplementary figure SI.4). Several of the products that change communities do so in just one year, and those that change most often are those that appear at the community borders. The changes in the communities of products can be explained by changes in the production patterns and country capabilities.
In a nutshell, we observe that products, sharing the need for similar capabilities, group in relatively stable communities within the network.

The Agricultural Country Space Network (ACSN)
We now explore the similarity between country agricultural production baskets described by the ACSN, projecting the RCA-based bipartite country-product matrix into a between-country similarity measure computed with the Jaccard index. Descriptive statistics reveal a very stable topology in the period 1993-2013 (see Supplementary table SI.4). The network is highly connected: it features 169 countries with an average number of links per node ranging between 161.91 in 1993 and 164.78 in 2013. This evidence suggests that most countries are endowed with a set of common capabilities, including environmental resources, that allows them to produce different products simultaneously. For example, all countries share capabilities to produce eggs, some types of meat and dairy products, and even some crops and fruits. However, despite the high node degree, we observe a relatively low level of cohesion: on average, node strength is only 21.46 in 1993 and 22.68 in 2013, which derives from the fact that the link-weight distribution is strongly right-skewed (see Supplementary figure SI.3).
Although the ACSN is fully connected, it exhibits strong modularity, implying the presence of well-defined and stable communities of countries (figure 2). Community membership seems to be related by their geographical closeness, understood as their environmental features, which determine their natural production capabilities. Hence, it is not surprising that there are no remarkable differences between the community structures between 1993 and 2013 (see Supplementary figures SI.2 and SI.4). Before validating the links with the hypergeometric filter, we detect two distinct large-size communities. After the hypergeometric validation, we typically find four communities, and modularity increases. Inner links of these four communities add up to 78% in 1993 and 79% in 2013 of the total density. Note that, in the years 1994, 2002, and 2003 we detect a fifth smaller community composed by a group of countries that detached from the communities 'Subtropical' (yellow), 'Tropical I' (red), and 'Tropical II' (green). In the years in which there are four communities, these countries usually appear as hubs in their borders, for example, Hong Kong (HKG), Bermuda (BMU), and Djibouti (DJI).
As mentioned, country communities in the ACSN seem to be mainly clustered by geographical factors. Countries with tropical weather appear in two different communities. In green, the detected community mainly clusters economies from Africa and Asia, such as India, Tanzania, and Angola. In red, a different community also clusters mostly tropical countries from Latin America and the Caribbean, like Colombia, Panama, Cuba, and Jamaica. Countries from Mediterranean or warm subtropical regions are grouped in a community in yellow. In blue, most countries have a temperate climate and extensive agricultural production systems, such as Australia, Argentina, Canada, the United States, and several Eastern European countries. For illustrative purposes, we name these four communities as: 'Tropical I' (red), 'Tropical II''(green), "Subtropical" (yellow), and "Temperate" (blue). Although these communities could include countries that could hardly be characterized by the type of climate indicated by these names, we use them as broad categories to identify the communities in the analysis.
Interestingly, two of these communities (blue and yellow) include all developed countries and several developing countries with relatively developed agricultural systems, such as Argentina, Uruguay, and Eastern European countries. Instead, the remaining communities (red and green) only cluster less developed or developing countries. This clustering might indicate that not only geographical, climatic, and environmental conditions are relevant determinants of the communities, but also other features (such as technological, economic, political, and institutional capabilities), which can be proxied by the development levels of countries.
Thus, we run a logit regression (equation (6)) to quantitatively explore the determinants of community membership, modeling the probability that two countries belong to the same community as a function of a set of covariates, aiming to capture country-pair similarity along geographical, technological, socio-political, and economic dimensions. Figure 3 shows the estimated marginal effects of the covariates and Supplementary table SI.8 shows the estimation results for different cross-sections.
Estimates suggest that geographical conditions are relevant determinants of the probability p ij that country i and j belong to the same community, which indeed decreases with both geographical distance and the difference in latitudes, and increases if i and j are located in the same geographical region. This result implies that more similar environmental conditions boost the likelihood of belonging to the same community.
Covariates related to economic, socio-political, and technological features of countries statistically impact p ij . Countries tend to be in the same community if they display similar development levels (according to differences in absolute values in gross domestic product per capita (GDP pc) and human capital), similar political systems, and comparable levels of labor, capital, land, and technological endowments in agricultural systems. Therefore, the higher the differences in agricultural inputs, technology, and other endowments in two countries, the less likely they are to be clustered.

Specialization patterns in the APSN and ACSN
We now explore specialization patterns characterizing communities in the agricultural space networks. We aim to ask whether detected communities differ in terms of features related to food supply and its composition and contents. The four detected communities in the APSN are different in terms of Kcal, proteins, and fat content, suggesting that each community's contribution to global food production is also different (table 1). The community 'Crops and livestock' includes 52 products in 1993 and 62 in 2013, and holds a share of 40% and 32% in Kcal, of 48% and 39% in proteins, and 38% and 34% in fats, in 1993 and 2013, respectively. The community 'Tropical fruits and crops' groups 60 products in 1993 and 67 in 2013, and contributes in the same years with 37% and 57% of total Kcal, 26% and 38% of proteins, and 37% and 46% of fats. The community 'Vegetables and fruits' includes 68 products in 1993 and 57 products in 2013. It contributes to only 4% and 5% of total Kcal, 3% and 2% of proteins, and 7% and 10% of fats, in 1993 and 2013. Finally, the smaller community 'Special livestock, oils and crops' includes 38 products in 1993 and 33 products in 2013, contributing with 19% and 6% of Kcal, 23% and 21% of proteins, and 18% and 10% of fats, in 1993 and 2013.
Differences in the contributions to total agricultural production are related to the inner composition of communities in terms of product characteristics. Not surprisingly, the community 'Vegetables and fruits' has a lower contribution in all the measures  considered, compared to communities that include meat, dairy products, or oil crops. Although we can observe changes in the shares and number of products, overall, the communities seem stable, relative to the twenty-one-year period. Figure 4 shows the geographical distribution of agricultural production. Each map displays country production shares of total production-in Kcal-in each of the four detected communities of products in 2013 (see also: Supplementary figures SI.5, SI.6, and SI.7, for maps with shares of fats and proteins).
Typically, most countries have higher shares in one specific product community, i.e. they specialize in the production of closely related products within a community of products. Several countries concentrate almost all their production in one community, particularly in 'Tropical fruits and crops' or 'Crops and livestock' . For example, Malaysia and Ghana with 99%, and Indonesia, and Swaziland with 98% of their total production in the community 'Tropical fruits and crops' . Likewise, some countries have highly concentrated production shares in the community 'Crops In contrast, other countries appear to have more diversified production baskets, distributing their production across products belonging to different communities, such as Italy, Greece, Spain, Argentina, and the United States. The Supplementary file 'SF.Production_measures' provides yearly information on country total production and their shares in each detected product community (measured in Kcal, proteins, and fats).
We now look at the contribution of the four detected communities in the ACSN to world agricultural production (table 2), which is more evenly distributed across the ACSN compared to what we observe in the APSN. However, the 'Temperate' community produces a higher share of agricultural products in Kcal, proteins, and fats. Depending on the year and measure considered, it follows the 'Subtropical' community, while 'Tropical I' and 'Tropical II' have lower shares of agricultural production in most cases. Interestingly, each community's share of Kcal, proteins, and fats not necessarily correlates with their shares in the total population. The 'Temperate' community and 'Tropical I' have more balanced shares of population and agricultural production. Instead, the 'Tropical II' community, with a relatively high share of total population (between 29 and 31%), has relatively low shares of agricultural production.
Overall, the evidence shows that countries concentrate their production on products that require similar environmental conditions and other capabilities. Although countries can produce many products with revealed comparative advantages, the production baskets measured in Kcal, proteins, and fats are unevenly distributed between countries and concentrated in some specific products at the country level. The diversification of a production basket can be evaluated by their variety in terms of products that reveal a comparative advantage. However, even if production baskets are diversified, they can be concentrated in a relatively low number of products (see Supplementary figure SI.8). Of course, diversification is related to technological development. If only comparative advantages derived from natural conditions were relevant, countries would not diversify their production baskets with products that are far from those natural advantages.
The analysis reveals that country specialization patterns are relatively stable, and the network architectures are robust during the whole period (see Supplementary figures SI.9 and SI.10, and Supplementary table SI.9). The left panel of figure 5 shows the correlation between the number of products that reveal a comparative advantage in 1993 and 2013. We observe that countries in the Subtropical and the Temperate communities are mainly those with more variety in their production baskets. For all countries, we observe that there are no dramatic changes between 1993 and 2013. Different factors can explain this stability.
Diversification is a process that takes time in all economic activities. In the case of agriculture and food production, natural conditions might impose additional limitations on the process of diversification. Therefore, it could be possible that the period is too short for reflecting notable changes in specialization patterns.
Moreover, although diets and consumption patterns have changed in the last decades, a few crops explain most of those diets worldwide, and changes have not been even around the world [12]. Additionally, changes in consumption could be satisfied by imports of food instead of by changes in domestic production, which could also explain the stability of production baskets.
However, we observe that some countries that were part of the former Soviet Union are between those that show the relatively more significant changes in their specialization patterns, reflecting the important structural transformations of these countries after 1991.
In the right panel of figure 5, we observe a positive correlation between the number of products  that reveal a comparative advantage and the agricultural gross production value. This association indicates that countries with comparative advantages in a larger number of products, this is a more diversified production basket, are more competitive or at least can achieve higher agricultural production. This evidence is in line with the recent literature that shows that diversification is important for development since a wider variety helps create new capabilities.

Discussion and conclusions
Our analysis highlights the existence of capabilities that derive in different agricultural specialization patterns. Although countries usually specialize in products for which they have comparative advantages, some countries are able to develop capabilities for a large number of not necessarily strongly related products. The variety of the production basket is positively related to agricultural gross production value, indicating that diversification is a driver of agricultural development [57]. These findings agree with the studies that analyze the world product space, showing that specialization patterns and the mix of goods that a country produces have important implications for economic growth [for example, 29,30,34].
Using a comparative-advantage approach to reveal country capabilities and a measure of similarity allow us to better understand how countries employ their capabilities for agricultural production. We also complement existing empirical evidence showing that country agricultural production profiles have become more diversified and more similar in their composition, which can threaten food security [37]. Our analysis is complementary to traditional specialization theories, which estimate revealed comparative advantages using endowments data to compute relative productivity [38,58,59].
Our findings have several implications for our understanding of the complex relationships involving production capabilities, specialization patterns,food systems sustainability, and domestic food supply nutrition content. The results and the analysis can provide useful tools to address the study of different issues related to agricultural production and food systems. In this final section, we include a brief discussion of possible applications of the evidence provided in this paper.
The agricultural product space shows specialization patterns and production capabilities, revealing how countries use their capabilities to follow different diversification trajectories, and allowing us to quantitatively recognize the links and the distance between products in terms of required capabilities. We observe that country revealed capabilities are unevenly distributed between countries and that they shape national food production patterns and the global food system. This evidence can indicate the path needed to upgrade or diversify country agricultural production baskets, react to changes in food demand, or climate change. Similarly, this methodology could be applied to analyze comparative advantages within a country, which can be heterogeneous, providing relevant opportunities for adjustment within countries [36].
Country specialization patterns can also have different degrees of concentration. While some countries are very specialized in one specific group of similar products, other countries have much more diversified production baskets, with different concentration levels among products. The differences in agricultural production are likely to affect the sustainability of food systems and country ability to achieve food security. Our results could be useful to analyze if particular types of specialization patterns can be more vulnerable to production shocks endangering their food security.
Additionally, communities of products differ in terms of their Kcal, proteins, and fat content. Therefore, given their specialization patterns, some countries might be able to produce enough food in terms of a given content, but not necessarily in terms of others. A more detailed analysis of the nutritional content of products in the communities would provide an enhanced picture of the suitability of specialization patterns for the achievement of healthy diets for a country's population.
Food supply is also determined by the balance between exports and imports of food. Thus, an extension of this work should include food trade to have a complete picture of global and national food systems and address other effects of country agricultural capabilities and specialization patterns. For example, countries that are very specialized or concentrated in a few similar products could depend on exports to provide a diverse and healthy diet for their populations. Moreover, different production baskets in terms of composition and concentration could be differently affected by a trade or price shock.
An additional application of our results relates to climate change, which has become a significant concern for its possible effects on agricultural production and food systems in general. The impacts are likely to be heterogeneous across products and countries, and also within countries [58]. Therefore, country specialization patterns and capabilities are relevant to evaluate possible forms of adjustments when facing climate shocks.
More generally, our analysis has implications for analyzing the sustainability of specialization patterns in diets, biodiversity, and resilience. It might eventually contribute to policies seeking to achieve global food security and more a sustainable development of agriculture by providing inputs to understand specialization patterns of agricultural production and its dynamics.