calibration close all; clear all; % ************************************ % "THE ROLE OF MULTINATIONAL PRODUCTION IN A RISKY ENVIRONMENT" % by NATALIA RAMONDO AND VERONICA RAPPOPORT % THIS VERSION: DECEMBER 2009. % % % % % % % THIS CODE IS FOR THE REVISED VERSION OF THE PAPER FOR JIE. THE MAIN CHANGE IS THAT WE INCORPORATE CONSUMPTION IN PERIOD 0 AND FIXED COSTS ARE PAID IN UNITS OF THIS GOOD. HENCE: the old variable for the price of the capital good is now the MU of consumption at time zero pk = C(0)^-sigma The resource constraints need to be adjusted accordingly in order to find the initial endowment of consumption good in the world, Y0. % ============================== % PARAMETERS sigma = 2; % risk aversion from BKK beta = 0.98; % discount eta = 3; % elasticity of substitution in CES from BrodaWeinstein gamma = 4; % pareto shape parameter from HMY alpha = 0.5; % labor share in manufacturing from AL z_min = 1; % normalization in pareto distribution % Other a = phi_1 = b = phi_3 = phi_0 = phi_2 = useful parameters 1 + gamma - eta; eta + alpha - 1; (1-alpha) / (eta-1); (alpha^alpha) *((1-alpha)^(1-alpha))* (eta/phi_1) * ((eta-1)/eta)^(alpha); (alpha^alpha) *((1-alpha)^(1-alpha))* ((eta-1)/eta)^(alpha); (alpha^alpha) *((1-alpha)^(1-alpha))* ((eta-1)/eta)^(1-alpha); % ============================== % ============================== % LOAD DATA load size % This file has the vector with equipped labor L_e (from K-RC, 05), avg. 90s, and realGDPpc (from PWT, "RGDPL") % Number of countries = 19 n = length(L_e); % Variable indicating the index for U.S. (the last country, ordered alphabetically) d_US = n; % Rename the labor size variable L = L_e; L = L/L(d_US); % relative to US L_w = sum(L); % world size % Variable needed due to the scale effect in the Pareto distribution: % G_i(z) = L_i G(z) where G(z) = 1-z^-gamma L_ij = repmat(L,1,n)./repmat(L,1,n)'; % this is L_i/L_j L_Z = L; % ============================== % MP shares load shares % variable is sh_ij where the diagonal is zero: [0 sh_21 sh_31 .... sh_n1; sh_12 0 sh_32 ... sh_n2; ... ; sh_1n sh_2n ... 0] Page 1 calibration % Row is recipient country j % Column is origin country i sh_ii = 1 - sum(sh_ij,2); % dometic share sh_ij = diag(sh_ii) + sh_ij; % fill in the diagonal sh_ii_matrix = repmat(sh_ii,1,n); % ============================== load mom_rgdpl_7004 % Matrix of cross-country correlations (CORR) and vector with s.d. (STD_) of log of RGDPL (H-P filtered, ciclycal component), % the variable AVG_ is the average of log of RGDPL, no H-P filtered % All variables are for the period 1970-2004 % This file is the output of the code rgdpl_filtering in the folder "rgdpl % filtering" % ============================== % ============================== % Calibrating the bilateral cut-offs from i to j, from observed MP shares % and size. z_ij = max(z_min*ones(n,n),(L_ij.*sh_ij./(sh_ii_matrix/z_min)).^(-1/a)); % z_ij_bar Z_ij = gamma/a * repmat(L_Z,1,n)'.* z_ij.^(-a); % productivity index for firms from i in j, Z_ij Z_j = sum(Z_ij,2) ; % aggregate productivity index in j, Z_j clear shares % ============================== % Calibrating the process for the country shocks % We assume log-Normal % Mean for log A r_GDPpc = CGDP; r_GDPpc = r_GDPpc/r_GDPpc(d_US); A_m = r_GDPpc.* (Z_j/Z_j(d_US)).^-b; % vector Ix1 % VAR-COV Matrix for log A = VAR-COV Matrix for log realGDPpc D = STD_; % STD = var^0.5; vector Ix1 SIGMA = (diag(D)*ones(n,n)).*(diag(D)*ones(n,n))'.*CORR; % corr_ij * sd_i * sd_j; matrix IxI S = 500000; % number of draws log_A = mvg(log(A_m),SIGMA,S); % matrix IxS from a multivariate-normal distribution A = exp(log_A); % the shock in levels, matrix IxS Pr = (1/S)*ones(S,1); % Recall that draws are already made from a CDF that was log-normal. Hence, they already have the right frecuency. % That is why we use a uniform probability across states % Our measure of weight in the paper weightBench = (L.*Z_j.^b)/sum(L.*Z_j.^b); % World average shock as defined in the paper A_w = weightBench' * A; % a row vector 1XS % Consumption risk premium for the calibrated model: u[E(C_i)(1-rho)] = E[u(C_i)] rhoBench = 1 - mean(A_w.^(1-sigma))^(1/(1-sigma))/mean(A_w); Page 2 calibration % Initialize matrices corr_YYw = zeros(n,1); corr_YYw_a = zeros(n,1); corr_YYw_c1 = zeros(n,1); corr_YYw_c2 = zeros(n,1); COR_A_A_w_s = zeros(n,1); % ============================== % % ============================== % CALIBRATION OF THE FIXED COSTS % FINAL OUTPUT BY COUNTRY AND STATE s Y = phi_3 * repmat(L,1,S) .* (repmat(Z_j,1,S).^b) .* A; % matrix of IxS % WORLD OUPUT BY STATE Y_w = sum(Y); % vector of 1xS % Correlation between country output and world output for i=1:n aa = corrcoef(Y(i,:)',Y_w); corr_YYw(i) = aa(1,2); end % Arrow-Debreu Prices qs = beta * Y_w'.^(-sigma).*Pr; % vector of Sx1 Qs = qs/sum(qs); % vector of Sx1 clear qs % Expected Value of doing MP from i in j Prof_ij = sum_s q(s)*prof_ij(s) for a % firm with productivity z_ij -the marginal firm Prof_ij = ((1-alpha)/eta)* (z_ij.^(eta-1) ./repmat(Z_j,1,n)) .* repmat(Y*Qs,1,n); % matrix of IxI where j=row, i=column clear Qs Y % Here, we pin down MU of aggregate consumption at time 0: % pk = C(0)^-sigma. The Normalization is f_{us,1} = 1. Hence, we take the % expected profits for i=US and j=US (d_US is the index for the US) pk = Prof_ij(1,d_US); C0 = pk^(-1/sigma); % USING ZPC: V_ij = f_ij = Prof_ij/pk; Prof_ij * C(0)^sigma = Prof_ij/pk =f_ij % Compute the number of multinationals from i to n using the Pareto G_ij = 1 - (z_min./z_ij).^gamma; Y_0 = sum(sum(repmat(L_Z,1,n)'.*(1- G_ij).*f_ij)) + C0; % Correlation between country shocks A_i and A_w^-sigma for i=1:n CCC = corrcoef(A(i,:), A_w.^-sigma); COR_A_A_w_s(i) = CCC(1,2); end clear A_w % ================================ % COUNTERFACTUAL: ECONOMY WITH NO MP -only domestic firms but complete % financial markets % Productivity index under autarky Z_j_a = (gamma/a) *L_Z* (z_min^-a); Page 3 calibration % Country final outpuf in each state s Y_a = phi_3 * repmat(L,1,S).* (repmat(Z_j_a,1,S).^b) .* A; % matrix of IxS % World output in state s Y_w_a = sum(Y_a); % vector Sx1 % Correlation between country output and world output under no MP for i=1:n aa = corrcoef(Y_a(i,:)',Y_w_a); corr_YYw_a(i) = aa(1,2); end % Total change in welfare between no MP and the calibrated world with MP Welfare =(Y_0+beta*(Y_w_a.^(1-sigma)*Pr))/ (Y_0 + beta*(Y_w.^(1-sigma)*Pr)); clear Y_w_a Y_a % Country weight varphi under no MP weightAut = (L.*Z_j_a.^b)/sum(L.*Z_j_a.^b); % vector Ix1 A_w_a = weightAut' * A; % vector Sx1 = (Ix1)' * (IxS) % Consumption risk premium in a world with no MP rhoAut = 1 - mean(A_w_a.^(1-sigma))^(1/(1-sigma))/mean(A_w_a); clear A_w_a % ========================================================================= % COUNTERFACTUAL: ECONOMY WITH frictionless MP FROM U.S. but NO MP FOR THE REST % f_(US,j) == 0 and f_(i,j) --> Inf for all i~=US % Productivity index under this counterfactual for each country except the % US: Z_ij Z_ij_c1 = diag(Z_j_a); % Productivity index for the US abroad: Z_(US,j) Z_ij_c1(:,d_US) = gamma/a * L_Z(d_US) * z_min^(-a); % Aggregate productivity index Z_j Z_j_c1 = sum(Z_ij_c1,2) ; % Country Output in each s Y = phi_3 * repmat(L,1,S) .* (repmat(Z_j_c1,1,S).^b) .* A; % matrix of IxS % World Otuput in each s Y_w = sum(Y); % vector 1xS % Correlation of country and world output for i=1:n aa = corrcoef(Y(i,:)',Y_w); corr_YYw_c1(i) = aa(1,2); end clear Y Y_w % Country's weight varpi weight = (L.*Z_j_c1.^b)/sum(L.*Z_j_c1.^b); A_w = weight' * A; % a row vector 1XS % Consumption risk premium rho_f_US_out = 1 - mean(A_w.^(1-sigma))^(1/(1-sigma))/mean(A_w); clear A_w Page 4 calibration % ========================================================================= % COUNTERFACTUAL: ECONOMY WITH frictionless MP INTO US but no MP FOR THE REST % f_(i,US) and f_(i,j) for all i~=US, and j % Productivity index Z_ij Z_ij_c2 = diag(Z_j_a); % Productivity index for US Z_(i,US) -the US is recipient Z_ij_c2(d_US,:) = gamma/a * L_Z* z_min^(-a); % CAREFUL!! The US is recipient and that is row=d_US=19 % Aggregate productivity index Z_j_c2 = sum(Z_ij_c2,2) ; % Ix1 % Country output in state s Y = phi_3 * repmat(L,1,S) .* (repmat(Z_j_c2,1,S).^b) .* A; % matrix of IxS % World output in state s Y_w = sum(Y); % vector 1xS % Correlation between country's output and world output for i=1:n aa = corrcoef(Y(i,:)',Y_w); corr_YYw_c2(i) = aa(1,2); end clear Y Y_w % Country's weight varpi weight = (L.*Z_j_c2.^b)/sum(L.*Z_j_c2.^b); A_w = weight' * A; % vector 1XS % Consumption risk premium rho_f_US_in = 1 - mean(A_w.^(1-sigma))^(1/(1-sigma))/mean(A_w); clear A_w % ================================= % OUTPUT % ENTRY f_in f_in f_out f_out COSTS = median(f_ij,2); = f_in/f_in(d_US); = median(f_ij)'; = f_out/f_out(d_US); % TECHNOLOGY FLOWS OUTWARD, INWARD, NET TECH_out = (sum(Z_ij,1)' - diag(Z_ij))./(sum(sum(Z_ij,1))' - sum(diag(Z_ij))); TECH_in = (sum(Z_ij,2) - diag(Z_ij))./(sum(sum(Z_ij,1))' - sum(diag(Z_ij))); TECH_net = TECH_out - TECH_in; % OUTPUT FOR TABLES IN THE MAIN BODY OF THE PAPER BENCH = [weightBench COR_A_A_w_s f_out f_in TECH_out*100 TECH_in*100 TECH_net*100]; results = [(rhoBench/rhoAut-1)*100 (rho_f_US_out/rhoAut-1)*100 (rho_f_US_in/rhoAut-1)*100]; COR_YYw = [corr_YYw corr_YYw_a corr_YYw_c1 corr_YYw_c2]; Page 5 decomposition_RiskEffect close all; clear all; % ================================================ % % COUNTERFACTUAL: ECONOMY with EQUAL SIZE and CALIBRATED SHOCKS PROCESS % ============================== % PARAMETERS sigma = 2; % risk aversion from BKK beta = 0.98; % discount eta = 3; % elasticity of substitution in CES from BrodaWeinstein gamma = 4; % pareto shape parameter from HMY alpha = 0.5; % labor share in manufacturing from AL z_min = 1; % normalization in pareto distribution % Other a = phi_1 = b = phi_3 = phi_0 = phi_2 = useful parameters 1 + gamma - eta; eta + alpha - 1; (1-alpha) / (eta-1); (alpha^alpha) *((1-alpha)^(1-alpha))* (eta/phi_1) * ((eta-1)/eta)^(alpha); (alpha^alpha) *((1-alpha)^(1-alpha))* ((eta-1)/eta)^(alpha); (alpha^alpha) *((1-alpha)^(1-alpha))* ((eta-1)/eta)^(1-alpha); % ============================== % ============================== % LOAD DATA load size % This file has the vector with equipped labor L_e (from K-RC, 05), avg. 90s, and realGDPpc (from PWT, "RGDPL") % Number of countries = 19 n = length(L_e); % Variable indicating the index for U.S. (the last country, ordered alphabetically) d_US = n; % WE WANT COUNTRIES OF EQUAL SIZE L_w = sum(L_e/L_e(d_US)); % world size L = ones(n,1)*L_w/n; % Variable needed due to the scale effect in the Pareto distribution: % G_i(z) = L_i G(z) where G(z) = 1-z^-gamma L_ij = repmat(L,1,n)./repmat(L,1,n)'; % this is L_i/L_j L_Z = L; % ============================== % MP shares load shares % variable is sh_ij where the diagonal is zero: [0 sh_21 sh_31 .... sh_n1; sh_12 0 sh_32 ... sh_n2; ... ; sh_1n sh_2n ... 0] % Row is recipient country j % Column is origin country i sh_ii = 1 - sum(sh_ij,2); % dometic share sh_ij = diag(sh_ii) + sh_ij; % fill in the diagonal sh_ii_matrix = repmat(sh_ii,1,n); % ============================== load mom_rgdpl_7004 Page 1 decomposition_RiskEffect % Matrix of cross-country correlations (CORR) and vector with s.d. (STD_) of log of RGDPL (H-P filtered, ciclycal component), % the variable AVG_ is the average of log of RGDPL, no H-P filtered % All variables are for the period 1970-2004 % This file is the output of the code rgdpl_filtering in the folder "rgdpl % filtering" % ============================== % ============================== % Calibrating the bilateral cut-offs from i to j, from observed MP shares % and size. z_ij = max(z_min*ones(n,n),(L_ij.*sh_ij./(sh_ii_matrix/z_min)).^(-1/a)); % z_ij_bar Z_ij = gamma/a * repmat(L_Z,1,n)'.* z_ij.^(-a); % productivity index for firms from i in j, Z_ij Z_j = sum(Z_ij,2) ; % aggregate productivity index in j, Z_j clear shares % ============================== weight = (L.*Z_j.^b)/sum(L.*Z_j.^b); % ============================== % Calibrating the process for the country shocks % We assume log-Normal % Mean for log A r_GDPpc = CGDP; r_GDPpc = r_GDPpc/r_GDPpc(d_US); A_m = r_GDPpc.* (Z_j/Z_j(d_US)).^-b; % vector Ix1 % VAR-COV Matrix for log A = VAR-COV Matrix for log realGDPpc D = STD_; % STD = var^0.5; vector Ix1 SIGMA = (diag(D)*ones(n,n)).*(diag(D)*ones(n,n))'.*CORR; % corr_ij * sd_i * sd_j; matrix IxI S = 500000; % number of draws log_A = mvg(log(A_m),SIGMA,S); % matrix IxS from a multivariate-normal distribution A = exp(log_A); % the shock in levels, matrix IxS clear log_A % ECONOMY Z_j_a weightAut A_w rho rhoAut WITH NO MP AND COUNTRIES WITH EQUAL SIZE = (gamma/a) * (z_min^-a)*L_Z; = (L.*Z_j_a.^((1-alpha)/(eta-1)))/sum(L.*Z_j_a.^((1-alpha)/(eta-1))); = weightAut' * A; % a row vector 1XS = 1 - mean((weight' * A).^(1-sigma))^(1/(1-sigma))/mean(weight' * A); = 1 - mean(A_w.^(1-sigma))^(1/(1-sigma))/mean(A_w); RiskEffect = (rho/rhoAut - 1)*100; Page 2 decomposition_SizeEffect close all; clear all; % ================================================================= % COUNTERFACTUAL: ECONOMY with IID SHOCKS but ASYMMETRIC SIZE % ============================== % PARAMETERS sigma = 2; % risk aversion from BKK beta = 0.98; % discount eta = 3; % elasticity of substitution in CES from BrodaWeinstein gamma = 4; % pareto shape parameter from HMY alpha = 0.5; % labor share in manufacturing from AL z_min = 1; % normalization in pareto distribution % Other a = phi_1 = b = phi_3 = phi_0 = phi_2 = useful parameters 1 + gamma - eta; eta + alpha - 1; (1-alpha) / (eta-1); (alpha^alpha) *((1-alpha)^(1-alpha))* (eta/phi_1) * ((eta-1)/eta)^(alpha); (alpha^alpha) *((1-alpha)^(1-alpha))* ((eta-1)/eta)^(alpha); (alpha^alpha) *((1-alpha)^(1-alpha))* ((eta-1)/eta)^(1-alpha); % ============================== % ============================== % LOAD DATA load size % This file has the vector with equipped labor L_e (from K-RC, 05), avg. 90s, and realGDPpc (from PWT, "RGDPL") % Number of countries = 19 n = length(L_e); % Variable indicating the index for U.S. (the last country, ordered alphabetically) d_US = n; % Rename the labor size variable L = L_e; L = L/L(d_US); % relative to US L_w = sum(L); % world size % Variable needed due to the scale effect in the Pareto distribution: % G_i(z) = L_i G(z) where G(z) = 1-z^-gamma L_ij = repmat(L,1,n)./repmat(L,1,n)'; % this is L_i/L_j L_Z = L; % ============================== % MP shares load shares % variable is sh_ij where the diagonal is zero: [0 sh_21 sh_31 .... sh_n1; sh_12 0 sh_32 ... sh_n2; ... ; sh_1n sh_2n ... 0] % Row is recipient country j % Column is origin country i sh_ii = 1 - sum(sh_ij,2); % dometic share sh_ij = diag(sh_ii) + sh_ij; % fill in the diagonal sh_ii_matrix = repmat(sh_ii,1,n); % ============================== Page 1 decomposition_SizeEffect load mom_rgdpl_7004 % Matrix of cross-country correlations (CORR) and vector with s.d. (STD_) of log of RGDPL (H-P filtered, ciclycal component), % the variable AVG_ is the average of log of RGDPL, no H-P filtered % All variables are for the period 1970-2004 % This file is the output of the code rgdpl_filtering in the folder "rgdpl % filtering" % ============================== % ============================== % Calibrating the bilateral cut-offs from i to j, from observed MP shares % and size. z_ij = max(z_min*ones(n,n),(L_ij.*sh_ij./(sh_ii_matrix/z_min)).^(-1/a)); % z_ij_bar Z_ij = gamma/a * repmat(L_Z,1,n)'.* z_ij.^(-a); % productivity index for firms from i in j, Z_ij Z_j = sum(Z_ij,2) ; % aggregate productivity index in j, Z_j clear shares % ============================== % Compute the weight of each country under this counterfactual --do not % change with respect to benchmark weight = (L.*Z_j.^b)/sum(L.*Z_j.^b); % Mean for log A r_GDPpc = CGDP; r_GDPpc = r_GDPpc/r_GDPpc(d_US); A_m = r_GDPpc.* (Z_j/Z_j(d_US)).^-b; % We assume i.i.d shocks with the median observed SD and mean. A_m = ones(n,1)*median(A_m); D = median(STD_)*ones(n,1); SIGMA = diag(D.^2).*eye(n); S = 500000; log_A = mvg(log(A_m),SIGMA,S); A = exp(log_A); clear log_A % ECONOMY WITH NO MP AND IID SHOCKS Z_j_a = (gamma/a) * (z_min^-a)*L_Z; weightAut = (L.*Z_j_a.^((1-alpha)/(eta-1)))/sum(L.*Z_j_a.^((1-alpha)/(eta-1))); % Consumption rho = 1 % Consumption rhoAut = 1 - risk premium with i.i.d. shocks mean((weight' * A).^(1-sigma))^(1/(1-sigma))/mean(weight' * A); risk premium with i.i.d. shocks and no MP mean((weightAut' * A).^(1-sigma))^(1/(1-sigma))/mean(weightAut' * A); % Change in consumption risk premium SizeEffect = (rho/rhoAut - 1)*100; Page 2