Technology and the Dynamics of Comparative Advantage

This paper explores how trade affects innovation in a two&#8208;country, two&#8208;good, two&#8208;factor Heckscher&#8211;Ohlin model with heterogeneous firms. Trade openness induces an increase in process innovation in both industries. The increase is stronger in the comparative advantage industry. Trade openness boosts prospective entrants' profits in that industry, which leads to further increases in product innovation. Trade liberalization generates a different relative impact on innovation across industries, depending on trade costs. When they are high (low), it increases process innovation relatively more in the comparative advantage (disadvantage) industry, leading to TFP divergence (convergence) across industries.


| IN TRO DUCT IO N
Innovation, a key determinant of productivity growth, varies substantially across industries and across firms within the same industry (Klette & Kortum, 2004;Doraszelski & Jaumandreu, 2013). Since the seminal work by Cohen and Klepper (1996), many studies have been dedicated to understanding why firms within the same industry exhibit very different innovation performance (Lentz & Mortensen, 2008;Akcigit & Kerr, 2017). A number of investigations based on firm heterogeneity have shown either theoretically or empirically that trade openness and trade liberalization policies could contribute to fostering the innovation performance of the most productive firms (Atkeson & Burstein, 2010;Aw, Roberts, & Xu, 2011;Bloom, Draca, & Van Reenen, 2016). However, R&D activities tend also to vary substantially across industries even within a very narrow degree of industrial classification. In this paper we investigate how trade and more precisely, the factor content of trade, could account for the heterogeneity in R&D activities both within and across industries.
In order to assess the importance of trade determinants on firms' R&D performance we explore the relationship between different measures of R&D activities across U.S. manufacturing industries and the Balassa Index of revealed comparative advantage, a standard measure used in international trade to identify those industries in which a country reveals a comparative advantage. 1 To construct the Balassa Index for the U.S. we rely on bilateral trade data obtained from the BACI trade database for the year 2005. Figures 1 to 3 reveal a striking feature: a firm's innovative performance is stronger in the industries in which the economy reveals a comparative advantage. Figure 1 shows the relationship between the Balassa Index and R&D intensities at a six-digit NAICS classification code extracted from the ORBIS database and provided by Nunn and Trefler (2013). It can be seen that there is a strong correlation between both variables suggesting that the higher the U.S. index of revealed comparative advantage, the larger R&D intensities are. The ordinary least squares (OLS) regression between both variables reveals that there is a positive and significant relationship between the variables. More precisely, an increase of one standard deviation in the Balassa Index is associated with an increase in the industry R&D intensity of one-fifth of its standard deviation. The relationship is not only significant but sizeable. 2 Figures 2 and 3 show the correlations between the Balassa Index and alternative measures of R&D activities at a three-digit NAICS code obtained from the Business and R&D survey conducted by the National Science Foundation. Both reveal the same message: there is a strong positive correlation between the U.S. measure of revealed comparative advantage and the share of firms engaged in product and process innovation. These figures suggest that common determinants of the U.S. manufacturing industry comparative advantage could be behind the substantial heterogeneity observed in R&D activities across industries. In this paper we build a two-country, two-good, two-factor Heckscher-Ohlin (H-O) model of trade with firm heterogeneity in which firms are allowed to undertake investments in product innovation (the creation of new varieties by entrants) and process innovation (technology upgrading by incumbent firms). In this context, the impact of trade openness on both product and process innovation is explored: first, considering a scenario in which countries can trade but trade is costless, and second, considering a scenario in which countries can still trade but firms bear a fixed and a variable trade cost. In the latter, we undertake two exercises, one in which the economies move from autarky to free trade, where free trade does not involve variable trade costs (but positive fixed costs) and another one in which we explore the impact of trade liberalization (a reduction in variable trade costs).
Introducing firm heterogeneity allows us to account for basic stylized facts on exporting and innovating behavior across firms within an industry. Furthermore, we discover that introducing firm heterogeneity together with fixed and variable trade costs in this framework, allows us to account for the evidence mentioned above. While a movement from autarky to costless trade will not alter the proportion of firms engaging in process innovation, a movement from autarky to free trade will increase the proportion of firms undertaking process innovation in both industries, although the effect will be stronger in the comparative advantage industry. A movement from autarky to free trade expands the profit opportunities of the most productive firms in both industries. This increases the demand for both production factors, increasing their real factor remuneration. As a consequence of this, the least productive firms see their profits reduced and they are not able to survive. The combination of a larger market size and a reallocation of market shares away from the least productive firms, towards the most productive ones, induces a larger proportion of firms to undertake process innovation in both industries. Interestingly, this effect is not homogeneous across industries and it is stronger in the industry in which the country reveals a comparative advantage of the (H-O) type. This results from the fact that the expansion in profit opportunities induced by trade openness is larger in that industry since domestic producers are able to offer their varieties relatively cheap with respect to their foreign counterparts. This increases the expected profits of prospective entrants, which increases product innovation in that industry. As a consequence, the relative demand for the abundant factor rises and this has a positive impact on relative factor remuneration. The increase in the relative factor remuneration has a negative impact on the profits of the domestic nonexporting firms, making survival even more difficult in this industry. The combination of a business stealing effect in the foreign country and a stronger reallocation effect  induces a larger proportion of firms to upgrade their technology in that industry. Consequently trade induces a larger increase in innovation (both product and process innovation) in the comparative advantage industry. This is consistent with the figures discussed above. 3 A further section of the paper explores the impact of trade liberalization by considering a reduction in variable trade costs when both industries are opened to trade. The analysis establishes a nonmonotonic relationship between the level of trade costs and the evolution of the relative industry weighted average productivity. When trade costs are high, a reduction in trade costs increases technology upgrading and toughens selection relatively more in the comparative advantage industry, inducing total factor productivity (TFP) divergence across sectors. However, if the trade costs are low enough a reduction in trade barriers increases technology upgrading and toughens selection relatively more in the comparative disadvantage industry leading to TFP convergence across industries. The main reason behind this result lies in the nonlinear effect that trade liberalization has on relative factor remuneration caused by larger entry in the comparative advantage industry. Taking the home country as the skilledlabor abundant country, as trade costs are reduced, skilled labor becomes relatively more expensive. This increases the relative cost of innovation and decreases the relative attractiveness of domestic varieties in the foreign market in the industry that uses intensively skilled labor (i.e., the comparative advantage industry). This partially softens the incentives to innovate and makes survival relatively easier in that industry. As a result, for low levels of trade costs, trade liberalization induces a smaller proportion of firms to upgrade technology and a relatively small increase in selection compared with the comparative disadvantage industry. Overall, TFP and the proportion of firms that upgrade their technology increase in both industries as trade costs fall and, provided that there is self-selection into exporting markets, these are always larger in the comparative advantage industry.
This paper relates to several existing literatures. First, a recent literature based on models with firm heterogeneity outlines the importance of selection effects in promoting process innovation (Atkeson & Burstein, 2010;Bustos, 2011;Impullitti & Licandro, 2017;Long, Raff, & Stahler, 2011;Mrazova & Neary, 2011;Navas & Sala, 2015;Navas-Ruiz & Sala, 2007, among others). Unlike those papers, the present paper explores the role played by factor endowments in determining the effect that trade has on innovation at the industry level. Secondly, a recent literature incorporates differences in factor endowments and factor intensities across countries in models of trade with economies of scale (Krugman, 1981;Helpman & Krugman, 1985;andmore recently Bernard, Redding, &Schott, 2007 [BRS, 2007]). These papers find that many H-O results are also present in an environment in which there are increasing returns to scale at the firm level and in the case of the last reference, firm heterogeneity. Moreover, BRS (2007) find that differences in factor endowments through selection generate a Ricardian comparative advantage. Tougher selection in the industry that uses more intensively the factor in which the country is relatively more abundant leads to a relatively larger increase in the weighted average productivity of that industry after trade openness. Therefore, trade openness creates differences in the weighted average productivity of industries that in autarky could exhibit the same weighted average productivity. The current paper reinforces these results first by showing that the H-O results are robust to heterogeneous firm environments in which firms are allowed to upgrade technology and second by obtaining a Ricardian comparative advantage that in this case not only comes via tougher selection but it also comes via a larger increase in technology upgrading in the comparative advantage industry. In addition, we also find that the effect of trade liberalization on relative average productivity (Ricardian comparative advantage) depends on the initial level of trade costs: When they are high, trade liberalization will enlarge the Ricardian comparative advantage. If they are low, the Ricardian comparative advantage will shrink. On the empirical side, Levchenko and Zhang (2016) find that, in the previous 50 years, average productivity has increased by more in a country's revealed comparative disadvantage industries. The current paper suggests that when the trade costs are sufficiently low, a reduction in trade barriers may benefit the comparative disadvantage industry, narrowing the differences in TFP across industries within a country. The empirical evidence of Levchenko and Zhang (2016) would be consistent within this framework with a gradual reduction in trade barriers across countries provided that the initial level of trade costs were sufficiently low in the 1960s.
Finally, this paper is also related to the growing literature on trade and growth in models with heterogenous firms. Baldwin and Robert-Nicoud (2008), Gustafsson and Segerstrom (2010), Unel (2010), and Ourens (2016) introduce firm heterogeneity in an expanding product variety model of trade and growth and find that trade openness and trade liberalization have a negative impact on growth unless technological spillovers are strong enough to overcome the increase in the cost of creating a successful variety owing to tougher selection. 4 By considering a quality ladder endogenous growth model, Stepanok and Segerstrom (2017) show that trade liberalization has a positive impact on the short-run growth rate and a positive long-run impact on welfare. Although our model is not an endogenous growth model, we explore the impact of trade openness and trade liberalization on both product and process innovation. In addition, we explore how the effect of trade on innovation could be heterogenous across industries, an unexplored channel in this literature. Regarding the impact of trade on product creation, our model suggests that the effect varies across industries increasing in some industries (the comparative advantage industry) even if technological spillovers are not present, and falling in some other industries (the comparative disadvantage industry). 5 The rest of the paper is structured as follows. Section 2 presents the theoretical model and describes how innovation activities and the weighted average productivity vary across industries in an autarkic environment. In Section 3 we explore how a movement from autarky to costless trade affects innovation and the industry weighted average productivity. In Section 4 we explore the more realistic case in which trade is costly and it involves both fixed and variable trade costs. Section 5 concludes.

