In this notebook I simulate the model from Paul Krugman’s “Scale Economies, Product Differentiation, and the Pattern of Trade,” AER, 1980.

Main parameters:

\(\theta\): from \(U=\sum_i c_i^{\theta}\), where \(0<\theta<1\)

\(L,L^*\): population of “home” and “foreign” (*) regions

\(\alpha,\beta\): fixed and marginal cost parameters from \(l_i=\alpha+\beta*x_i\)

\(g\): transportation cost, if \(1\) unit is shipped only \(1-g\) arrives in the other country

Wages and prices are not uniquely defined in autarky and in the case of trade only the ratio \(\omega=w/w^*\) is defined. Therefore I normalize the wage of the home country to \(w=1\), which will imply the price will be \(p=w*\beta/\theta=\beta/\theta\) in equilibrium.

Lastly, in all equilibria the number of firms and output of each good is simply a function of the exogenous parameters:

\(x=\frac{\alpha\theta}{\beta(1-\theta)}\), \(n=\frac{L(1-\theta)}{\alpha}\) and \(n^*=\frac{L^*(1-\theta)}{\alpha}\)

#Main parameters:
theta=0.5
l.home=300
l.foreign=100
alpha=0.5
beta=0.5
g.transport=1/4
w.home=1
#Derived variables
p.home=w.home*(beta/theta)
x=(alpha*theta)/(beta*(1-theta))
n.home=l.home*(1-theta)/alpha
n.foreign=l.foreign*(1-theta)/alpha

Functions:

Main function is balance of payments, which I use to solve for \(\omega=w/w^*\)

\[B=\omega L L^*\left[\frac{\sigma^*}{\sigma^*L+L^*}-\frac{\sigma}{L+\sigma L^*}\right]\] The terms \(\sigma\) and \(\sigma^*\) are functions of \(\omega\) and \(g\). Specifically, \(\sigma=\omega^{\frac{1}{1-\theta}}g^{\frac{\theta}{1-\theta}}\) and \(\sigma^*=\omega^{\frac{-1}{1-\theta}}g^{\frac{\theta}{1-\theta}}\)

BofP<-function(par,theta,l.home,l.foreign,g.transport) {
  sigma.home<-par^(1/(1-theta))*g.transport^(theta/(1-theta)) #only defined within function BofT
  sigma.foreign<-par^(-1/(1-theta))*g.transport^(theta/(1-theta))
  par*l.home*l.foreign*
    (sigma.foreign/(sigma.foreign*l.home+l.foreign)-sigma.home/(l.home+sigma.home*l.foreign))
}

Autarky In autarky there is no trade

With Trade and Positive Transportation Costs First, let’s look at how the balance of payments is affected by \(\omega\):

curve(BofP(x,theta,l.home,l.foreign,g.transport),from=0.7,to=1.3,
      xlab="Ratio of home-to-foreign wages: omega",ylab="balance of payments",
      main="Balance of payments versus home-to-foreign wage ratio")
abline(h=0)

We can see that if wages are the same then the home country has a trade surplus, which means the foreign country would not be able to afford all the imports. We need to use numerical methods to find when the balance of payments is zero, or a value \(\omega^*\) such that \(B(\omega^*)=0\). To do so we can use the uniroot() function.

#Solve for value of omega that sets balance of trade equal to zero
omega.root<-uniroot(BofP,c(0.00001,2),g.transport=g.transport,theta=theta,l.home=l.home,l.foreign=l.foreign)
omega.star<-as.numeric(omega.root[1])

The balance of payments will be zero when \(\omega=\) 1.2247448. We can solve for all the variables for both countries. Define the price index as: \[P=\left[\displaystyle\sum_{i=1}^n p_i^{\frac{\theta}{\theta-1}}\right]^{\frac{\theta-1}{\theta}}\] Then demand for good \(i\) in any country can be written as: \[c_i=\frac{w p_i^{\frac{1}{\theta-1}}}{\displaystyle\sum_{i=1}^n p_i^{\frac{\theta}{\theta-1}}}=\left(\frac{p_i}{P}\right)^{\frac{1}{\theta-1}}\frac{w}{P^{\theta}}\]

