# The Heckscher-Ohlin Model

The Heckscher-Ohlin model has become the standard model for 
examining the implications of international trade. It focuses on
differing resource supplies. A maintained assumption is that 
the same technologies are available in the home country and 
the foreign country (the rest of the world).

The model in this exercise set closely resembles the general equilibrium 
model that the text develops. The development below, due to Krugman and
Obstfeld, is designed to facilitate examination of changes in 
product prices and in resource endowments.

## Production Technology

Use the simple Cobb Doulas production functions C=A*LC^a*TC^(1-a)
and F=B*LF^b*TF^(1-b). The exercises below examine effects of 
change in T (T = TC + TF) and F (F = FC + FT) and the relative
price pC/pF. It does not examine the implications of techological
change, so we hold the coeffients A and B equal to 1. 

Begin by specifying the two production functions as follows;
C: LC^0.8*TC^0.2, and  F: LF^0.6*TF^0.4. The exercises below do 
not examine the effects of changes in the exponents, so enter values 
of 0.8 and 0.6 for a and b.

kill(all)$ fpprintprec:5$ ratprint:false$
[C: LC^(4/5)*TC^(1/5),  F: LF^(2/5)*TF^(3/5)];
[L0,T0]:[1000,1500]$

Draw two unit isoquants (an isoquant for C = 1 and an isoquant for F = 1). 
Place them in separate panels, using gr2d and wxdraw. In both cases use 
the implicit command and let labor range from 0 to 2 and land 
range from 0 to 5.

/*Input. Execute (ctrl-enter) for results */
cloth: gr2d(line_width=2,key="C=1",xlabel="Labor",
ylabel="Land",implicit(C-1,LC,0,2,TC,0,5))$

/*Note equivalence of C-1 and C=1 in explicit( ) */

food: gr2d(line_width=2,key="F=1",xlabel="Labor",
ylabel="Land",implicit(F=1,LF,0,2,TF,0,5) )$
wxdraw(cloth, food,columns=2);

### Relative Input Prices

The Cobb Douglas function is homothetic, so the slope
of every isoquant at a given land/labor ratio is the same. Also, 
efficiency requires that the isoquant's slope be equal to the ratio
w/r. Define two expressions wrC and wrF that state the relevant 
w/r as a function of the ratio of land to labor in the industry.

The maximum ratio of w to r occurs when only C is produced, and the
minimum ration occurs when on F is produced. Determine these two values.

/*Input. Execute (ctrl-enter) for results */
[wrC,wrF]: [diff(C,LC)/diff(C,TC),diff(F,LF)/diff(F,TF)];
wrMax: subst([TC=T,LC=L],wrC);
wrMin: subst([TF=T,LF=L],wrF);

Graph the two expressions for value of TLratio = T/L that range
from 0 to 5.

/*Input. Execute (ctrl-enter) for results */
wxdraw2d(xlabel="TLratio = T/L",ylabel="w/r",
 line_width=2, key="w/r in C", explicit(
 4.0*TLratio,TLratio,0,2),key ="w/r in F", 
 color=black,explicit((2/3)*TLratio,TLratio,0,2))$

### Marginal Costs and Relative Prices

The preceding analysis implies that that (LF/TF) = (3/8)*(LC/TC)
if w/r is the same in both sectors. Confirm this. 

/*Input. Execute (ctrl-enter) for results */
solve(wrC=wrF,LF); %/TF;

The relationship above does not provide an expression of either LF or 
TF in terms of LC. To work toward such an expression, introduce the price ratio, 
pC/pF, which must equal the ratio of marginal costs, mcC/mcF. Recall that 
mcC = w/diff(C,LC) -- or r/diff(C,TC), which we do not use. Likewise, 
mcF = W/diff(F,LF). 

Compute the ratios of these two marginal costs. For now, assign the name
temp to the result.

assume(pratio>0)$
mcC : w/diff(C,LC); mcF: w/diff(F,LF);   
mcC/mcF;
subst([LF= TF*(LC/TC)/6, TC = wrratio*LC/4],%);
soln_wrratio: solve(%=pratio,wrratio);

 /*Input. Execute (ctrl-enter) for results */
wr(pratio):= ''( rhs(soln_wrratio[1]) );

Confirm that given the endowments stipulated above, w/r can range from
3/4 to 2.