| THE M ODE L
Consider an economy consisting of a continuum of consumers. There are two final goods. Denote with C i the consumption of good i51; 2: Preferences over these goods are given by the following utility function: Each C i is a composite good defined over a continuum of varieties, x, belonging to the set X i : Varieties are aggregated according to the standard constant elasticity of substitution (CES) functional form where q i x ð Þ denotes the quantity consumed of variety x of good i and r is the elasticity of substitution between two varieties of good i. Solving the consumer's utility maximization problem yields the standard CES aggregate demand function for each variety of each composite good: where E i represents aggregate consumer expenditure in industry i (i.e., E 1 5aR; E 2 5ð12aÞR , where R denotes total economy revenue and a represents the proportion of total revenue devoted to good (1), p i ðxÞ denotes the price of the variety x of good i and is the standard Dixit-Stiglitz aggregate price index for good i.
To introduce differences in factor usage across industries, we assume that firms use an intermediate input (x i ) to produce. This input is homogeneous for all varieties within the same industry but it differs across industries. It is produced competitively combining both skilled (S i ) and unskilled labor (L i ) according to the following Cobb-Douglas technology: and b i measures the degree of skill intensity of intermediate inputs used in industry i. Assume, without loss of generality, that b 1 >b 2 ; which implies that industry 1 uses intermediate inputs that are more skilled-labor intensive. Perfect competition in the intermediate input sector implies that: where p mi denotes the price of each industry-specific intermediate input.
The production side in the final good sector is similar to that of Melitz (2003). To enter a market, a firm needs to invest f e units of the intermediate input to create a new variety. The creation of new varieties of the same composite good is considered as product innovation. Once the firm has created this variety the firm receives an infinity life patent and therefore, it has the monopoly rights to produce it. Firms produce using a technology that is linear in the industry-specific intermediate input: It is assumed that a firm's productivity u is unknown before the creation of the variety although the firm knows that the productivity parameter u follows a random process with support [0,1) and a cumulative continuous distribution function G(u). After entry, the productivity is revealed to the firm and the firm decides whether to stay and produce. If it stays, the firm bears a per period fixed cost of f D units of the intermediate input to operate the technology. Following Melitz (2003), we assume that when the firm stays, each period the firm faces an exogenous probability d of suffering a bad shock that will drive it out of the market. This probability is common across all productivity levels and is independent across firms and of a firm's history.
Unlike Melitz (2003), once the firm decides to stay, the firm has the possibility of adopting a new technology that improves its productivity (i.e., u) by a factor of u (u 1). To do so, it must invest a fixed amount f I units of the intermediate input. This process of technology upgrading is considered as process innovation. To clearly illustrate the role played by factor endowments on innovation activities across industries, it has been assumed that there are no differences across industries in the intermediate input units required for entry, operation, and process innovation. We also assume that within the industry, all of these activities require the same intermediate input, and consequently, all activities within an industry have indirectly the same skilled-labor intensity. However, activities differ in skilled-labor intensity across industries and, therefore, the fixed costs of operation, entry and process innovation could differ across industries.
The firm's optimization problem is solved by backward induction. Since the firm is the only one producing its variety, a firm charges the standard monopoly price: where d is the indicator function taking the value of 1 if the firm innovates and 0 otherwise. Note that owing to the increase in productivity, an innovating firm will charge a lower price. The firm's variable profits are given by the following expression: where p vi ðu d uÞ and r iD ðuÞ denote respectively the variable profits and the domestic revenue of a firm with productivity u and q5 r21 r is the inverse of the firm's mark-up. Since the production functions are homothetic, a firm that innovates obtains a proportional increase u r21 in variable profits. A firm decides to innovate when the gain in variable profits following technology upgrading overcomes the innovation cost: When the equality holds, the firm is indifferent between innovating or using the original technology. We denote its productivity, u iI , as the innovation cut-off.
Consider an equilibrium in which only a subset of the most productive active firms engage in process innovation. 6 This means that the least productive active firm is not undertaking process innovation. That firm is indifferent between staying or leaving the market when: where u iD denotes the value of this firm's productivity. This condition is known in the Melitz (2003) model as the zero profit (ZP) condition and u iD as the industry productivity cut-off. Dividing (1) and (2) gives: The right-hand side of this condition is an inverse measure of the relative profitability of innovating. 7 It can be observed that the innovation relative to the industry productivity threshold is lower (i.e., a larger proportion of incumbent firms undertakes process innovation) the relatively more profitable innovation is with respect to using the original technology. 8 This happens when the fixed costs of innovation are lower, the fixed costs of operation are higher or the increase in productivity owing to innovation (u) is larger. Interestingly, in autarky, this inverse measure of innovation profitability is independent of factor prices and, consequently, is identical across industries. The homotheticity of the production functions together with the nature of the fixed costs (i.e., the fact that are expressed in terms of the intermediate input) and the fact that mark-ups are constant generates this result. 9 Since the firm decides to adopt the new technology inmediately after entry, its productivity is determined at the time of entry and is constant over time. As in Melitz (2003), we assume that there is no further discounting in this economy and we focus on a steady state where the aggregate variables remain constant over time. The value function in steady state of a firm with productivity u, v i (u), is therefore given by: A firm decides to enter the industry when the firm's expected value EðV i Þ5 ð 1 0 v i ðuÞgðuÞdu is greater than or equal to the fixed cost of entry, that is: In equilibrium this expression will hold with strict equality, becoming the free entry condition. Finally, to facilitate the interpretation of the results, and without loss of generality, it is assumed that the home country is the skilled-labor abundant country. Expressed in mathematical terms this means that S H L H > S F L F , where the superscripts H and F denote the home and the foreign country, respectively.

