Development opportunities: economic complexity as a driver for São Paulo

The study analyzes the growth and development opportunities for cities in the Brazilian state of São Paulo, considering economic complexity. Our hypothesis is that the structural heterogeneity in Brazil, and in São Paulo, creates regional inequality. Therefore, cities have different development trajectories depending on their current economic capacities and productive structures. The level of economic complexity is the measurement of an economy’s ability to produce goods with a higher (or lower) level of embedded knowledge. Applying this theory to cities in the state of São Paulo indicates substantially unequal levels of complexity in the state territory, with the best indicators centered around cities such as São Paulo and Campinas. A correlation was found between the municipalities’ current level of complexity, their levels of production, and complexity outlook. Thus, based on the opportunities presented for each municipality and their engagement in this transformation process, cities will develop at different speeds and inequalities will emerge.


Introduction
The concept of development is comprehensive and open to diverse interpretations. According to Bresser-Pereira (2006), development is a historical process present in capitalist economies that leads to increased productivity and wages, contributing to a better standard of living in society. Thus, underdeveloped countries are those with barriers that must be overcome to achieve sustainable growth, with increasing productivity and competitiveness in the national and international markets. In line with this view, the construction of the developmental state must adopt the strategy of industrialization and technological advancement (Ianoni, 2014).
According to the economic complexity theory, the central element for the development of a country is its level of complexity, defined as the measurement of the capacity of an economy to produce goods with a higher (or lower) level of embedded knowledge and, therefore, of greater added value, making the economy that produces them more (or less) complex (Hidalgo et al., 2007). Thus, development takes place through the strategy of changing the country's export agenda, in order to obtain a more complex basket of goods, allowing for sustainable growth and with less inequality (Hartmann, 2017).
The magnitude of economic development cannot be expressed within the theory of economic complexity, which was chosen due to its high explanatory power regarding other important development variables such as economic growth, inequality, and technological capabilities. Although unable to cover all the implications and appropriate interpretations of the theory of economic development, it fits the perspective that the fundamental tool for social and economic development is knowledge, and that knowledge is necessary to transform the productive structure of any location (Ferrer, 2010).
Furthermore, it is important to note that the theory of economic complexity is designed originally for international comparisons and does not capture the possible heterogeneities within any given country (Britto et al., 2018). Some recent studies have proposed alternatives to the framework of economic complexity at subnational levels.
Considering international studies, we highlight the work of Pérez-Balsalobre, Llano Verduras, Diaz-Lanchas (2019), which adapts the complexity index to subnational levels in a way previously unseen, incorporating interprovincial trade in Spain in the index calculation. The results show that the proposed indicator contributes to predicting economic growth.
As for related research carried out nationally, there are a number of regional studies based mainly on indicators available on the Dataviva platform (2021). Salles et al. (2018) analyze the economic complexity of Brazilian states between 2002 and 2014, focusing on Minas Gerais, the third largest state economy in the country. The research reveals that the state is among those with the worst results in terms of economic sophistication, caught in a low-complexity trap; this demands intense collaboration between the public and private sectors so that they can identify and invest in activities that contribute to economic sophistication.
Morán, Mercedes and Pinho (2019) analyze the evolution of the economic complexity of Brazilian regions based on Dataviva (2021), highlighting the process of deindustrialization in the country. They also highlight the regression of the export basket in terms of the technological intensity of the products (industrial regressive specialization).
Also based on data from Dataviva, Garcez, Arend and Giovanin (2019) analyze the degree of complexity of the main products exported by the mesoregions in the state of Santa Catarina, using the rest of the country as a benchmark. The results point to a positive correlation between economic complexity and the human development-income index, where it is closer to that observed in São Paulo than in other regions. The work also confirms that the country's productive structure has low diversity and complexity, in addition to high heterogeneity, even in states with greater economic complexity.
It is also worth highlighting the work of Herrera, Strauch and Bruno (2019), in which the authors apply an adapted version of the complexity index to Brazilian regions to understand the process of deindustrialization and regional development in Brazil during the period 1998-2017. The results highlight the near stagnation of complexity at the regional level and, consequently, at the country level.
Regarding the studies on municipal cuts, it is worth highlighting the work of Freitas and Paiva (2015). The authors use the product space on foreign trade data of Brazilian municipalities to analyze their exports, the pattern of productive sophistication, and regional inequality in the country from 2002 to 2014. The results corroborate the growing concentration in commodity exports and consequent reduction in the share of industrialized products. Freitas, Britto and Amaral (2019) analyze the relationship between the productive structure, employment generation and urban agglomerations, based on the hypothesis that larger cities have positive externalities that favor increases in the complexity of their structure, either due to a greater diversity of skills and abilities in its population and potential workforce, or because of the greater supply of these, which favors specialization and productive diversification. Traditional indexes of economic complexity (Hidalgo;Hausmann, 2009) are adapted using formal employment data for the period 2010-2015, thus proposing a sectoral complexity index. The results validate the research hypothesis.
Despite these efforts, studies at the subnational level are still scarce, especially regarding municipal analyses, which led to the development of this research. Based on this and the particular characteristics of the Brazilian regions, this work describes the current development scenario concerning the state of São Paulo municipalities, employing the economic complexity theory. In this context, the development scenario is understood as: a) the presentation of the São Paulo state's current situation within the economic complexity parameters and b) a pragmatic discussion of possible directions and opportunities for development in the state and its municipalities, also within the economic complexity context.
Ultimately, the question that we seek to answer is: how can economic development be stimulated in São Paulo municipalities based on their current degree of economic complexity? Thus, in addition to elucidating possible success cases, the work seeks to analyze development opportunities in each municipality and the region as a whole. Therefore, the focus is to understand future possibilities, while considering the conditions that gave rise to the current structure.
The study is presented in three sections. The first formally presents the theory of economic complexity, its concepts, variables, indexes, and theoretical and empirical implications. The second part describes the methodology employed. The data sources used, and their scope is also detailed in this section. The third part presents the results obtained by comparing them with the literature, describing the current development scenario, and returning to the guiding question of this work. The conclusion presents some general observations and final considerations.
1 Theory of economic complexity and development