/*Input. Execute (ctrl-enter) for results */
wrMax0:subst([L=L0,T=T0],wrMax);
wrMin0:subst([L=L0,T=T0],wrMin);

Confirm that the ratio of marginal costs ranges from 0.841 to 1.723.
Assign the names pratioMax0 and pratioMin0 to the maximum and minimum
price ratios.

/*Input. Execute (ctrl-enter) for results */
float(solve(wr(pratio)=wrMax0,pratio));

pratioMax0 : rhs(%[5]);

Confirm that the ratio of marginal costs ranges from 0.794 to 0.967.

/*Input. Execute (ctrl-enter) for results */
float(solve(wr(pratio)=wrMin0,pratio));
pratioMin0 : rhs(%[5]);

Assign the right hand side of the expression above the name wrpexpr
(w/r ratio in terms of prices).

/*Input. Execute (ctrl-enter) for results */
pList: float(makelist(pratioMin0+.1*i*
  (pratioMax0-pratioMin0),i,0,10));
wrList: float(map(wr, pList))$     /*or wr(pList) */
TLCList: wrList/4$
TLFList: 2*wrList/3$
/* Not required: create a table */
VarValues: transpose(matrix(pList,wrList,TLCList,TLFList))$
VarNames: matrix(["pC/pF","w/r","T/L in C","T/L in F"])$
addrow(VarNames,VarValues);

/*Input. Execute (ctrl-enter) for results */
wxdraw2d(xlabel=
"price ratio", ylabel = "input price ratio, w/r",
 yrange=[0,wrMax0],
 explicit(wr(pratio),pratio,pratioMin0,pratioMax0))$

The allocations of labor and land can be related to LC, given
pratio. Define an expression TCline that states land in C in
terms of LC. Do the same for TF.

/*Input. Execute (ctrl-enter) for results */
TCline: rhs(solve(wrC=wr(pratio),TC)[1]);
 rhs(solve(wrF=wr(pratio),TF)[1]);
TFline:subst(LF=L-LC,%);

Draw an Edgeworth box that shows the total resource endowments.
Then graph TCline and TFline, defined above, against TC. 
Substitute L0 for L and pList[3] for pratio.

/*Input. Execute (ctrl-enter) for results */
wxdraw2d(user_preamble="set key bottom",
 axis_right=false,axis_top=false,
 xaxis=true,xrange=[0,1.3*L0], yrange=[-T0,1.1*T0],
color=black,line_type=dots, key="Edgeworth Box",
label(["F Origin", .95*L0,1.1*T0]),
label(["LF <--", .5*L0,1.1*T0]),
label(["TF, from F origin", 1.2*L0,0.5*T0]),
explicit(if LC<=L0 then T0 else 0,LC,0,L0),
xlabel = "LC -->", ylabel="TC, from C origin",
line_type=solid, line_width=2, 
key="C expansion path",
explicit(subst(pratio=pList[3],TCline),LC,0,L0),
color=blue, key="F expansion path, from F Origin",
explicit(T0- subst([L=L0,pratio=pList[3] ],TFline),LC,0,L0),
dimensions=[640,480]
)$

Solve TCline = T - TFline for LC. Express the resulting expression
as LC(pratio,L,T). Insert the values pList[3], L0, and T0 into the
expression to determine where the two lines above intersect.
Determine LC and TC.

/*Input. Execute (ctrl-enter) for results */
solve(TCline = T - TFline, LC);
LC(pratio,L,T) := ''(rhs(%[1]));
float(LC(pList[3],L0,T0));
float(subst([LC=%, pratio=pList[3]],TCline));

Now that we have L as a function of price and endowments, we
can determine the other variables. Use the relationships that
have been developed so far to create LF(pratio,L,T),TC(pratio,L,T),
and TF(pratio,L,T).

/*Input. Execute (ctrl-enter) for results */
LF(pratio,L,T):=''(L - LC(pratio,L,T));
TC(pratio,L,T):= ''(wr(pratio)*LC(pratio,L,T)/4);
TF(pratio,L,T):=''(T - TC(pratio,L,T));

To determine the production possibilities curve, use the
production functions to create two more functions: 
C(pratio,L,T) and F(pratio,L,T).