| Equilibrium in a closed-economy model
A property of Melitz-type models is that the equilibrium of the economy, in our case perfectly characterized by the two productivity thresholds u iI , u iD , can be summarized by two conditions: the zero cutoff profit condition (ZCP) and the free entry condition (FE) (condition 5). To obtain the zero cut-off profit condition in this framework, however, we need to use the standard zero profit condition in Melitz (2003) (condition 2) and the zero innovation profit condition, which is new in this context (condition (1) when the equality holds). Combining the three conditions, the intersection between the ZCP condition and the FE condition becomes: whereũ r21 iD 5 Ð 1 u iD u r21 l iD ðuÞdu is the weighted average productivity of incumbents and u r21 iI 5 Ð 1 u iI u r21 l iI ðuÞdu is the weighted average productivity of process innovators before innovation takes place. 10 The left-hand side of condition (6) is similar to the ZCP condition found in a standard heterogenous-firm trade model. There is, however, an extra term, which represents the expected average innovation profits. The possibility of technology upgrading increases the expected value of profits from entry by increasing the profits of the most productive firms. 11 Compared with Melitz (2003), the possibility of technology upgrading reallocates market shares from the less productive firms to the most productive ones, making survival more difficult in this economy. Consequently, u iD is larger in this case.
Despite the fact that in this model the industry weighted average productivity is larger compared with a model in which firms are not allowed to upgrade technology, both sectors share the same productivity thresholds, u iD , u iI and, consequently, the same weighted average productivity, provided that the rest of the parameters are identical across industries. In autarky, differences in factor endowments across countries do not generate differences in weighted average productivity across industries. 12 In the skilled-labor abundant country, firms initially have larger operating profits in the comparative advantage industry (Industry 1) as their marginal costs of production in that industry are smaller. Consequently, firms can charge lower prices and have relatively larger sales. The potential larger sales could induce some of the most productive firms to upgrade technology and some of the least productive firms to stay in the market. However, the costs of entry in the comparative advantage industry are also smaller, which, together with the larger average expected profits, increases entry. The increase in entry offsets the positive effect that the cost advantage was having on firms' profits, leaving the proportion of firms surviving and the proportion of firms upgrading technology unchanged.
Since there is more entry in the comparative advantage industry, the model generates differences across industries in the mass of surviving firms, (M i ), in equilibrium. To see this, note that: where R i denotes aggregate industry revenue,ũ i is the industry i weighted average productivity and rðũ i Þ is the associated revenue. 13 The second equality comes from the fact that the innovation and industry productivity cut-offs are the same across both industries. Since the home country is skilled-labor abundant: 14 Since b 1 >b 2 , it can be seen that: This result is already present in standard models of trade with imperfect competition and increasing returns to scale (Helpman & Krugman, 1985). Unlike existing work, however, the innovation resources in this economy are not constant across industries. The comparative advantage industry invests more resources in both product and process innovation. R&D expenditures in each sector (E R&D i ) are given by: where M ie , M iI indicate respectively the mass of entrants and the mass of innovators in industry i. Considering the stationarity condition for each sector and rearranging terms: 15 Since u iD , u iI are common across industries, the ratio of R&D expenditures is given by: : While the relative R&D expenditures only depend on the size of the sector a, the amount of resources invested is larger in the industry in which the economy has a comparative advantage. To see this, consider the simple case in which a5 1 2 . In this situation, the same amount of income is invested in innovation in both industries. However, in the industry in which the economy has the comparative advantage, the resource cost is cheaper, and consequently more resources are invested.
A common indicator used in the field of industrial organization to measure the intensity of innovative activity within an industry is the ratio of R&D expenditures over sales, known in the literature as R&D intensity (R&D inti ). This measure corrects for the fact that R&D expenditures are positively affected by the size of the industry. The model suggests that R&D intensities are identical across industries since:

| COS TL ES S TRA DE
In this section, the implications for innovation of a movement from autarky to free trade, where trade is costless, are considered. Firms can serve the foreign market at no cost. The variable profits of a domestic firm in the domestic market are given by: and the variable profits of a domestic firm in the foreign market are given by: where the superscript F makes reference to the variables in the foreign country. Since firms have access to foreign markets, they take this into account when deciding whether to innovate. The innovation cutoff in the home country will be determined by considering that the gain in variable profits following technology adoption must be equal to the innovation costs: Dividing these two last conditions we find that: The previous expression suggests that the innovation relative to the industry productivity cut-off is unchanged when the economy moves from autarky to costless trade. This result comes from the fact that the relative profitability of innovating versus operating with the original technology has not changed. In fact, since the variable profits for each firm are a constant times the variable profits in autarky, the intersection between the ZCP condition and the FE condition is given by: Notice that this equation is identical to the one in autarky and, consequently, the innovation and the industry productivity cut-offs are unchanged after trade openness if trade is costless. The main reason behind this result lies in the fact that trade openness has increased profits in the same proportion for all firms so the relative profits between the average firm and the one that is indifferent between staying or leaving the market have not changed. This implies that the productivity distributions remain unchanged.
The standard results in the H-O model hold in this environment. Factor price equalization prevails provided that economies do not experience factor intensity reversals (i.e., factor endowments in both countries lie within the diversification cone). However, trade has an impact on innovation. Trade promotes investment in product innovation in the industry in which the country has a comparative advantage. These results were already present in BRS (2007) and, therefore, the introduction of process innovation has not changed the conclusions regarding the impact on the industry productivity cut-off and the average productivity of a movement from autarky to free trade in a costless trade world.
While investment in product innovation changes, the relative R&D intensities are unchanged after trade openness. To see this, note that the R&D intensity ratio is given by: Using the expression R i 5M i rðũ i Þ, and rearranging terms gives:

51:
The reason why costless trade does not have an impact on process innovation (and on industry average productivity), is that it does not alter the distribution of profits within the industry. When trade is costless, trade openness widens the profit opportunities of all firms. This induces entry in both industries. The increase in entry perfectly offsets the increase in profit opportunities for firms in both industries and leaves the market share of each firm in each market unaltered. Since the global size of the firm is unchanged under this setting, a firm's incentives to undertake process innovation activities are not altered.