We can now calculate variables in each country:

w.foreign=w.home/omega.star
p.foreign<-beta/(omega.star[1]*theta)
p.home.import<-p.foreign/g.transport
p.foreign.import<-p.home/g.transport
pricesum.home<-n.home*(p.home^(theta/(theta-1)))+n.foreign*(p.home.import^(theta/(theta-1)))
pricesum.foreign<-n.home*(p.foreign.import^(theta/(theta-1)))+n.foreign*(p.foreign^(theta/(theta-1)))
pindex.home=(n.home*(p.home^(theta/(theta-1)))+n.foreign*(p.home.import^(theta/(theta-1))))^((theta-1)/theta)
pindex.foreign=(n.home*(p.foreign.import^(theta/(theta-1)))+n.foreign*(p.foreign^(theta/(theta-1))))^((theta-1)/theta)
c.h.h=w.home*p.home^(1/(theta-1))/pricesum.home
c.h.f=w.home*p.home.import^(1/(theta-1))/pricesum.home
c.f.f=w.foreign*p.foreign^(1/(theta-1))/pricesum.foreign
c.f.h=w.foreign*p.foreign.import^(1/(theta-1))/pricesum.foreign
u.home=n.home*(c.h.h^theta)+n.foreign*(c.h.f^theta)
u.foreign=n.home*(c.f.h^theta)+n.foreign*(c.f.f^theta)
(w.home/pindex.home)^theta
[1] 18.18292
(w.foreign/pindex.foreign)^theta
[1] 12.69792

This gives us the following results:

Home Foreign
domestic price \(p\): 1 domestic price \(p^*\): 0.8164966
import price \(p^*/g\): 3.2659866 import price \(p/g\): 4
domestic \(c_{h,h}\): 0.9073899 domestic \(c_{f,f}\): 0.6202041
imports \(c_{h,h}\): 0.0283559 imports \(c_{f,f}\): 0.0775255
Total Utility \(U_{h}\): 18.1829211 Total Utility \(U_{f}\): 12.697923
Utility from domestic \(U_{h,h}\): 16.4989992 Utility from domestic \(U_{f}\): 7.8753037
Utility from imports \(U_{h,f}\): 1.6839219 Utility from imports \(U_{f,h}\): 4.8226193
LS0tDQp0aXRsZTogIlNpbXVsYXRlIEtydWdtYW4gMTk4MCBBRVIiDQpvdXRwdXQ6DQogIGh0bWxfZG9jdW1lbnQ6DQogICAgZGZfcHJpbnQ6IHBhZ2VkDQotLS0NCkluIHRoaXMgbm90ZWJvb2sgSSBzaW11bGF0ZSB0aGUgbW9kZWwgZnJvbSBQYXVsIEtydWdtYW4ncyAiU2NhbGUgRWNvbm9taWVzLCBQcm9kdWN0IERpZmZlcmVudGlhdGlvbiwgYW5kIHRoZSBQYXR0ZXJuIG9mIFRyYWRlLCIgKkFFUiosIDE5ODAuDQoNCioqTWFpbiBwYXJhbWV0ZXJzOioqDQoNCiRcdGhldGEkOiBmcm9tICRVPVxzdW1faSBjX2lee1x0aGV0YX0kLCB3aGVyZSAkMDxcdGhldGE8MSQNCg0KJEwsTF4qJDogcG9wdWxhdGlvbiBvZiAiaG9tZSIgYW5kICJmb3JlaWduIiAoKikgcmVnaW9ucw0KDQokXGFscGhhLFxiZXRhJDogZml4ZWQgYW5kIG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