Structuralism and economic complexity
One of the origins of developmental theories is the ECLAC concept established by Prebisch (1950) and Furtado (1983), who analyze economic development from a historical-structural point-ofview. This interpretation sees world capitalism as a system of the Center-Periphery type, and as a result of this system, a condition of underdevelopment is established in Latin America. The authors emphasize that this condition is continuously reinforced over time and prevents any scenario of international convergence due to its structural heterogeneity (Bielschowsky, 2011apud Prebisch, 2011. The Theory of Economic Complexity is directly related to the reality of different income levels and international development. Similar to the ECLAC theory, it also considers any analysis of the degree of development of an economy considering aggregate values for international trade as inaccurate, and that its allocation of factors would be decisive for the economic development pattern (Hidalgo;Hausmann, 2009). The center of the complexity theory bases the analysis of development on the degree of sophistication of its economy, measured by the qualitative criteria of its export agenda, which approximates existing knowledge in the economy (Gala, 2018).
In both cases, the theoretical approach of structuralism is considered. It is understood that in the economy there are structures that are not observable per se but that affect society, generating observable social and economic consequences (Blankenburg;Palma;Tregenna, 2008). Regarding economic complexity, conclusions can be made about the economic structure and the knowledge embedded in it (unobservable) from its exports (observables). This ability to embed knowledge in products in a way that is superior to other countries is a demonstration of a more complex economic structure and, consequently, more developed Klinger, 2007). In other words, it is stated that the development and economic prosperity of a country are connected to what a country exports and not simply to the quantity of exports .
Thus, to achieve economic development, it is necessary for the economy to produce goods and services that generate added value for society. This production requires a set of techniques and other intangible resources that are difficult to access and reproduce across economies. These techniques and resources are termed economic capabilities and are connected to each other. More complex products require a larger, as well as more sophisticated, set of skills. These capacities are used in various production processes, creating opportunities for development for holders of complex and diverse capabilities, or barriers to countries with scarce skills (Hausmann et al., 2011;Hidalgo;Hausmann, 2009;Hidalgo et al., 2007).
This system is illustrated through a hypothetical case in Figure 1, where the lines between three countries and three capabilities (( 1 , 2 , 3 and 1 , 2 , 3 , respectively), and the lines between capabilities and products ( 1 , 2 , 3 e 1 , 2 , 3 , respectively), produce a tripartite network. This network highlights the interdependence between these elements and explains the intermediary step of the relationshipdirect in appearancebetween countries and their products (bipartite network of countries producing products).
The tripartite network indicates that the process for a country to start producing a new product is more complicated as the country does not have the capacity to produce the product in question. In the example illustrated, the country 3 produces fewer products than the other two because it has a lower capacity (capacity 3 ), thus it is less complex since it has fewer possibilities to embed knowledge in its products. In the bipartite network of countries and products to the left of Figure 1, the products then become approximations of the structural reality and, when analyzed statistically, allow us to understand the relationships between them and the countries that produce them. Performing an empirical export-based analysis to determine a country's economic complexity may be suboptimal due to the fact that different levels of international production heterogeneity (Lederman; Maloney, 2012) and international outsourcing (Jankowska et al., 2012) are not evaluated in greater depth. In addition, the national heterogeneity is not captured by international complexity indicators (Britto et al., 2018). This gap is one of the motivations behind the efforts of the present study to apply these indicators to the subnational level, allowing for an even broader analysis. Thus, the limits imposed by the economic complexity analysis method do not invalidate its results.

Complexity variables and the product space
To assess the capacity of an economy to embed knowledge in products, we use two complexity indicators based on the products exported by each economy. More specifically, the analysis is based on Revealed Comparative Advantages (RCA) (BALASSA, 1965), allowing us to identify which countries excel in the process of materializing knowledge and using their capabilities in the manufacture of their exported products.
Algebraically, the country and product index is given by: where Σ is the share of exports of the product p of country c in total exports of the particular product and Σ Σ , is the share of total exports of the country in total exports of all products.
From the RCA, the concepts of ubiquity and diversity, respectively, are laid out. The ubiquity is the "degree of omnipresence" of the production of each product, whereas diversity is an indicator complementary to the first, identifying a larger number of capabilities in an economy (Hausmann et al., 2011).
Formally, the ubiquity and diversity indexes for a given moment are defined as (Hidalgo;Hausmann, 2009 where U denotes ubiquity and D denotes diversity; N = 1 if the country c exports the product p with RCA in year t, and N = 0 otherwise. Thus, the greater the diversification of the country, the greater its productive sophistication. For products, the lower the ubiquity of the good, the greater the need for differentiated knowledge to produce it, indicating that the economies that do so have more complex capabilities. Using these two indicators, we finally arrived at the Product Complexity Index (PCI) and the Economic Complexity Index (ECI) (HIDALGO and HAUSMANN, 2009). Formally, the two indices for a given moment are represented by equations 4 and 5, respectively: where U denotes ubiquity and D denotes diversity; N = 1 if the country c exports the product p with RCA in year t, and N = 0 otherwise; n is the number of iterations to estimate such values in a convergence process in the resolution of this linear system.
The ECI in its original form only comprises the calculation for national territorial units. To apply economic complexity theory to sub-national levels, we use the Adapted Economic Complexity Index (ICEa) (FREITAS e PAIVA, 2015;SALLES et al., 2017). Algebraically we have: where is the Adapted Economic Complexity Index of location l; is the export of product p in location l; is the export of product p in Brazil; is the revealed comparative advantage of product p at location l and is the complexity index of product p calculated at the international level.
To assess the similarity (or difference) between the capacities needed for the production of goods, the concept of proximity is used. The proximity between two products is given by the probability of a country starting to export a good with a comparative advantage, given that it already has RCA in another one. It is given formally as (Hausmann et al., 2011): where , ′, is the proximity index between two products in a given year, P is the conditional probability, and RCA is the revealed comparative advantage of a country c for each pair of products and ′. Figure 2 illustrates the network of connections between the products resulting from the aggregation of each proximity value. This diagram, known as Product Space, shows the most relevant products in international exchanges; the size of the spheres is proportional to the PCI of each good, the size of the rods is also proportional to the proximity between each pair of products, and the colors illustrate the different sectors of the economy. The Products Space is an aggregation of the product-product analysis via proximity, however, from it, we can analyze an economy-product relationship through the distance indicator. Distance is an indicator of how similar a country's productive capabilities are to those needed for a particular product that it does not yet produce. Formally, the distance calculation is given by (Hausmann et al., 2011): where M* is a binary matrix over RCA, such that for products with a comparative advantage that the locality does not export, the value is equal to 0 and 1 otherwise, and is the proximity between each pair of products and ′ analyzed.
In addition to analyses at the product level considering the current economic structure, it is important to analyze a country's development potential, as it incorporates a dynamic element into the analysis. The Complexity Outlook Index, or COI, is used as an approximation of the location's potential for complexity gain. According to Hausmann et al. (2014), COI is a predictive indicator of changes in the level of complexity of a location that shows how well connected that location is in the Product Space. It is presented algebraically as (Hausmann et al., 2011): where the distance of a certain region for each of the products with a comparative advantage that it does not export, M*, as already mentioned, is a binary matrix over the RCA which is 0 when RCA is greater than 1, and 1 otherwise; PCI is the Product Complexity Index.
Additionally, it is necessary to disaggregate the COI to analyze the individual potential complexity gains in the sectors or industries of a location. The values found are indicators of the combination of degree of effort and complexity gain for each product from the perspective of a location. This variable is called Individual Gain of Complexity (GIC); and is given algebraically as: where the distance of a certain region for each of the products with a comparative advantage that it does not export, M*, is a binary variable on the RCA, which is 0 if RCA is greater than 1, and 1 otherwise; PCI is the Product Complexity Index.

Methodology
The objective of this work is to study the economic complexity variables related to the state of São Paulo. As mentioned earlier, there are two reasons for the choice of municipalities in São Paulo: their socioeconomic importance in relation to Brazil and the panorama of economic complexity found in the state in previous studies, particularly in Salles et al. (2017).
Thus, the research aims to shed light on the question: how can the economic development of São Paulo municipalities be stimulated based on their current degree of economic complexity?
To achieve this objective, the concepts and variables of economic complexity were used. First, the ICEa and the COI were calculated for the municipalities to identify the locations with the greatest potential for economic development and their regional differences. This was followed by the identification of the correlations between GDP per capita and the ECI to validate the existing relationship at the global as well as municipal level. Finally, the municipalities with the greatest potential for complexity were presented and the industrial sectors with the greatest potential for gain in complexity were identified individually.
The data source on exports from Brazilian municipalities is the SECEX (Foreign Trade Secretariat) portal. The data allowed us to calculate the complexity indices of 379 of the 645 municipalities in 2017.
The period of analysis is delimited between 1997 and 2017 due to the limited availability of export data with municipal granularity between these two years. The focus of the analysis was on the 2017 results, precisely because they are the most recent available data.
Data from the UN COMTRADE (United Nations International Trade Statistics Database) was used to analyze the international scenario. Export data used in both cases were disaggregated according to the Harmonized Commodity Description and Coding System to four digits (HS4). Additionally, we used the Economic Complexity Observatory's PCI calculations (Simões; Hidalgo, 2011) through its package for python, ecomplexity.
The cartographic data come from georeferenced files provided by NEREUS (USP's Regional and Urban Economics Nucleus). For macro-economic variables, we employed the data from SEADE (State Data Analysis System). Table 1 provides a descriptive analysis of the economic complexity, complexity outlook, and diversity indexes for the São Paulo and world municipalities for the year 2017. Overall, inequality in the São Paulo municipalities is greater than in the world municipalities when considering the complexity of the current and potential productive structure (higher standard deviations for ICEa and COI), but the range of products with RCA is smaller and they are closer to each other when comparing the municipalities to the international scenario.

Results analysis
The organization of global value chains appears to be one of the causes of the disparities in the distributions of ECI and ICEa. By increasing productive capacities locally in a country, the national productive level moves closer to its international counterpart, while at subnational levels the disparity grows. The structural heterogeneity of peripheral countries is aggravated in the context of globalization and production hubs created by global value chains (Daher;Oliveira, 2017).
The decile analysis of the distribution of complexity indicators for the state of São Paulo indicates a large concentration of values close to or less than zero, jumping to disproportionately high values in the last two deciles. This indicates that the greatest values of both the ICEA and the COI are concentrated in a few cities. In other words, as well as an already alarming scenario of disparities in the current productive structures, the hypothesis raised is that development perspectives are more exclusive within the state of São Paulo when compared to the international scenario.
The highest concentration of municipalities is also seen to occur in the scenario of low ICEa and COI. This scenario is portrayed as the low complexity trap, and, in addition to national cases, it is present at subnational levels such as in the province of Chiappas in Mexico (Hausmann, 2015) and Minas Gerais in Brazil (Salles et al., 2017).
The diversity indicators of the municipalities are more highly concentrated between 0 and 20 products, indicating lower levels of diversity when compared to the international framework. In addition, the highest values for the state are close to 350, while there are countries with indexes above 500. Therefore, municipalities seem to have lower levels of complexity when compared to countries, and their disparities are more evident.

Analysis of complexity variables
To infer possible relationships between the variables, the Ordinary Least Squares (OLS) method was used in the construction of Simple Linear Regression (SLR) models. At first, the exercise was performed to evaluate the correlation between ICEA and IOC and compares the results with the international scene. Table 2 presents the COI~ICEa, ICEa~diversity, and COI~diversity regressions, with the complexity indicators as dependent and independent variables respectively in each model. The first model corroborates the hypothesis given in the previous section that ICEa and COI are correlated, explaining the current disparity and, above all, the tendency to worsen. Since the coefficients are statistically relevant, and with a high R², the first model clashes with the literature in which the highest levels of COI are found in the intermediate levels of ECI, leading to a weak and dispersed relationship between the two indicators (Hausmann et al., 2011).
In the second model, the strong relationship between ICEa and diversity is in accordance with the literature since locations with greater diversity tend to also aggregate less ubiquitous products (Hidalgo et al., 2007).
Finally, the result found in the third model provides evidence that even the most diversified municipalities can seek greater diversification and achieve better levels of complexity (transforming COI into ICEa). This result reinforces the idea that, contrary to the international scenario, even the most complex municipalities in the state still have room to develop. In other words, the most complex municipalities in São Paulo are still considered underdeveloped. Table 3 shows a summary of the main results from the linear models for the variables related to GDP, using the ICEa as an independent and explanatory variable. GDP per capita, GDP in the industrial sector, and GDP in the agricultural sector are considered and correlations will be explained in the section. Even with a lower R² than expected when compared to the first international scenario model (Hausmann et al., 2011), the ICEa proves to be a statistically relevant factor in determining the GDP per capita.

Analysis of macroeconomic variables
The results of this first model highlight the practical inability to assess a subnational location with a purely export-based index (Jankowska et al., 2012). Thus, considering the large local consumer market in Brazil and its low level of openness, some subnational locations can develop technologically even without necessarily having comparative advantages at the international level (Britto et al., 2018).
Because of this, recent attempts have been made to incorporate intranational trade into the complexity metric. One study carried out in the Spanish provinces obtained promising results by adding the calculation of intra-and inter-regional trade, reaching an R² greater than 0.4 for the total economic complexity in relation to GDP per capita (Pérez-Balsalobre; Llano Verduras; Diaz-Lanchas, 2019).
The results of the second and third models reinforce the importance of the industrial sector as an economic growth lever. However, the structural heterogeneity existing in the economy implies that the industrialization process does not necessarily lead to a process of economic development (Daher;Oliveira, 2017). The incentive or investment in new industrial sectors can be guided by the Product Space so that the level of complexity in the location does in fact increase during the process.

Cartographic analysis
Figures 3, 4, and 5 show the distribution of Diversity, ICEa, and COI respectively for the municipalities in the state of São Paulo for the year 2017. The objective is to investigate regional inequalities and analyze the productive heterogeneity present in the state, which is not apparent in aggregated data. All figures use the same color scale, with the blue areas marking the lowest indexes and the red the highest. Blank dots are municipalities with no RCA, so there is no calculation of any indicator for these municipalities.   Together, the three figures corroborate the results obtained in the econometric analysis in section 4.2 .1 given that the regions in red are the same for all three indicators. The high degree of correlation found in the models, and reinforced in cartographic projections, indicates that predictions of an increase in economic inequality also have a strong regional component.
The most promising indicators are concentrated in the Metropolitan Regions of São Paulo (RMSP), Campinas (RMC) and Vale do Paraíba, while the western region of the state seems to face a low complexity trapmany municipalities have no RCA. These examples highlight the spatial factor of the productive heterogeneity in the state of São Paulo.
As stated in the previous sections, there are relatively few empirical studies carried out at a regional level, as it is an area that still requires research at a national and international level. Still, it is worth noting that the results found in the figures above are in line with the work of Freitas and Paiva (2015) as well as with the study carried out by Salles et al. (2018). Such studies also emphasize regional inequality of economic complexity, concentrated in the southern and southeastern regions. Taking a more focused approach, it is possible to see that even within these prominent regions there are relevant disparities. The results show divergences in magnitude 1 , but the groups of municipalities (1) Freitas and Paiva (2015), among others, provide updated results until 2014, making it possible to compare the ICEa values for some municipalities in the state such as São Bernardo do Campo and Guarulhos. The complexity indicators given in the study mentioned are, respectively, 10.868 and 8,356, while in the calculations performed in this work, they are 41,038 and 36.778. In comparison with the that concentrate the highest levels of complexity (RM SP, RMC, and Vale do Paraíba) are the same in both studies. Therefore, the validity of the analysis as a parameter of economic development and as a way of illustrating current and future economic inequality according to their development opportunities is reinforced.
From the figures presented, it is evident that levels of complexity are affected by geographic components. These factors include proximity to other locations with high levels of complexity and greater historical conditions, helping to determine the possibilities of new productive capacities and the economic development potential of a municipality.

Opportunities at the municipal level
Considering the impossibility to analyze the 379 municipalities individually in this study, samples were taken from the municipalities to represent the two extremes in relation to the COI. Table  5 presents the municipalities with the 10 best and worst rankings of COIs in the state, as well as their ICEa values, diversity, and the position they occupy in the ranking of each indicator.  The capital of the São Paulo state appears in first place in the COI ranking, followed closely by São Bernardo do Campo (Metropolitan Region of São Paulo) and São José dos Campos (Vale do Paraíba). Most municipalities in the top ten are cities historically recognized for their industrial activity. All of them have forecasts far above the state average, at between three and seven standard deviations above the average. São José dos Campos stands out with a diversity level that is below the average of the first group. Jundiaí, on the other hand, despite exporting approximately three times more goods with RCA than São José dos Campos, appears in 10th in terms of COI. Thus, we illustrate how the correlation between diversity and COI is always conditioned to the qualitative factor of products with RCA.
It also reinforces the strong correlation between ICEa and COI shown in Table 4. Eight of the ten municipalities with the best COI are also among the top ten ICEa and are between two and fifteen standard deviations above the average ICEa. This relationship reinforces how the current economic structure tends to highlight differences in GDP between municipalities.
The municipalities in the second group are those that have the worst outlook in terms of economic complexity, therefore, they are in less privileged positions in the Product Space. These municipalities are less likely to receive investments and are more conditioned by economic stagnation.
There are some common characteristics between these municipalities such as the number of inhabitants, human development, and ICEa. Among the ten municipalities, nine have less than 60 thousand inhabitants -Cubatão has approximately 130 thousand. Another common point is that all ten cities have a HDI above 0.7, which is considered high, while seven of the ten cities appear below the 300th position in the ICEa ranking and are considered less privileged.
In general, the profile of municipalities with the worst COI indexes is of exporters of products directly or indirectly linked to the agricultural sector and with low diversity. The 50 municipalities with the worst COIs have an average of 6 products with RCA, while the average diversity of the 50 largest COIs is approximately 99 goods. The same scenario occurs in the ICEa ranking, with average diversity values of 9 and 98 for the 50 municipalities with the worst and best placements in the ranking, respectively.
The analysis of historical evolution from the ICEa and COI of the municipalities indicates that the municipalities capture opportunities in different ways. Some municipalities, for example, are more adept at converting their complexity potential into reality through advances in the Product Space.
The municipalities in the second group, with the ten smallest COIs in the state, have little mobility compared to the others and their indexes show little variation between 1997 and 2017. Cubatão, on the other hand, has undergone changes in the 20 years of analysis, as its COI dropped from 0.82 in 1997 to -1.46 in 2017 (-170%), despite its diversity level remaining virtually unchanged throughout the entire period.
The case of Cubatão demonstrates the dynamism of relations of production, trade, and, above all, innovation. Thus, high levels of complexity require constant efforts to develop new technologies and convert potential into acquired capabilities. If a location cannot keep up with the pace of global transformation, as is the case in most municipalities in São Paulo, including Cubatão, its current level of complexity and, above all, its outlook, tends to drop.

Product level opportunities
To understand in which productive sectors the main opportunities for complexity gain are located, the products (HS4) with a positive GIC in at least one municipality in the state of São Paulo at the lowest level of granularity, HS2, were computed. Table 5 contains the category of products (at the HS2 level), how often the products in this category with positive GIC appear in the municipalities in São Paulo, and the average GIC of these products in the municipalities. The two values help to understand which product category has a greater individual complexity gain (GIC), as well as the average complexity gain of this category for the municipalities. The auto mechanic industry (SH2: 84, 85, and 87) is widely present in the list of positive GICs of the municipalities, and this can benefit the state more generally. Furthermore, the average GIC of these sectors is above the average of the sectors presented. However, the sectors with higher GICs, the chemical industry (SH2: 29) and mineral inputs (SH2: 72), represent the best balance between the distance of the municipalities' capacities and the PCI of the sector's products.
Considering the economic complexity theory, this demonstration highlights these two sectors as the main candidates for investments in municipalities, as they present more advanced production capabilities, and higher PCIs. In general, this aggregate analysis is an indicator of the direction that the economy of São Paulo and its economic structures can take, considering the theory of economic complexity framework.
It is necessary, however, to recognize two weak points in this generalized analysis. First, the GIC seeks to understand the direct complexity gain, without considering the new distribution of the municipality's products in the Product Space. The second concerns the possibility of competition between two municipalities in the same sector. It is not possible to state that all municipalities that have the same product with a positive GIC can, at the same time, have RCA in this product and benefit from its complexity gain.
It is also possible to analyze the individual municipalities in terms of their GICs, and understand the direction that their economic structures can take. As an example of two extremes, we can consider São Paulo and Cubatão.
The city of São Paulo alone has 421 products that it could start producing and obtain gains in complexity -it also has 146 products with a negative GIC. Its position in the Product Space allows it to take different paths: towards new products that add positively to its ICEa, as in the case of the good with the largest GIC in the state; or opt for products of very low complexity and equally close to its production structure, since 8 of the 10 smallest GICs in the state belong to the city of São Paulo.
On the opposite side of the COI ranking of the municipalities we have Cubatão, which despite presenting the lowest COI (-1.46), only 2 of its 9 products with GIC are negative. The lack of access to more complex products, due to a lock-in created in its productive structure which is specialized in the oil-related sectors, generates a lack of positive opportunities for the city. Added to this, the product HS4: 2601 is extremely close to the products exported by the municipality, and has a PCI of -1.991, lowering Cubatão's overall COI value.
It is interesting to note that this same product had a positive index in 2001, but as the dynamics of international trade changed, the product became less important in terms of complexity. This is one of several cases of technological stagnation in the municipalities' productive structures.
In the case of Cubatão, the analysis of investment orientation is of paramount importance since the wrong choice can have disastrous consequences for the local economy. The municipality will most likely have better economic indicators if it is able to focus on the first product (HS2: 7224), characterized by semi-manufactured goods linked to the steel industry.
Given the scenario and the examples provided, it is evident that the allocation of resources and effort put into more strategic areas is a must and needs to be well thought through. These incentives and efforts result in technologically more advanced and complex productive structures, thus conditioning the state and its municipalities for better levels of economic growth and development.

Final considerations
The economic complexity theory assumes that everything we produce in the world is the result of human capacity to embed knowledge and meaning in matter via the production process. This means that two products can contain the same number of atoms or be made of the same raw materials and still have completely different values. In a way, Economic Complexity can be used to understand the wealth of nations in the 21st century.
The capabilities to embed knowledge are the key factors that allow Switzerland to produce a Rolex, Germany to produce a unique product, or Brazil to produce more than 100 million tons of soybeans per year. And it is these same structural capabilities that help to explain the different conditions of each country, from its economic growth to its inequality levels. It is therefore crucial to understand how we can make the Brazilian economic structure, in addition to the one in São Paulo, more sophisticated and aligned with the dynamic processes of production, trade, and innovation.
This work helps to better understand how the theory of economic complexity can be applied to municipalities. Therefore, to answer the driving question, we reached the conclusion that, from the perception of economic complexity, sectors such as the auto mechanics and chemical industries can be exploited strategically by municipalities to promote growth and development.
More in-depth discussions are undoubtedly required to construct a more accurate adaptation of international models at the municipal level to better understand their interrelationships and improve its application. However, it is undeniable that the complexity theory supports the analysis of the productive structure of municipalities.
Among the most important points of the results is the spatial distribution of the São Paulo production structure, which shows territorial disparities and trends of increasing inequality. It is in this scenario that identifying opportunities for municipalities based on the complexity theory becomes even more important.
For each municipality, a basket of products was identified that could increase its level of complexity and that require technical capabilities that already exist or are similar to those existent in the locality. It is understood that São Paulo municipalities have a universal industrial potential, with particular opportunities in specific cities that could further boost the state's local and general levels.
Again, caution is required when working with these scenarios, since it is indisputable that some municipalities are more likely and able than others to adopt these new products or segments in their economies. Additionally, the possibility of municipalities competing within the same sector and their capacity to finance the necessary investments may also impede the spread of development throughout the state.
Finally, conscious of the limitations that the use of the theory of economic complexity imposes, the efforts undertaken in this study aim to help guide data-driven decisions and actions, particularly public policy. The pragmatism used here supports decisions and prioritization of investments, subsidies, credit concessions, among other policies that seek economic and technological development. The application of the complexity theory reaffirms that, historically, all countries invariably required intensive government support to achieve economic growth, and the Brazilian case is no different.