Exercise 1:  International Trade 507

Fall, 2007

This exercise is based on Rob Feenstra’s empirical exercises at the end of Chapter 2 in his textbook, and on the data he kindly has made available on his web site. However, rather than use his Stata programs, it requires you to do some MATLAB programming. You are provided with a program to do part of the homework, and you will need to add to the program to complete the assignment.

Getting the data into MATLAB

Create a directory that will contain your MATLAB program, the data you will use, and your output. Put the file “hov_pub.csv” and the program files “ex1.m” and effic.m in this directory.

 

Open MATLAB and set the default directory to be the one you just created. In the “current directory” window you should see hov_pub.csv and ex1.m listed. Click on hov_pub.csv to open another window, where you can see some of the data. Click “next” and then “finish” to load these data into memory—they will be stored in a matrix named “data.” (Another file with the alphanumeric variables is also created named “textdata”—you don’t need this one.)

 

Documentation provided by Rob Feenstra

The file “hov_pub.csv” is an Excel (comma delimited) file containing the data for Trefler (1993, 1995). There are eight variables without labeling. The first column is the character variable COUNTRY, second is the character variable FACTOR. The are FACTOR CONTENT OF TRADE (at), ENDOWMENT (v), GDP (Y), and TRADE BALANCE (B), GDP PER-CAPITA (YPC) and POPULATION (POP). All data pertain to 1983.

There are 33 countries in the sample.  The variable FACTOR CONTENT OF TRADE is equal to A*T in Trefler’s paper, which is calculated using U.S. technology matrix.  ENDOWMENT includes 9 factors, capital, Labor endowment in professional/technical, Labor endowment in clerical, Labor endowment in sales, Labor endowment in service, Labor endowment in agriculture, Labor endowment in production, Cropland and Pasture.  Capital endowments were converted into dollars using PPP- adjusted exchange rates.  Cropland was measured in hectares.  GDP and TRADE BALANCE were converted into dollars.

You are to do the following

(1)   Construct country shares in global income, using the information on GDP.

 

(2)   Look at a scatterplot of the factor content graphed against predicted factor content. Do this first pooling factors, then one factor at a time.

 

(3)    Look at the cross-country correlation between measured factor contents of trade flows and predicted factor contents. Do this factor by factor, then pooling all countries.

 

(4)   Normalize both the predicted and the actual factor contents as in Trefler (1995). That is, for country c factor f  divide by the estimated standard deviation of the prediction error for factor f, weighted by the square root of country c’s share in global income.

 

(5)   Pool the data on all factors and countries, and estimate the country specific productivity parameters that Trefler defines.   Are these related to GDP per capita?

 

 

The program “ex1.m” takes you through the first two exercises, and in doing so gives you examples of how to reference columns in matrices, construct do loops, etc. To execute the program, open it in the MATLAB editor, pull down the “debug” menu at the top, and choose “run.”  Consult MATLAB help (click on the “?” ) to figure out what the commands do, then use similar commands to complete the assignment.

For part 5, you will need to use your knowledge of basic regression analysis, and you will need to create a function that calculates the sum of squared residuals. (I have done part of this for you—see the function effic.m .) This function can be called from the main program using the nonlinear least squares routine in MATLAB: lsqnonlin.