| COS TL Y TRA DE
The recent literature on trade and firm heterogeneity has suggested that both fixed and variable trade costs are important in international trade activities (Roberts & Tyebout, 1997). In this section both types of trade costs are introduced and the consequences for innovation examined.
To introduce variable trade costs, as is standard in the literature, the existence of iceberg transportation costs are assumed (i.e., to get one unit of the product sold in the foreign market, a firm must ship s 1 units since s -1 units of the good melt in the process of transportation). To serve the foreign market, the firm also needs to incur a fixed cost of f X units of the specific intermediate input. 16 To outline the role played by factor endowments on innovation outcomes, it is assumed that sectoral structural parameters other than factor intensities are identical across industries. We also assume that all structural parameters other than factor endowments are identical across countries.
Similar to Navas and Sala (2015), this model exhibits different types of equilibria depending on the parameter configuration. 17 These are associated with different partitions of firms according to innovation and export status. In this paper we focus on an equilibrium in which innovators are a subset of the most productive exporters for both industries and countries, in line with recent evidence found by Aw et al. (2011). 18 Consequently, both industries are characterized by a partition of firms by status given by the following hierarchy: first, innovators and exporters, secondly, exporters and finally nonexporting domestic firms. 19 For clarity, denote by superscript j 5 H,F the variables associated with the home country and by superscript k 5 H,F the variables associated with the destination country (both of which can be either home [H] or foreign [F]).
In this equilibrium, innovators are a subset of the most productive exporters. Consequently, the firm that is indifferent between innovating or operating with its original technology in country j and industry i is defined by the following condition: where we have used the fact that The marginal exporter, which is not an innovator, in country j is described by the following expression: and the industry productivity cut-off is given by the following condition: Dividing (11) and (12) yields: which describes a relationship between the industry exporting cut-off and the industry productivity cutoff. The variable K j i can be interpreted as a measure of the relative profitability of serving the domestic versus the foreign market. 20 Note that there is a smaller export relative to survival productivity cut-off and, consequently, a larger proportion of incumbent firms exporting in industry j when this K j i is smaller or, in another words, when the relative profitability of serving the foreign market is larger. This happens, ceteris paribus, when the foreign country is relatively wealthier compared with the domestic market (R k > R j ), when the trade costs (both variable and fixed) are relatively lower and when the aggregate price index in the foreign market is larger compared with the one in the domestic market. Dividing (10) and (12) gives: which describes a relationship between the industry innovation cut-off and the industry productivity cut-off. As in autarky, the right-hand side of this condition is an inverse measure of the profitability of innovating which clearly changes in the costly trade scenario, as explained below. Finally, to find the industry productivity cut-off, we obtain the intersection between the ZCP and the FE condition by substituting the expression for average profits in the free entry condition and rearranging terms: where ðũ iX Þ r21 5 Ð 1 u iX u r21 l iX ðuÞdu, represents the weighted average productivity of exporters before innovation takes place. Compared with the autarkic case, the left-hand side of this condition includes a NAVAS | 151 new term, the third term, which represents the expected average export profit. In this term we can distinguish between p j iX 5 12Gðu j iX Þ 12Gðu j iD Þ , which is the probability of exporting conditional on being an incumbent and p j iX ðũ iX Þ5~u p j mi f X , which is the average export profit. In the Online Appendix (for access, see Supporting Information at the end of this paper), the aggregation properties of the model under costly trade are discussed. Several results emerge from analyzing Equations (14) and (15). First, the relative profitability of innovating has increased in both industries, reducing the innovation versus industry productivity cut-off. This can be observed by noting that the denominator of Equation 14 for each industry is larger than the respective one in autarky. A movement from autarky to costly trade increases the proportion of incumbents undertaking process innovation independently of the industry's comparative advantage pattern. Trade openness increases the size of the market for the most productive firms and, consequently, their sales. For a given productivity level, an innovator is able to exploit their knowledge advantage across more production units since they are able to sell more. This increases innovation profits and induces a larger proportion of incumbent firms to innovate. Second, the left-hand side of Equation 15 is larger than the respective one in autarky and, consequently, trade openness increases the productivity cut-off in both industries. Since trade expands the profit opportunities of the most productive firms in both industries, these firms increase the demand for scarce production factors. The increase in the demand will increase the real cost of both production factors and this makes survival for the least productive firms in both industries tougher. The least productive firms will no longer make positive profits and they will not be able to survive.
The impact on the productivity cut-off has consequences for the weighted average productivity in each industry that increases after trade liberalization. Unlike BRS (2007), the inclusion of process innovation increases the effect that trade has on the weighted average productivity. This increase in average productivity comes from a pure technology upgrading effect (i.e., the fact that trade increases the proportion of incumbents undertaking process innovation) and a positive impact of technology upgrading on selection. As a larger proportion of incumbent firms upgrade technology when the economy is open to trade, this has a further positive effect on the demand for scarce production factors that makes survival tougher in this context. Consequently, compared with a situation in which firms are not allowed to technology upgrade, trade openness will allow a smaller proportion of firms to survive in the industry.
While trade toughens selection and reduces the innovation relative to the industry productivity cutoff in both industries (i.e., a larger proportion of incumbents undertake process innovation), the results are not homogeneous across industries. Taking the ratio u j 1I u j 1D across industries yields: and given that the fixed costs of exporting and operation are the same across industries, whether the innovation relative to the industry productivity cut-off is larger in one industry compared with the other depends on K j i . Given that home is relatively skilled-labor abundant and industry 1 uses intermediate inputs that are skilled-labor intensive, in the Online Appendix (see Supporting Information at the end of the paper) we show that: The profitability of serving the foreign market relative to the domestic one is larger in a country's comparative advantage industry).
Proof See Online Appendix. w Using our interpretation for K j i , the previous proposition states that the profitability of serving the foreign market relative to the domestic one is larger in the industry in which the country reveals a comparative advantage of a H-O type. In the limit case, when both countries are in autarky, the relative wages of skilled versus unskilled workers are smaller in the home country, the skilled-labor abundant one. This implies that when the country opens up to trade, the relative price of the skilled-labor intensive good is relatively cheaper than the foreign counterpart and, consequently, the profitability of serving the foreign market relative to the domestic market is relatively higher in this industry.
This last proposition has consequences for the innovation, exporting and industry productivity cutoffs. More precisely we can conclude that: Proposition 2 Under costly trade: 1. The industry productivity cut-off is larger in the industry in which the economy has a comparative advantage (i.e., u H 1D >u H 2D and u F 1D <u F 2D ). 2. The export productivity cut-off is smaller in the industry in which the economy has a comparative advantage (i.e., u H 1X <u H 2X and u F 1X >u F 2X ). 3. The innovation productivity cut-off is smaller in the industry in which the economy has a comparative advantage (i.e., u H 1I <u H 2I and u F 1I >u F 2I ).
Proof See Online Appendix. w Proposition 2 reveals an interesting outcome. In the industry in which the economy has a comparative advantage, when the economy opens to trade and trade is costly, there will be a larger proportion of incumbent firms exporting. That industry will experience a larger increase in selection and a larger increase in the proportion of incumbent firms undertaking process innovation. The intuition behind these results is based on the fact that when the economy opens up to trade, firms are asymmetrically exposed to different industry opportunities. In the home skilled-abundant country, the marginal cost of production in industry 1 is lower than in the foreign country. When the economy opens up to trade, firms experience an increase in their profit opportunities because the access to a larger market allows them to exploit the increasing returns to scale associated with both production and innovation. However, these profit opportunities are larger in the industry in which the economy has the comparative advantage since this industry is able to offer the good more cheaply than its counterpart in the foreign country (industry 1). This implies that a larger proportion of incumbent firms will find it optimal to serve the foreign market in this industry. This increase in opportunities promotes also disproportionate entry in that industry, and consequently more product innovation. The increases in entry and in exports increase the demand for scarce production factors. This increase is, however, larger for the skilled labor, the factor used intensively in the comparative advantage industry. As a consequence, this has a positive impact on relative factor remuneration. This makes profits fall by more and it becomes more difficult for firms to survive in the comparative advantage industry. Some of the firms with the lowest productivity that would be able to survive in the comparative disadvantage industry can no longer make positive profits in the comparative advantage one and they need to leave the market. Consequently, the productivity threshold needed to survive in the market increases by more in the comparative advantage industry. The expulsion of the least efficient firms generates a reallocation of market shares towards the most productive firms. Process innovation increases by more in the comparative advantage industry owing to a combination of expanded opportunities and stronger market share reallocation.
In the introduction, we discussed how the data suggests a positive correlation between the Balassa Index of revealed comparative advantage, R&D intensities, and the proportion of firms undertaking process innovation. The next two propositions further explore this in our theoretical model. The first one shows that in our framework, an industry's R&D intensity is larger when the country has the comparative advantage in that industry. Note that Proposition 2 already suggests that there is a larger proportion of incumbent firms undertaking process innovation in that industry. The second one derives the Balassa Index of revealed comparative advantage in our model and shows that when a country has a comparative advantage of an H-O type, the implied index will be above 1 (i.e., revealing that the economy has a comparative advantage in that sector). Therefore, we can conclude that our framework is able to account for the empirical evidence discussed above.
Following BRS (2007) and a long tradition in the literature on firm heterogeneity, for these results and the numerical simulations, we assume that the productivity distribution G(u), follows a Pareto distribution with a cumulative density function given by: 21 Proposition 3 Assuming a Pareto distribution for productivity, under costly trade, the R&D intensities are larger in the sector in which the economy has a comparative advantage, (i.e., R&D H int1 >R&D H int2 and R&D Proposition 4 Assuming a Pareto distribution for productivity, the Balassa Index of revealed comparative advantage for industry i is above (below) 1 when the country has (not) the comparative advantage in industry i, i.e., RCA H 1 >1, RCA H 2 <1, RCA F 1 <1, RCA F 2 >1.
Proof See Online Appendix. w In the Online Appendix, it is shown that for this equilibrium to hold, the following condition must be satisfied: 22 Condition (17) depends on four endogenous variables and the model does not exhibit a closedform solution for these variables. A necessary condition for this equilibrium to hold is that Rearranging terms, it can be seen that df I >ðu r21 21Þðf X 1f D Þ: From the condition above, it can be seen that, ceteris paribus, this equilibrium holds when the fixed costs of innovation are high and/or the fixed costs of exporting and operation are low. In addition, an inspection of condition (17) reveals that, ceteris paribus, the condition is more likely to hold when the iceberg trade costs are low. 23 The next section studies in depth through simulations how trade openness and trade liberalization affects the main variables of the model in this equilibrium.

| Simulation exercises
Several simulation exercises are undertaken to explore the main implications of trade on innovation. For common parameters, the values of BRS (2007) are used. This facilitates comparison between the two models and allows us to isolate the role played by innovation in the effect of trade on the productivity cut-offs and the weighted average productivity across industries. We focus also on the most realistic case in which there is self-selection into exporting. 24 In the Online Appendix the effects of a movement from autarky to free trade are analyzed. From a quantitative perspective, this exercise reveals that the inclusion of technology upgrading reinforces selection substantially. In addition, we find that a movement from autarky to free trade increases (decreases) product innovation in the comparative advantage (disadvantage) industry. This accords with the empirical evidence shown above, where product innovation was significantly larger in the comparative advantage industry. The exercise also reveals a larger increase in welfare for the representative agent compared with the benchmark case (no technology upgrading is allowed) and as in Helpman and Krugman (1985) and BRS (2007) and unlike the traditional H-O model, an increase in welfare for both skilled and unskilled workers.
In the next exercise the effects of trade liberalization are investigated. In this section, the most relevant results are reported but the full set of results is available in the Online Appendix (see Supporting Information). Trade liberalization reduces the export and innovation productivity cut-offs and increases the survival productivity cut-off in both industries. The survival productivity cut-off is always larger and the export and innovation productivity cut-offs are always smaller in the industry in which the economy has the comparative advantage. Compared with the benchmark case, the survival productivity cut-offs in both industries have increased considerably and the increase has been larger in the comparative advantage industry. 25 Figures 4 and 5, which display the relative industry and innovation productivity cut-offs for both countries, reveal an interesting outcome. When the trade costs are high (low), trade liberalization toughens selection and increases the proportion of firms engaging in process innovation more intensely in the comparative advantage (disadvantage) industry. 26 When looking at R&D intensities or the weighted average productivities a similar result is found: trade liberalization induces a larger increase in the comparative advantage (disadvantage) industry when trade costs are high (low). Therefore, while a process of globalization induces an increase in TFP in both industries, globalization induces industry TFP divergence when trade costs are high, but it induces industry TFP convergence when trade costs are low. This prediction is consistent with the findings of Levchenko and Zhang (2016), provided that trade costs have been declining over time, and they were relatively low at the start of the sample. 27 Figure 6 shows the evolution of the relative weighted average productivity and illustrates that point. Figures 7 and 8 serve to provide intuition for these results. The first one shows the effects of trade liberalization on product innovation in both industries. Trade liberalization increases (decreases) product innovation in the comparative advantage (disadvantage) industry. In the comparative advantage industry, the ex-ante increase in the profit opportunities of the most productive firms, increases the average expected profit and induces entry. In the comparative disadvantage sector, domestic firms face disproportionately tougher competition, the average expected profit falls and this deters entry. However, the effect is nonlinear and it becomes larger as trade costs fall. This is reflected in the evolution of factor prices ( Figure 8). As predicted by the H-O model, there is factor price convergence. 28 However, in the current paper, the effect is nonlinear. As trade costs are reduced, the increase in product innovation in the comparative advantage industry increases the relative demand for skilled labor, which induces an increase in the relative wage ( w s w l ). This movement in factor prices has clear implications for the incentives to innovate and the probability of survival across different industries as discussed below. When trade costs are high (s > 1.3), trade liberalization expands the profit opportunities of the most productive firms in the comparative advantage industry. This promotes entry, which increases the relative skilled wage in the home country. These last two effects are small. Thus, the larger expansion in profit opportunities in the comparative advantage industry implies that more firms engage in process innovation. As trade costs fall, however, the relative increase in process innovation in the comparative advantage industry becomes weaker. This is because, as trade costs are reduced, the increase in entry and the corresponding increase in the relative wage becomes larger. This increases the relative innovation cost and reduces the relative attractiveness of domestic firms in foreign markets. These effects partially soften the incentive to innovate. When trade costs are low enough (s < 1.3), the increase in the mass of firms innovating will be positive in both industries but it will favor the comparative disadvantage one.
In order to explain how a reduction in trade costs affects the relative evolution of the survival productivity cut-offs, consider, without loss of generality, the home country. Using Equation (12) for both industries, assuming that the expenditure share is equal across industries (a 5 0.5) and rearranging terms we find that This equation is useful for illustrating the impact of a reduction in trade costs on the evolution of the relative survival cut-offs. As trade costs fall, Figure 8 suggests that the relative skilled wage increases. Since b 1 > b 2 , this increases the ratio of productivity cut-offs. As skilled workers become more expensive relative to unskilled workers, the relative marginal cost of production and the relative costs of surviving increase in the skilled-labor intensive industry. This reduces sales and makes survival more difficult. This is captured by the first element of the right-hand side of the equation and it is called the factor price effect. The second term reflects the relative degree of domestic competition in both industries as BRS (2007) state and it can be referred to as the competition effect. When the trade costs are high, trade liberalization provokes a larger increase in competition in the comparative advantage industry since trade induces a larger mass of firms to technology upgrade. However, as trade costs are falling, this effect becomes weaker and, as discussed above, for low levels of trade costs, trade induces a smaller proportion of firms to innovate in the comparative advantage industry so competition increases by more in the comparative disadvantage industry. Figure 9, which represents P j 1 P j 2 12r illustrates this point. The final effect on the evolution of the relative industry productivity cut-off depends on the relative strength of the competition and the factor price effects. When s > 1.3, both effects go in the same direction and a reduction in trade costs increases the relative industry productivity cut-off, . When 1.3 > s > 1.15, survival is still tougher in the comparative advantage industry although competition has already softened in the comparative advantage industry. In this case, the competition and the factor price effects go in different directions but the factor price effect dominates. When s < 1.15, both effects go in different directions but the relative competition effect dominates and a reduction in trade costs

| CONC LUS I ON S
Innovation activity varies substantially across industries. Evidence from the United States shows that innovation activity is larger in the industries in which the country reveals a comparative advantage. This paper introduces technology upgrading into a factor proportions model of trade with firm heterogeneity to explore how differences in factor endowments shape the impact that trade has on innovation at an industry level.
The results suggest that differences in factor intensities across industries and factor endowments across countries affect the impact on innovation activity across industries in a country that opens to trade. More precisely, firms in the industry where the economy reveals a H-O comparative advantage undertake more product and process innovation. This is consistent with the evidence mentioned above and reinforces previous results that endorse the importance of the relative factor endowments in generating a Ricardian comparative advantage.
The paper then explores the effect of trade liberalization on innovation and industry weighted average productivity. Trade liberalization promotes technology upgrading and boosts average productivity in both industries. However, the intensity of the effect is different across industries and it depends on the level of trade costs: when the trade costs are high, trade liberalization pushes technology upgrading more in the comparative advantage industry leading to TFP divergence across industries. However, when the trade costs are low enough, a reduction in trade costs pushes more technology upgrading in the comparative disadvantage industry leading to a process of TFP convergence across both industries.
ACKNOWLEDGMENT I would like to thank, the associate editor, Frederic Robert-Nicoud, two anonymous referees, Sarah Brown and the participants of the European Trade Study Group (ETSG 2014), the University of Nottingham and the participants of the internal seminar at the University of Sheffield for useful comments and suggestions. All remaining errors are mine.

NOTE S
1 The Balassa Index of revealed comparative advantage for the United States in industry i ðRCA US i Þ has been constructed using the standard expression RCA US i 5 where X j i indicates the exports of good i in country j, and N and M indicate the total number of goods and countries, respectively. When RCA US i 1, the United States has a comparative advantage in good i: We are conscious that, despite being widely used, this statistic suffers from some limitations when interpreted as a measure of comparative advantage. A long tradition in the empirical trade literature (Hinloopen & Van Marrewijk, 2001;De Benedictis & Tamberi, 2004) suggests that it could be sensitive to the year choice. For that reason, as a robustness check, we have replicated this exercise for the years 2004 and 2007, and in the case of 2007 we have used R&D intensities for that period (three-digit NAICS code obtained from the National Science Foundation) (available upon request). The results are quite stable across the different years. 2 The figure shows the relationship between both variables excluding some extreme values for expositional clarity. The straight line indicates the OLS regression line (full sample). Both the coefficient and the constant are significant at the 2% and 1% respectively. 3 Using R&D intensities as a measure of innovation activity, the model predicts that trade openness increases R&D intensities in both industries, favoring the comparative advantage industry, consistent with Figure 1 above. 4 While Baldwin and Robert-Nicoud (2008), Unel (2010), and Ourens (2016) develop endogenous growth models where the steady state growth rate is affected by trade openness and trade liberalization policies, Gustafsson and Segerstrom (2010) present a semi-endogenous growth model where the long-run growth rate is unaffected by trade. However trade openness and trade liberalization do have an impact on the short-run growth rate and the productivity and welfare levels in the long run in this model. This effect is dependent on the size of the intertemporal knowledge spillovers in R&D. 5 Another interesting related literature explores the effect of trade openness on innovation when economies differ in factor endowments and directed technical change rather than Hicks-neutral technological progress is considered (Acemoglu & Zilibotti, 2001;Acemoglu, 2003;Thoenig & Verdier, 2003, among others). Differences in factor endowments across countries have a clear impact on innovation, growth and the skilled premium in these settings. These models focus on the representative sector and therefore they do not explore how trade openness has a different impact on innovation across industries, which has implications for the evolution of the comparative advantage. 6 Klette and Kortum (2004) conduct a comprehensive review of the key stylized facts related to firm R&D performance.
They point out that a large fraction of firms report zero R&D expenditure and that there is a positive correlation between productivity and R&D activities. Looking at innovation from the output side, our data reveals that only between 15 and 30 percent of manufacturing firms in the United States report having introduced any process innovation during 2006 to 2008. Therefore, it seems to be sensible to focus on an equilibrium where the least productive firms do not engage in process innovation. 7 More precisely, we have For the case of the Pareto distribution, commonly assumed in this literature and assumed below in the paper, there is an inverse relationship between the proportion of incumbent firms undertaking process innovation (i.e., 12Gðu iI Þ 12G u iD ð Þ ) and u iI u iD

:
If the productivity distribution is not Pareto the relationship between both variables must be considered holding constant u iD . 9 For this equilibrium to hold, a necessary and sufficient condition is u iI u iD r21 >1, which happens when 10 l iD ðuÞ and l iI ðuÞ are given by, An interesting difference between Melitz (2003) and earlier models of technology adoption mentioned above (including the one in the current paper), lies in the fact that the ex-post cumulative productivity distribution is slightly different from the ex-ante cumulative productivity distribution. In the Online Appendix (see Supporting Information at the end of the paper), we describe how the ex-post productivity distribution departs from the original one. Notice, however, that this does not affect the equilibrium results as the ex-post distribution is totally determined by the ex-ante distribution and there is no asymmetric information across firms. We are grateful to an anonymous referee for pointing this out. 11 Navas and Sala (2015) study the decision of technology upgrading in a representative sector model of trade with firm heterogeneity when firms undertake cost-reducing innovations. In that paper, uniqueness for the survival cost cut-off (and consequently the innovation cost cut-off) is shown. An identical proof to show uniqueness of each u iD applies in this context. 12 The same result has been found in a similar framework without technology upgrading (BRS, 2007). 13 More precisely:ũ r21 iI h i . 14 See the Online Appendix (Section 2) for a formal proof. 15 More precisely, M ie ð12Gðu iD ÞÞ5dM i . 16 A large part of this fixed cost of exporting consists of advertisement and complying with regulation standards. It seems sensible to assume that these costs differ across industries and reflect, arguably, the skill composition of the industry. 17 Navas and Sala (2015) explore the effects of trade openness on innovation in a representative sector model in which firms invest in cost-reducing innovations. Depending, among other things, on the costs of exporting and technology adoption, that paper distinguishes between three cases: the one explored here, in which innovators are a subset of the most productive exporters that the authors denote as equilibrium BW; another one in which all exporters and some domestic firms undertake innovation (equilibrium B); and an intermediate case, denoted as equilibrium C, in which all exporters are innovators but no domestic firms undertake innovation. 18 The main results regarding the impact of trade openness and trade liberalization on the evolution of the relative weighted average productivityũ j 1 u j 2 hold in the other equilibria (available upon request). NAVAS | 161 19 The restriction under which this equilibrium holds can be found below. 20 More precisely, K j i À Á r21 5 r iD ðuÞ f D r iX ðuÞ f X : 21 The assumption of a Pareto distribution allows us to obtain closed-form solutions for key variables used in these propositions and it is therefore a convenient technical assumption. Moreover, Axtell (2001) maintains that the Pareto distribution provides a relatively good fit for the distribution of entire sales and employment in the United States. Luttmer (2007) also emphasizes that the upper tails of the distribution of firm sales and employment in the United States are well approximated by a Pareto distribution. 22 If the following condition holds: then all firms will be able to export. In that case, the economy will be in an equilibrium with costly trade but no selection into exporting markets. 23 The left-hand side inequality of expression (17) is the condition for the existence of self-selection into exporting (as stated in footnote 20). Provided that this inequality holds, ceteris paribus, when s increases, the middle term of condition (17) becomes larger and so it becomes more difficult for the right-hand side inequality to hold. If either the fixed costs of innovation decrease or the fixed costs of exporting increase, the right-hand side becomes smaller and it is also more difficult for the second inequality to hold. 24 In the Online Appendix the effects of trade liberalization on industry and exporting productivity cut-offs under no selfselection into exporting are shown. The qualitative results are not altered under this setting. The value of the innovation jump is assumed to be 20% (u 5 1.2) and the innovation cost is assumed to be 25 times the cost of entry. Changes in the parameter values do not generate qualitatively different results, provided that the economy is in the analyzed equilibrium. A number of robustness checks have been undertaken, the results of which are available on request. 25 For example, when trade costs are equal to 20%, the productivity cut-off is 3.8% larger in the comparative advantage industry and 3.67% larger in the comparative disadvantage one. 26 While from the figures above, results regarding the proportion of entrants can be inferred, this result also holds for the proportion of incumbent firms (i.e., 12Gðu iI Þ 12Gðu iD Þ ). 27 The threshold level below which a reduction in trade costs decreases the industry relative productivity cut-off and induces TFP convergence is around 15 percent. The threshold level below which the relative R&D intensity decreases or the relative innovation cut-off increases is much larger (30 percent). This suggests that the impact of trade liberalization on the average productivity is stronger through the selection effect than through the innovation effect. 28 The figure shows the relative wage ( wl ws ) in both countries as a function of the trade costs. As trade liberalizes, the unskilled wage goes down at home, the skilled-labor abundant country, and rises in the foreign country, the unskilledlabor abundant country.