/*Input. Execute (ctrl-enter) for results */
C(pratio,L,T):= ''(subst([LC=LC(pratio,L,T),TC=TC(pratio,L,T)],C) );
F(pratio,L,T):= ''(subst([LF=LF(pratio,L,T),TF=TF(pratio,L,T)],F));

Define two prices: p0 as pList[3] and p1 as pList[7]. Determine
the two resulting values of C (assign them the names C0 and C1) 
and of F (assign them the names F0 and F1). 

/*Input. Execute (ctrl-enter) for results */
[p0,p1]: [pList[3],pList[7]]$
[C0: float(C(p0,L0,T0)), F0:float(F(p0,L0,T0))];
[C1: float(C(p1,L0,T0)), F1: float(F(p1,L0,T0))];

Determine the GDP for each of these two prices. Assign these
values the names GDP0 and GDP1. Suppose that
p0 is the autarkic price and p1 is the world price. Define
a variable that can be used to generate the country's 
consumption possibilities given GDP1 and p1.

/*Input. Execute (ctrl-enter) for results */
GDP0: F0 + p0*C0;
GDP1: F1 + p1*C1;
TradeBudgetLine: GDP1 - p1*Cconsumed;

Determine the maximum values of C and F that this economy can
produce (i. e., the end points of the production possibilities
curve). 

/*Input. Execute (ctrl-enter) for results */
Cmax0: float(subst([LC=L0,TC=T0],C)); 
Fmax0: float(subst([LF=L0,TF=T0],F));

Use parametric( ) to draw the production possibilities curve.

/*Input. Execute (ctrl-enter) for results */
wxdraw2d(xaxis=true,yaxis=true,
 xlabel="C",ylabel="F", key = "PPC", line_width=2,
parametric(C(pratio,L0,T0),F(pratio,L0,T0), pratio, pratioMin0,pratioMax0),
color=black, key="Budget Line with Trade",
explicit(TradeBudgetLine,Cconsumed,0,Cmax0),
line_type=dots, points_joined=true, key = "Autarkic Quantities",
points([ [0,F0],[C0,F0],[C0,0] ]),
color=orange,key="Quantities with Trade",
points([ [0,F1],[C1,F1],[C1,0] ]),
dimensions=[640,640])$

Let the price of F = 1, so we can determine w and r by evaluating the
derivatives of F with respect to L and T. Determine these two values
when p = p0. Confirm that the sum of the incomes of those providing
services of L and T equals GDP0.

/*Input. Execute (ctrl-enter) for results */
diff(F,LF)$
w0: float(subst([LF=LF(p0,L0,T0),TF=TF(p0,L0,T0)],%));
diff(F,TF);
r0: float(subst([LF=LF(p0,L0,T0),TF=TF(p0,L0,T0)],%));
w0*L0+r0*T0;

Repeat the steps in the preceding cell but with p = p1.

/*Input. Execute (ctrl-enter) for results */
diff(F,LF)$
w1: float(subst([LF=LF(p1,L0,T0),TF=TF(p1,L0,T0)],%));
diff(F,TF);
r1: float(subst([LF=LF(p1,L0,T0),TF=TF(p1,L0,T0)],%));
w1*L0 + r1*T0;

Confirm that w0 = p0*diff(C,LC) and r0 = p0*diff(C,TC).

/*Input. Execute (ctrl-enter) for results */
diff(C,LC)$
p0*float(subst([LC=LC(p0,L0,T0),TC=TC(p0,L0,T0)],%));
diff(C,TC);
p0*float(subst([LC=LC(p0,L0,T0),TC=TC(p0,L0,T0)],%));

Opening this country to trade reduces w and increases r, affecting 
incomes accordingly. The relative price of C increases. We cannot know
the net effect of these changes on the quantities demanded of C and F.
Suppose that C/F remains the same as before. Determine how much C
the country exports and how much F it imports. Confirm that the ratio
of imports to exports equals p1. 

/*Input. Execute (ctrl-enter) for results */
(F0/C0)*Cconsumed = TradeBudgetLine; float(solve(%),Cconsumed);
Cconsumed1 : rhs(%[1]);    Cexport1: C1 - Cconsumed1;
Fconsumed1 : subst(Cconsumed=Cconsumed1,TradeBudgetLine);
Fimport1: Fconsumed1 - F1;
Fimport1/Cexport1; pList[7];