%EMERGE  Load IFS, OECD, and ILO data for the following seven countries:
%
%              Argentina   (Codes: AR, 213)
%              Indonesia   (Codes: ID, 536)
%              Korea       (Codes: KO, 542)
%              Mexico      (Codes: MX, 273)
%              Taiwan      (Codes: TA, 528)
%              Thailand    (Codes: TH, 578)
%              USA         (Codes: US, 111)
%

%        Ellen McGrattan, 12-27-04     


%
% User inputs (fill in final section with desired results)
%    y0     = first year of sample (>= 1948)
%    y1     = last year of sample  (<= 2004)
%
y0    = 1948;
y1    = 2004;

%--------------------------------------------------------------------------
%
% INTERNATIONAL FINANCIAL STATISTICS (see README in ./ifs)
%
%--------------------------------------------------------------------------
%
%------------------------
%L00AE-A.txt, L00AE-Q.txt 
%------------------------
%
%  Description: Exchange rate per dollar, end of period 
%  Columns:
%      (1) Year or Year.Qtr
%      (2) Argentina, 213..AE.ZF...,  Official rate
%      (3) Indonesia, 536..AE.ZF...,  Market rate
%      (4) Korea,     542..AE.ZF...,  Market rate
%      (5) Mexico,    273..AE.ZF...,  Principal rate
%      (6) Thailand,  578..AE.ZF...,  Official rate
%      (7) US,        111..AE.ZF...,  Market rate

load ./ifs/L00AE-A.dat
load ./ifs/L00AE-Q.dat

iEeop_ar_a  = L00AE_A(:,2);
iEeop_id_a  = L00AE_A(:,3);
iEeop_ko_a  = L00AE_A(:,4);
iEeop_mx_a  = L00AE_A(:,5);
iEeop_th_a  = L00AE_A(:,6);
iEeop_us_a  = L00AE_A(:,7);
iEeop_ar_q  = L00AE_Q(:,2);
iEeop_id_q  = L00AE_Q(:,3);
iEeop_ko_q  = L00AE_Q(:,4);
iEeop_mx_q  = L00AE_Q(:,5);
iEeop_th_q  = L00AE_Q(:,6);
iEeop_us_q  = L00AE_Q(:,7);

%L00AF-A.txt, L00AF-Q.txt
%------------------------
%
%  Description: Exchange rate per dollar, period average
%  Columns:
%      (1) Year or Year.Qtr
%      (2) Argentina, 213..AF.ZF...,  Official rate
%      (3) Indonesia, 536..AF.ZF...,  Market rate
%      (4) Korea,     542..AF.ZF...,  Market rate
%      (5) Mexico,    273..AF.ZF...,  Principal rate
%      (6) Thailand,  578..AF.ZF...,  Official rate
%      (7) US,        111..AF.ZF...,  Market rate

load ./ifs/L00AF-A.dat
load ./ifs/L00AF-Q.dat

iEavg_ar_a  = L00AF_A(:,2);
iEavg_id_a  = L00AF_A(:,3);
iEavg_ko_a  = L00AF_A(:,4);
iEavg_mx_a  = L00AF_A(:,5);
iEavg_th_a  = L00AF_A(:,6);
iEavg_us_a  = L00AF_A(:,7);
iEavg_ar_q  = L00AF_Q(:,2);
iEavg_id_q  = L00AF_Q(:,3);
iEavg_ko_q  = L00AF_Q(:,4);
iEavg_mx_q  = L00AF_Q(:,5);
iEavg_th_q  = L00AF_Q(:,6);
iEavg_us_q  = L00AF_Q(:,7);


% L60B-A.txt, L60B-Q.txt
%------------------------
%
%  Description: Money market rate, percent per annum
%  Columns:
%      (1) Year or Year.Qtr
%      (2) Argentina, 21360B..ZF...,  Money market rate
%      (3) Indonesia, 53660B..ZF...,  Call money rate
%      (4) Korea,     54260B..ZF...,  Money market rate
%      (5) Mexico,    27360B..ZF...,  Bankers' acceptances 
%      (6) Thailand,  57860B..ZF...,  Money market rate
%      (7) US,        11160B..ZF...,  Federal funds rate

load ./ifs/L60B-A.dat
load ./ifs/L60B-Q.dat

iRS_ar_a  = L60B_A(:,2);
iRS_id_a  = L60B_A(:,3);
iRS_ko_a  = L60B_A(:,4);
iRS_mx_a  = L60B_A(:,5);
iRS_th_a  = L60B_A(:,6);
iRS_us_a  = L60B_A(:,7);
iRS_ar_q  = L60B_Q(:,2);
iRS_id_q  = L60B_Q(:,3);
iRS_ko_q  = L60B_Q(:,4);
iRS_mx_q  = L60B_Q(:,5);
iRS_th_q  = L60B_Q(:,6);
iRS_us_q  = L60B_Q(:,7);


%L60BC-A.txt, L60BC-Q.txt
%------------------------
%
%  Description: Corporate bond rate, percent per annum
%  Columns:
%      (1) Year or Year.Qtr
%      (2) Korea,     54260BC.ZF...,  Corporate bond rate
%      (3) US,        11160BC.ZF...,  Commercial paper rate
%

load ./ifs/L60BC-A.dat
load ./ifs/L60BC-Q.dat

iRCorp_ko_a  = L60BC_A(:,2);
iRCorp_us_a  = L60BC_A(:,3);
iRCorp_ko_q  = L60BC_Q(:,2);
iRCorp_us_q  = L60BC_Q(:,3);


%L60C-A.txt, L60C-Q.txt
%------------------------
%
%  Description: Treasury bill rate, percent per annum
%  Columns:
%      (1) Year or Year.Qtr
%      (2) Mexico,    27360C..ZF...,  Treasury bill rate
%      (3) Thailand,  57860C..ZF...,  Government securities: bills
%      (4) US,        11160C..ZF...,  Treasury bill rate
%

load ./ifs/L60C-A.dat
load ./ifs/L60C-Q.dat

iRBill_mx_a  = L60C_A(:,2);
iRBill_th_a  = L60C_A(:,3);
iRBill_us_a  = L60C_A(:,4);
iRBill_mx_q  = L60C_Q(:,2);
iRBill_th_q  = L60C_Q(:,3);
iRBill_us_q  = L60C_Q(:,4);

%L60L-A.txt, L60L-Q.txt
%------------------------
%
%  Description: Deposit rate, percent per annum
%  Columns:
%      (1) Year or Year.Qtr
%      (2) Argentina, 21360L..ZF...,  Deposit rate
%      (3) Indonesia, 53660L..ZF...,  3-month deposits nc
%      (4) Korea,     54260L..ZF...,  Time Deposit at DMB: 1 year or more
%      (5) Mexico,    27360L..ZF...,  Time deposit rate
%      (6) Thailand,  57860L..ZF...,  Deposit rate
%      (7) US,        11160L..ZF...,  CDs (secondary market), 3 month



%L60N-A.txt, L60N-Q.txt
%------------------------
%
%  Description: Average cost of funds, percent per annum
%  Columns:
%      (1) Year or Year.Qtr
%      (2) Mexico,    27360L..ZF...,  Average cost of funds

load ./ifs/L60N-A.dat
load ./ifs/L60N-Q.dat

iRAcost_mx_a  = L60N_A(:,2);
iRAcost_mx_q  = L60N_Q(:,2);


%L60P-A.txt, L60P-Q.txt
%------------------------
%
%  Description: Lending rate, percent per annum
%  Columns:
%      (1) Year or Year.Qtr
%      (2) Argentina, 21360P..ZF...,  Lending rate
%      (3) Indonesia, 53660P..ZF...,  Working capital loans nc
%      (4) Korea,     54260P..ZF...,  Lending rate on DMB loans: minimum
%      (5) Mexico,    27360P..ZF...,  Lending rate
%      (6) Thailand,  57860P..ZF...,  Lending rate
%      (7) US,        11160P..ZF...,  Bank prime loan rate

load ./ifs/L60P-A.dat
load ./ifs/L60P-Q.dat

iRLend_ar_a  = L60P_A(:,2);
iRLend_id_a  = L60P_A(:,3);
iRLend_ko_a  = L60P_A(:,4);
iRLend_mx_a  = L60P_A(:,5);
iRLend_th_a  = L60P_A(:,6);
iRLend_us_a  = L60P_A(:,7);
iRLend_ar_q  = L60P_Q(:,2);
iRLend_id_q  = L60P_Q(:,3);
iRLend_ko_q  = L60P_Q(:,4);
iRLend_mx_q  = L60P_Q(:,5);
iRLend_th_q  = L60P_Q(:,6);
iRLend_us_q  = L60P_Q(:,7);

%L61-A.txt, L61-Q.txt
%------------------------
%
%  Description: Government bond yield long-term, percent per annum
%  Columns:
%      (1) Year or Year.Qtr
%      (2) Korea,     54261...ZF...,  Yield on national housing bonds
%      (3) Mexico,    27361...ZF...,  Government bond yield
%      (4) Thailand,  57861...ZF...,  Government bond yield
%      (5) US,        11161...ZF...,  Government bond yield, 10 year

load ./ifs/L61-A.dat
load ./ifs/L61-Q.dat

iRYld_ko_a  = L61_A(:,2);
iRYld_mx_a  = L61_A(:,3);
iRYld_th_a  = L61_A(:,4);
iRYld_us_a  = L61_A(:,5);
iRYld_ko_q  = L61_Q(:,2);
iRYld_mx_q  = L61_Q(:,3);
iRYld_th_q  = L61_Q(:,4);
iRYld_us_q  = L61_Q(:,5);


%L64-A.txt, L64-Q.txt
%------------------------
%
%  Description: Consumer price index
%  Columns:
%      (1) Year or Year.Qtr
%      (2) Argentina, 21361..ZF...  
%      (3) Indonesia, 53661..ZF...
%      (4) Korea,     54261..ZF...
%      (5) Mexico,    27361..ZF...
%      (6) Thailand,  57861..ZF...
%      (7) US,        11161..ZF...
%
%  NOTE: there is a problem with the IFS Qtrly series for Mexico
%        in the period 1970-1976

load ./ifs/L64-A.dat
load ./ifs/L64-Q.dat

iCPI_ar_a  = L64_A(:,2);
iCPI_id_a  = L64_A(:,3);
iCPI_ko_a  = L64_A(:,4);
iCPI_mx_a  = L64_A(:,5);
iCPI_th_a  = L64_A(:,6);
iCPI_us_a  = L64_A(:,7);
iCPI_ar_q  = L64_Q(:,2);
iCPI_id_q  = L64_Q(:,3);
iCPI_ko_q  = L64_Q(:,4);
iCPI_mx_q  = L64_Q(:,5);
iCPI_th_q  = L64_Q(:,6);
iCPI_us_q  = L64_Q(:,7);
iCPI_mx_q(89:116) = iCPI_mx_q(89:116)*mean(iCPI_mx_a(23:29))/ ...
                                      mean(iCPI_mx_q(89:116));

%L67D-A.txt, L67D-Q.txt
%------------------------
%
%  Description: Labor force
%  Columns:
%      (1) Year or Year.Qtr
%      (2) Argentina, 21367D..ZF...  
%      (3) Indonesia, 53667D..ZF...
%      (4) Korea,     54267D..ZF...
%      (5) Mexico,    27367D..ZF...
%      (6) Thailand,  57867D..ZF...
%      (7) US,        11167D..ZF...

load ./ifs/L67D-A.dat
load ./ifs/L67D-Q.dat

iLF_ar_a  = L67D_A(:,2);
iLF_id_a  = L67D_A(:,3);
iLF_ko_a  = L67D_A(:,4);
iLF_mx_a  = L67D_A(:,5);
iLF_th_a  = L67D_A(:,6);
iLF_us_a  = L67D_A(:,7);
iLF_th_q  = L67D_Q(:,6);
iLF_us_q  = L67D_Q(:,7);

%L67E-A.txt, L67E-Q.txt
%------------------------
%
%  Description: Labor force
%  Columns:
%      (1) Year or Year.Qtr
%      (2) Argentina, 21367E..ZF...  
%      (3) Indonesia, 53667E..ZF...
%      (4) Korea,     54267E..ZF...
%      (5) Mexico,    27367E..ZF...
%      (6) Thailand,  57867E..ZF...
%      (7) US,        11167E..ZF...

load ./ifs/L67E-A.dat
load ./ifs/L67E-Q.dat

iEMP_ar_a  = L67E_A(:,2);
iEMP_id_a  = L67E_A(:,3);
iEMP_ko_a  = L67E_A(:,4);
iEMP_mx_a  = L67E_A(:,5);
iEMP_th_a  = L67E_A(:,6);
iEMP_us_a  = L67E_A(:,7);
iEMP_ko_q  = L67E_Q(:,4);
iEMP_th_q  = L67E_Q(:,6);
iEMP_us_q  = L67E_Q(:,7);


%L90C-A.txt, L90C-Q.txt
%------------------------
%
%  Description: Exports of goods and services in national currency
%  Columns:
%      (1) Year or Year.Qtr
%      (2) Argentina, 21390C..ZF..., Millions  
%      (3) Indonesia, 53690C..ZF..., Billions
%      (4) Korea,     54290C..ZF..., Billions
%      (5) Thailand,  57890C..ZF..., Billions
%      (6) Mexico,    27390C.CZF..., Billions (SA)
%      (7) US,        11190C.CZF..., Billions

load ./ifs/L90C-A.dat
load ./ifs/L90C-Q.dat

iEX_ar_a  = L90C_A(:,2);
iEX_id_a  = L90C_A(:,3);
iEX_ko_a  = L90C_A(:,4);
iEX_th_a  = L90C_A(:,5);
iEX_mx_a  = L90C_A(:,6);
iEX_us_a  = L90C_A(:,7);
iEX_ar_q  = L90C_Q(:,2);
iEX_id_q  = L90C_Q(:,3);
iEX_ko_q  = L90C_Q(:,4);
iEX_th_q  = L90C_Q(:,5);
iEX_mx_q  = L90C_Q(:,6);
iEX_us_q  = L90C_Q(:,7);

%L91F-A.txt, L91F-Q.txt
%------------------------
%
%  Description: Government consumption expenditures in national currency
%  Columns:
%      (1) Year or Year.Qtr
%      (2) Argentina, 21391F..ZF..., Millions  
%      (3) Indonesia, 53691F..ZF..., Billions
%      (4) Korea,     54291F..ZF..., Billions
%      (6) Thailand,  57891F..ZF..., Billions 
%      (5) Mexico,    27391F.CZF..., Billions (SA)
%      (7) US,        11191F.CZF..., Billions

load ./ifs/L91F-A.dat
load ./ifs/L91F-Q.dat

iGC_ar_a  = L91F_A(:,2);
iGC_id_a  = L91F_A(:,3);
iGC_ko_a  = L91F_A(:,4);
iGC_th_a  = L91F_A(:,5);
iGC_mx_a  = L91F_A(:,6);
iGC_us_a  = L91F_A(:,7);
iGC_ar_q  = L91F_Q(:,2);
iGC_id_q  = L91F_Q(:,3);
iGC_ko_q  = L91F_Q(:,4);
iGC_th_q  = L91F_Q(:,5);
iGC_mx_q  = L91F_Q(:,6);
iGC_us_q  = L91F_Q(:,7);

%L93E-A.txt, L93E-Q.txt
%------------------------
%
%  Description: Gross fixed capital formation in national currency
%  Columns:
%      (1) Year or Year.Qtr
%      (2) Argentina, 21393E..ZF..., Millions  
%      (3) Indonesia, 53693E..ZF..., Billions
%      (4) Korea,     54293E..ZF..., Billions
%      (5) Thailand,  57893E..ZF..., Billions 
%      (6) Mexico,    27393E.CZF..., Billions (SA)
%      (7) US,        11193E.CZF..., Billions

load ./ifs/L93E-A.dat
load ./ifs/L93E-Q.dat

iIF_ar_a  = L93E_A(:,2);
iIF_id_a  = L93E_A(:,3);
iIF_ko_a  = L93E_A(:,4);
iIF_th_a  = L93E_A(:,5);
iIF_mx_a  = L93E_A(:,6);
iIF_us_a  = L93E_A(:,7);
iIF_ar_q  = L93E_Q(:,2);
iIF_id_q  = L93E_Q(:,3);
iIF_ko_q  = L93E_Q(:,4);
iIF_th_q  = L93E_Q(:,5);
iIF_mx_q  = L93E_Q(:,6);
iIF_us_q  = L93E_Q(:,7);

%L93I-A.txt, L93I-Q.txt
%------------------------
%
%  Description: Change in inventories in national currency
%  Columns:
%      (1) Year or Year.Qtr
%      (2) Argentina, 21393I..ZF..., Millions  
%      (3) Indonesia, 53693I..ZF..., Billions
%      (4) Korea,     54293I..ZF..., Billions
%      (5) Thailand,  57893I..ZF..., Billions 
%      (6) Mexico,    27393I.CZF..., Billions (SA)
%      (7) US,        11193I.CZF..., Billions

load ./ifs/L93I-A.dat
load ./ifs/L93I-Q.dat

iII_ar_a  = L93I_A(:,2);
iII_id_a  = L93I_A(:,3);
iII_ko_a  = L93I_A(:,4);
iII_th_a  = L93I_A(:,5);
iII_mx_a  = L93I_A(:,6);
iII_us_a  = L93I_A(:,7);
iII_ar_q  = L93I_Q(:,2);
iII_id_q  = L93I_Q(:,3);
iII_ko_q  = L93I_Q(:,4);
iII_th_q  = L93I_Q(:,5);
iII_mx_q  = L93I_Q(:,6);
iII_us_q  = L93I_Q(:,7);

%L96F-A.txt, L96F-Q.txt
%------------------------
%
%  Description: Household consumption expenditures in national currency
%  Columns:
%      (1) Year or Year.Qtr
%      (2) Argentina, 21396F..ZF..., Millions  
%      (3) Indonesia, 53696F..ZF..., Billions
%      (4) Korea,     54296F..ZF..., Billions
%      (5) Thailand,  57896F..ZF..., Billions
%      (6) Mexico,    27396F.CZF..., Billions (SA)
%      (7) US,        11196F.CZF..., Billions

load ./ifs/L96F-A.dat
load ./ifs/L96F-Q.dat

iC_ar_a  = L96F_A(:,2);
iC_id_a  = L96F_A(:,3);
iC_ko_a  = L96F_A(:,4);
iC_th_a  = L96F_A(:,5);
iC_mx_a  = L96F_A(:,6);
iC_us_a  = L96F_A(:,7);
iC_ar_q  = L96F_Q(:,2);
iC_id_q  = L96F_Q(:,3);
iC_ko_q  = L96F_Q(:,4);
iC_th_q  = L96F_Q(:,5);
iC_mx_q  = L96F_Q(:,6);
iC_us_q  = L96F_Q(:,7);

%L98C-A.txt, L98C-Q.txt
%------------------------
%
%  Description: Imports of goods and services in national currency
%  Columns:
%      (1) Year or Year.Qtr
%      (2) Argentina, 21398C..ZF..., Millions  
%      (3) Indonesia, 53698C..ZF..., Billions
%      (4) Korea,     54298C..ZF..., Billions
%      (5) Thailand,  57898C..ZF..., Billions
%      (6) Mexico,    27398C.CZF..., Billions (SA)
%      (7) US,        11198C.CZF..., Billions

load ./ifs/L98C-A.dat
load ./ifs/L98C-Q.dat

iIM_ar_a  = L98C_A(:,2);
iIM_id_a  = L98C_A(:,3);
iIM_ko_a  = L98C_A(:,4);
iIM_th_a  = L98C_A(:,5);
iIM_mx_a  = L98C_A(:,6);
iIM_us_a  = L98C_A(:,7);
iIM_ar_q  = L98C_Q(:,2);
iIM_id_q  = L98C_Q(:,3);
iIM_ko_q  = L98C_Q(:,4);
iIM_th_q  = L98C_Q(:,5);
iIM_mx_q  = L98C_Q(:,6);
iIM_us_q  = L98C_Q(:,7);

%L99A-A.txt, L99A-Q.txt
%------------------------
%
%  Description: Gross national income in national currency
%  Columns:
%      (1) Year or Year.Qtr
%      (2) Argentina, 21399A..ZF..., Millions  
%      (3) Indonesia, 53699A..ZF..., Billions
%      (4) Korea,     54299A..ZF..., Billions
%      (5) Thailand,  57899A..ZF..., Billions
%      (6) US,        11199A.CZF..., Billions

load ./ifs/L99A-A.dat
load ./ifs/L99A-Q.dat

iGNI_ar_a  = L99A_A(:,2);
iGNI_id_a  = L99A_A(:,3);
iGNI_ko_a  = L99A_A(:,4);
iGNI_th_a  = L99A_A(:,5);
iGNI_us_a  = L99A_A(:,6);
iGNI_ar_q  = L99A_Q(:,2);
iGNI_id_q  = L99A_Q(:,3);
iGNI_ko_q  = L99A_Q(:,4);
iGNI_th_q  = L99A_Q(:,5);
iGNI_us_q  = L99A_Q(:,6);

%L99B-A.txt, L99B-Q.txt
%------------------------
%
%  Description: Gross Domestic Product in national currency
%  Columns:
%      (1) Year or Year.Qtr
%      (2) Argentina, 21399B..ZF..., Millions  
%      (3) Indonesia, 53699B..ZF..., Billions
%      (4) Korea,     54299B..ZF..., Billions
%      (5) Thailand,  57899B..ZF..., Billions 
%      (6) Mexico,    27399B.CZF..., Billions (SA)
%      (7) US,        11199B.CZF..., Billions

load ./ifs/L99B-A.dat
load ./ifs/L99B-Q.dat

iGDP_ar_a  = L99B_A(:,2);
iGDP_id_a  = L99B_A(:,3);
iGDP_ko_a  = L99B_A(:,4);
iGDP_th_a  = L99B_A(:,5);
iGDP_mx_a  = L99B_A(:,6);
iGDP_us_a  = L99B_A(:,7);
iGDP_ar_q  = L99B_Q(:,2);
iGDP_id_q  = L99B_Q(:,3);
iGDP_ko_q  = L99B_Q(:,4);
iGDP_th_q  = L99B_Q(:,5);
iGDP_mx_q  = L99B_Q(:,6);
iGDP_us_q  = L99B_Q(:,7);

%L99BI-A.txt, L99BI-Q.txt
%------------------------
%
%  Description: Change in inventories in national currency
%  Columns:
%      (1) Year or Year.Qtr
%      (2) Argentina, 21399BIPZF..., 2000=100
%      (3) Indonesia, 53699BIPZF..., 2000=100
%      (4) Korea,     54299BIPZF..., 2000=100
%      (5) Thailand,  57899BIPZF..., 2000=100
%      (6) Mexico,    27399BIRZF..., 2000=100
%      (7) US,        11199BIRZF..., 2000=100

load ./ifs/L99BI-A.dat
load ./ifs/L99BI-Q.dat

iPGDP_ar_a  = L99BI_A(:,2);
iPGDP_id_a  = L99BI_A(:,3);
iPGDP_ko_a  = L99BI_A(:,4);
iPGDP_th_a  = L99BI_A(:,5);
iPGDP_mx_a  = L99BI_A(:,6);
iPGDP_us_a  = L99BI_A(:,7);
iPGDP_ar_q  = L99BI_Q(:,2);
iPGDP_id_q  = L99BI_Q(:,3);
iPGDP_ko_q  = L99BI_Q(:,4);
iPGDP_th_q  = L99BI_Q(:,5);
iPGDP_mx_q  = L99BI_Q(:,6);
iPGDP_us_q  = L99BI_Q(:,7);

%L99Z-A.txt, L99Z-Q.txt
%------------------------
%
%  Description: Population
%  Columns:
%      (1) Year or Year.Qtr
%      (2) Argentina, 21399Z..ZF...
%      (3) Indonesia, 53699Z..ZF...
%      (4) Korea,     54299Z..ZF...
%      (5) Mexico,    27399Z..ZF...
%      (6) Thailand,  57899Z..ZF...
%      (7) US,        11199Z..ZF...

load ./ifs/L99Z-A.dat

iPOP_ar_a  = L99Z_A(:,2);
iPOP_id_a  = L99Z_A(:,3);
iPOP_ko_a  = L99Z_A(:,4);
iPOP_mx_a  = L99Z_A(:,5);
iPOP_th_a  = L99Z_A(:,6);
iPOP_us_a  = L99Z_A(:,7);
iPOPa      = L99Z_A(:,2:7);
iPOPq      = NaN*ones(228,6);
for i=1:6;
  iPOPq(1:224,i)  = interp0(iPOPa(1:56,i),4);
end;
iPOP_ar_q  = iPOPq(:,1);
iPOP_id_q  = iPOPq(:,2);
iPOP_ko_q  = iPOPq(:,3);
iPOP_mx_q  = iPOPq(:,4);
iPOP_th_q  = iPOPq(:,5);
iPOP_us_q  = iPOPq(:,6);
%--------------------------------------------------------------------------



%--------------------------------------------------------------------------
%
% ORGANIZATION FOR ECONOMIC COOPERATION AND DEVELOPMENT 
% (see README in ./oecd)
%
%--------------------------------------------------------------------------
%

load ./oecd/oecd_a_mx.dat
load ./oecd/oecd_q_mx.dat
load ./oecd/oecd_a_ko.dat
load ./oecd/oecd_q_ko.dat
load ./oecd/oecd_a_id.dat
load ./oecd/oecd_q_id.dat
load ./oecd/oecd_a_us.dat
load ./oecd/oecd_q_us.dat
oecd_a_mx     = [NaN*ones(23,12),oecd_a_mx]';
oecd_q_mx     = [NaN*ones(23,48),oecd_q_mx]';
oecd_a_ko     = [NaN*ones(24,12),oecd_a_ko]';
oecd_q_ko     = [NaN*ones(24,48),oecd_q_ko]';
oecd_a_id     = [NaN*ones(27,12),oecd_a_id]';
oecd_q_id     = [NaN*ones(27,48),oecd_q_id]';
oecd_a_us     = [NaN*ones(25,12),oecd_a_us]';
oecd_q_us     = [NaN*ones(25,48),oecd_q_us]';

oEMPmfg_mx_a  = oecd_a_mx(:,2);       % 2000=100
oEMPmfg_mx_q  = oecd_q_mx(:,2);
oHRSmfg_mx_a  = oecd_a_mx(:,3);       % 2000=100
oHRSmfg_mx_q  = oecd_q_mx(:,3);
oCPI_mx_a     = oecd_a_mx(:,4);       % 2000=100
oCPI_mx_q     = oecd_q_mx(:,4); 
oR91day_mx_a  = oecd_a_mx(:,5);       % Percent per annum
oR91day_mx_q  = oecd_q_mx(:,5);
oR364day_mx_a = oecd_a_mx(:,6);       % Percent per annum
oR364day_mx_q = oecd_q_mx(:,6); 
oEeop_mx_a    = oecd_a_mx(:,7);       % Cents per peso, end of period
oEeop_mx_q    = oecd_q_mx(:,7); 
oEavg_mx_a    = oecd_a_mx(:,8);       % Peso per dollar, period average
oEavg_mx_q    = oecd_q_mx(:,8);   
oGDP_mx_a     = oecd_a_mx(:,15);      % Billions of pesos
oGDP_mx_q     = oecd_q_mx(:,15); 
oRGDP_mx_a    = oecd_a_mx(:,16);      % Billions 1993 pesos
oRGDP_mx_q    = oecd_q_mx(:,16); 
oPGDP_mx_a    = oecd_a_mx(:,17);      % 1993=100
oPGDP_mx_q    = oecd_q_mx(:,17);  
oRC_mx_a      = oecd_a_mx(:,18);      % Billions 1993 pesos
oRC_mx_q      = oecd_q_mx(:,18);     
oRGC_mx_a     = oecd_a_mx(:,19);      % Billions 1993 pesos
oRGC_mx_q     = oecd_q_mx(:,19);    
oRIF_mx_a     = oecd_a_mx(:,20);      % Billions 1993 pesos
oRIF_mx_q     = oecd_q_mx(:,20);   
oRII_mx_a     = oecd_a_mx(:,21);      % Billions 1993 pesos
oRII_mx_q     = oecd_q_mx(:,21);  
oREX_mx_a     = oecd_a_mx(:,22);      % Billions 1993 pesos
oREX_mx_q     = oecd_q_mx(:,22); 
oRIM_mx_a     = oecd_a_mx(:,23);      % Billions 1993 pesos
oRIM_mx_q     = oecd_q_mx(:,23); 

oEMP_ko_a     = oecd_a_ko(:,2);       % Thousands, SA
oEMP_ko_q     = oecd_q_ko(:,2);
oEMPmfg_ko_a  = oecd_a_ko(:,3);       % Thousands, SA
oEMPmfg_ko_q  = oecd_q_ko(:,3);
oCPI_ko_a     = oecd_a_ko(:,4);       % 2000=100
oCPI_ko_q     = oecd_q_ko(:,4);
oR91day_ko_a  = oecd_a_ko(:,5);       % Percent per annum
oR91day_ko_q  = oecd_q_ko(:,5);
oR10yr_ko_a   = oecd_a_ko(:,6);       % Percent per annum
oR10yr_ko_q   = oecd_q_ko(:,6);
oEeop_ko_a    = oecd_a_ko(:,7);       % Cents per won, end of period
oEeop_ko_q    = oecd_q_ko(:,7);
oEavg_ko_a    = oecd_a_ko(:,8);       % Won per dollar, period average
oEavg_ko_q    = oecd_q_ko(:,8);
oGDP_ko_a     = oecd_a_ko(:,15);      % Billions of won
oGDP_ko_q     = oecd_q_ko(:,15);
oRGDP_ko_a    = oecd_a_ko(:,16);      % Billions of 2000 won
oRGDP_ko_q    = oecd_q_ko(:,16);
oPGDP_ko_a    = oecd_a_ko(:,17);      % 2000=100
oPGDP_ko_q    = oecd_q_ko(:,17);
oRC_ko_a      = oecd_a_ko(:,18);      % Billions of 2000 won
oRC_ko_q      = oecd_q_ko(:,18);
oRGC_ko_a     = oecd_a_ko(:,19);      % Billions of 2000 won
oRGC_ko_q     = oecd_q_ko(:,19);
oRIF_ko_a     = oecd_a_ko(:,20);      % Billions of 2000 won
oRIF_ko_q     = oecd_q_ko(:,20);
oRII_ko_a     = oecd_a_ko(:,21);      % Billions of 2000 won
oRII_ko_q     = oecd_q_ko(:,21);
oREX_ko_a     = oecd_a_ko(:,22);      % Billions of 2000 won
oREX_ko_q     = oecd_q_ko(:,22);
oRIM_ko_a     = oecd_a_ko(:,23);      % Billions of 2000 won
oRIM_ko_q     = oecd_q_ko(:,23);
oRSD_ko_a     = oecd_a_ko(:,24);      % Billions of 2000 won
oRSD_ko_q     = oecd_q_ko(:,24);

oEMP_id_a     = oecd_a_id(:,2);       % Millions
oEMP_id_q     = oecd_q_id(:,2);
oCPI_id_a     = oecd_a_id(:,3);       % 2000=100
oCPI_id_q     = oecd_q_id(:,3);     
oR3mo_id_a    = oecd_a_id(:,4);       % Percent per annum
oR3mo_id_q    = oecd_q_id(:,4);
oEavg_id_a    = oecd_a_id(:,5);       % Rupiah per dollar, period average
oEavg_id_q    = oecd_q_id(:,5);
oGDP_id_a     = oecd_a_id(:,22);      % Trillions of rupiahs
oGDP_id_q     = oecd_q_id(:,22);
oGDPsa_id_a   = oecd_a_id(:,23);      % Trillions of rupiahs, SA
oGDPsa_id_q   = oecd_q_id(:,23);
oC_id_a       = oecd_a_id(:,26);      % Trillions of rupiahs
oC_id_q       = oecd_q_id(:,26);
oGC_id_a      = oecd_a_id(:,27);      % Trillions of rupiahs
oGC_id_q      = oecd_q_id(:,27);
oIF_id_a      = oecd_a_id(:,24);      % Trillions of rupiahs
oIF_id_q      = oecd_q_id(:,24);
oII_id_a      = oecd_a_id(:,25);      % Trillions of rupiahs
oII_id_q      = oecd_q_id(:,25);
oEX_id_a      = oecd_a_id(:,20);      % Trillions of rupiahs
oEX_id_q      = oecd_q_id(:,20);
oIM_id_a      = oecd_a_id(:,17);      % Trillions of rupiahs
oIM_id_q      = oecd_q_id(:,17);
oSD_id_a      = oecd_a_id(:,18);      % Trillions of rupiahs
oSD_id_q      = oecd_q_id(:,18);
oRGDP_id_a    = oecd_a_id(:,10);      % Trillions of 2000 rupiahs
oRGDP_id_q    = oecd_q_id(:,10);
oRGDPsa_id_a  = oecd_a_id(:,12);      % Trillions of 2000 rupiahs
oRGDPsa_id_q  = oecd_q_id(:,12);
oRC_id_a      = oecd_a_id(:,15);      % Trillions of 2000 rupiahs
oRC_id_q      = oecd_q_id(:,15);
oRGC_id_a     = oecd_a_id(:,16);      % Trillions of 2000 rupiahs
oRGC_id_q     = oecd_q_id(:,16);
oRIF_id_a     = oecd_a_id(:,13);      % Trillions of 2000 rupiahs
oRIF_id_q     = oecd_q_id(:,13);
oRII_id_a     = oecd_a_id(:,14);      % Trillions of 2000 rupiahs
oRII_id_q     = oecd_q_id(:,14);
oREX_id_a     = oecd_a_id(:,7);       % Trillions of 2000 rupiahs
oREX_id_q     = oecd_q_id(:,7);
oRIM_id_a     = oecd_a_id(:,11);      % Trillions of 2000 rupiahs
oRIM_id_q     = oecd_q_id(:,11);
oRSD_id_a     = oecd_a_id(:,9);       % Trillions of 2000 rupiahs
oRSD_id_q     = oecd_q_id(:,9);

oEMP_us_a     = oecd_a_us(:,2);       % Millions, SA
oEMP_us_q     = oecd_q_us(:,2);
oEMPmfg_us_a  = oecd_a_us(:,3);       % Millions, SA
oEMPmfg_us_q  = oecd_q_us(:,3);
oHRSmfg_us_a  = oecd_a_us(:,4);       % Weekly, SA
oHRSmfg_us_q  = oecd_q_us(:,4);
tem           = zeros(4,57);
tem(:)        = oHRSmfg_us_q;
oHRSmfg_us_a  = mean(tem)';
oOHRSmfg_us_a = oecd_a_us(:,5);       % Weekly, SA
oOHRSmfg_us_q = oecd_q_us(:,5);
oCPI_us_a     = oecd_a_us(:,6);       % 2000=100
oCPI_us_q     = oecd_q_us(:,6);
oR3mo_us_a    = oecd_a_us(:,7);       % Percent per annum
oR3mo_us_q    = oecd_q_us(:,7);
oR10yr_us_a   = oecd_a_us(:,8);       % Percent per annum
oR10yr_us_q   = oecd_q_us(:,8);
oEeop_us_a    = oecd_a_us(:,9);       % Euro per dollar, end of period
oEeop_us_q    = oecd_q_us(:,9);
oGDP_us_a     = oecd_a_us(:,16);      % Billions of dollars 
oGDP_us_q     = oecd_q_us(:,16);
oRGDP_us_a    = oecd_a_us(:,17);      % Billions of 2000 dollars
oRGDP_us_q    = oecd_q_us(:,17);  
oPGDP_us_a    = oecd_a_us(:,18);      % 2000=100
oPGDP_us_q    = oecd_q_us(:,18);
oRC_us_a      = oecd_a_us(:,19);      % Billions of 2000 dollars
oRC_us_q      = oecd_q_us(:,19);
oRGC_us_a     = oecd_a_us(:,20);      % Billions of 2000 dollars
oRGC_us_q     = oecd_q_us(:,20);
oRIF_us_a     = oecd_a_us(:,21);      % Billions of 2000 dollars
oRIF_us_q     = oecd_q_us(:,21);
oRII_us_a     = oecd_a_us(:,22);      % Billions of 2000 dollars
oRII_us_q     = oecd_q_us(:,22);
oREX_us_a     = oecd_a_us(:,23);      % Billions of 2000 dollars
oREX_us_q     = oecd_q_us(:,23);
oRIM_us_a     = oecd_a_us(:,24);      % Billions of 2000 dollars
oRIM_us_q     = oecd_q_us(:,24);
oRSD_us_a     = oecd_a_us(:,25);      % Billions of 2000 dollars
oRSD_us_q     = oecd_q_us(:,25);
%--------------------------------------------------------------------------


%--------------------------------------------------------------------------
%
% PENN WORLD TABLES (see README in ./pwt)
%
%--------------------------------------------------------------------------

load ./pwt/pwt_mx.dat
pPOP_mx_a    = [NaN;NaN;pwt_mx(:,2);NaN*ones(4,1)]*1000;
pEMP_mx_a    = [NaN;NaN;pwt_mx(:,3)./pwt_mx(:,5);NaN*ones(4,1)].*iPOP_mx_a;
pEQA_mx_a    = [NaN;NaN;pwt_mx(:,3)./pwt_mx(:,4);NaN*ones(4,1)].*iPOP_mx_a;
pRGDP_mx_a   = [NaN;NaN;pwt_mx(:,2).*pwt_mx(:,3);NaN*ones(4,1)];
pEMP_mx_q    = [NaN*ones(8,1);interp0(pEMP_mx_a(3:53),4);NaN*ones(16,1)];
pEQA_mx_q    = [NaN*ones(8,1);interp0(pEQA_mx_a(3:53),4);NaN*ones(16,1)];

%--------------------------------------------------------------------------
%
% WORLD DEVELOPMENT INDICATORS (see README in ./wdi)
%
%--------------------------------------------------------------------------

load ./wdi/wdi_mx.dat
load ./wdi/wdi_us.dat
wRGDP_mx_a     = [NaN*ones(12,1);wdi_mx(9,:)';NaN];
wRC_mx_a       = [NaN*ones(12,1);wdi_mx(18,:)';NaN];
wRGC_mx_a      = [NaN*ones(12,1);wdi_mx(12,:)';NaN];
wRIF_mx_a      = [NaN*ones(12,1);wdi_mx(15,:)';NaN];
wRII_mx_a      = [NaN*ones(12,1);wdi_mx(2,:)';NaN];
wREX_mx_a      = [NaN*ones(12,1);wdi_mx(7,:)';NaN];
wRIM_mx_a      = [NaN*ones(12,1);wdi_mx(20,:)';NaN];
wRGNI_mx_a     = [NaN*ones(12,1);wdi_mx(17,:)';NaN];
wGDP_mx_a      = [NaN*ones(12,1);wdi_mx(10,:)';NaN];
wGDPpc_mx_a    = [NaN*ones(12,1);wdi_mx(11,:)';NaN];
wC_mx_a        = [NaN*ones(12,1);wdi_mx(19,:)';NaN];
wGC_mx_a       = [NaN*ones(12,1);wdi_mx(13,:)';NaN];
wIF_mx_a       = [NaN*ones(12,1);wdi_mx(16,:)';NaN];
wII_mx_a       = [NaN*ones(12,1);wdi_mx(3,:)';NaN];
wEX_mx_a       = [NaN*ones(12,1);wdi_mx(8,:)';NaN];
wIM_mx_a       = [NaN*ones(12,1);wdi_mx(21,:)';NaN];
wGNI_mx_a      = [NaN*ones(12,1);wdi_mx(14,:)';NaN];
wLF_mx_a       = [NaN*ones(12,1);wdi_mx(22,:)';NaN];
wPOP1564_mx_a  = [NaN*ones(12,1);wdi_mx(23,:)';NaN];
wPOP_mx_a      = [NaN*ones(12,1);wdi_mx(24,:)';NaN];
wPOP_mx_q      = [NaN*ones(48,1);interp0(wPOP_mx_a(13:56),4);NaN*ones(4,1)];
wPOP1564_mx_q  = [NaN*ones(48,1);interp0(wPOP1564_mx_a(13:56),4);NaN*ones(4,1)];
wRGDP_us_a     = [NaN*ones(12,1);wdi_us(9,:)';NaN];
wRC_us_a       = [NaN*ones(12,1);wdi_us(18,:)';NaN];
wRGC_us_a      = [NaN*ones(12,1);wdi_us(12,:)';NaN];
wRIF_us_a      = [NaN*ones(12,1);wdi_us(15,:)';NaN];
wRII_us_a      = [NaN*ones(12,1);wdi_us(2,:)';NaN];
wREX_us_a      = [NaN*ones(12,1);wdi_us(7,:)';NaN];
wRIM_us_a      = [NaN*ones(12,1);wdi_us(20,:)';NaN];
wRGNI_us_a     = [NaN*ones(12,1);wdi_us(17,:)';NaN];
wGDP_us_a      = [NaN*ones(12,1);wdi_us(10,:)';NaN];
wGDPpc_us_a    = [NaN*ones(12,1);wdi_us(11,:)';NaN];
wC_us_a        = [NaN*ones(12,1);wdi_us(19,:)';NaN];
wGC_us_a       = [NaN*ones(12,1);wdi_us(13,:)';NaN];
wIF_us_a       = [NaN*ones(12,1);wdi_us(16,:)';NaN];
wII_us_a       = [NaN*ones(12,1);wdi_us(3,:)';NaN];
wEX_us_a       = [NaN*ones(12,1);wdi_us(8,:)';NaN];
wIM_us_a       = [NaN*ones(12,1);wdi_us(21,:)';NaN];
wGNI_us_a      = [NaN*ones(12,1);wdi_us(14,:)';NaN];
wLF_us_a       = [NaN*ones(12,1);wdi_us(22,:)';NaN];
wPOP1564_us_a  = [NaN*ones(12,1);wdi_us(23,:)';NaN];
wPOP_us_a      = [NaN*ones(12,1);wdi_us(24,:)';NaN];
wPOP_us_q      = [NaN*ones(48,1);interp0(wPOP_us_a(13:56),4);NaN*ones(4,1)];
wPOP1564_us_q  = [NaN*ones(48,1);interp0(wPOP1564_us_a(13:56),4);NaN*ones(4,1)];

%--------------------------------------------------------------------------
%
% INTERNATIONAL LABOR ORGANIZATION (see README in ./ilo)
%
%--------------------------------------------------------------------------

load ./ilo/emp_a_mx.dat
load ./ilo/empind_a_mx.dat
load ./ilo/hrs_a_mx.dat
load ./ilo/hrsmfg_a_mx.dat
lEMP_mx_a    = [NaN*ones(21,1);emp_a_mx(2,:)';NaN];
lEMPmfg_mx_a = [NaN*ones(21,1);empind_a_mx(5,:)';NaN];
lHRS_mx_a    = [NaN*ones(21,1);hrs_a_mx(2,:)';NaN];
lHRSmfg_mx_a = [NaN*ones(21,1);hrsmfg_a_mx(2,:)';NaN];


%--------------------------------------------------------------------------


%--------------------------------------------------------------------------
%
% CALCULATE THE FOLLOWING VARIABLES
%
%   1. Inflation rates for t-1 to t (INFCPI,INFDEF)
%   2. Real exchange rates (Qavg,Qeop)
%   3. Per-capita real GDP divided by technology growth (Y)
%   4. Per-capita real consumption divided by technology growth (C)
%   5. Per-capita real investment divided by technology growth (I)
%   6. Per-capita real spending plus net exports divided by technology growth (G)
%   7. Per-capita hours (L)
%
%--------------------------------------------------------------------------

na           = 57;
nq           = 228;
y2000        = 53;
q2000        = 209:212;


% Mexico

INFCPI_mx_a  = [NaN;(iCPI_mx_a(2:na)./iCPI_mx_a(1:na-1)-1)*100];
INFCPI_mx_q  = [NaN;(iCPI_mx_q(2:nq)./iCPI_mx_q(1:nq-1)-1)*100];

Qeop_mx_a    = iCPI_mx_a./(iEeop_mx_a.*iCPI_us_a);
Qeop_mx_a    = Qeop_mx_a/Qeop_mx_a(y2000)*100;
Qavg_mx_a    = iCPI_mx_a./(iEavg_mx_a.*iCPI_us_a);
Qavg_mx_a    = Qavg_mx_a/Qavg_mx_a(y2000)*100;
Qeop_mx_q    = iCPI_mx_q./(iEeop_mx_q.*iCPI_us_q);
Qeop_mx_q    = Qeop_mx_q/mean(Qeop_mx_q(q2000))*100;
Qavg_mx_q    = iCPI_mx_q./(iEavg_mx_q.*iCPI_us_q);
Qavg_mx_q    = Qavg_mx_q/mean(Qavg_mx_q(q2000))*100;

GR_mx_a      = 1.005.^[1:na]';
GR_mx_q      = (1.005^(1/4)).^[1:nq]';

Ychk_mx_a    = iGDP_mx_a./(iPGDP_mx_a.*wPOP1564_mx_a.*GR_mx_a);
Ychk_mx_a    = Ychk_mx_a  * iGDP_mx_a(y2000)/Ychk_mx_a(y2000);
Y_mx_a       = oRGDP_mx_a./(wPOP1564_mx_a.*GR_mx_a);
oRG_mx_a     = oRGC_mx_a+oREX_mx_a-oRIM_mx_a;
G_mx_a       = oRG_mx_a./(wPOP1564_mx_a.*GR_mx_a);
G_mx_a       = G_mx_a  * iGDP_mx_a(y2000)/Y_mx_a(y2000);
C_mx_a       = oRC_mx_a./(wPOP1564_mx_a.*GR_mx_a);
C_mx_a       = C_mx_a  * iGDP_mx_a(y2000)/Y_mx_a(y2000);
oRI_mx_a     = oRIF_mx_a+oRII_mx_a;
I_mx_a       = oRI_mx_a./(wPOP1564_mx_a.*GR_mx_a);
I_mx_a       = I_mx_a  * iGDP_mx_a(y2000)/Y_mx_a(y2000);
Y_mx_a       = Y_mx_a  * iGDP_mx_a(y2000)/Y_mx_a(y2000);
L_mx_a       = (pEMP_mx_a./wPOP1564_mx_a).* (oHRSmfg_mx_a./oEMPmfg_mx_a);

Ychk_mx_q    = iGDP_mx_q./(iPGDP_mx_q.*wPOP1564_mx_q.*GR_mx_q);
Ychk_mx_q    = Ychk_mx_q  * mean(iGDP_mx_q(q2000))/mean(Ychk_mx_q(q2000));
Y_mx_q       = oRGDP_mx_q./(wPOP1564_mx_q.*GR_mx_q);
oRG_mx_q     = oRGC_mx_q+oREX_mx_q-oRIM_mx_q;
G_mx_q       = oRG_mx_q./(wPOP1564_mx_q.*GR_mx_q);
G_mx_q       = G_mx_q  * mean(iGDP_mx_q(q2000))/mean(Y_mx_q(q2000));
C_mx_q       = oRC_mx_q./(wPOP1564_mx_q.*GR_mx_q);
C_mx_q       = C_mx_q  * mean(iGDP_mx_q(q2000))/mean(Y_mx_q(q2000));
oRI_mx_q     = oRIF_mx_q+oRII_mx_q;
I_mx_q       = oRI_mx_q./(wPOP1564_mx_q.*GR_mx_q);
I_mx_q       = I_mx_q  * mean(iGDP_mx_q(q2000))/mean(Y_mx_q(q2000));
Y_mx_q       = Y_mx_q  * mean(iGDP_mx_q(q2000))/mean(Y_mx_q(q2000));
L_mx_q       = (pEMP_mx_q./wPOP1564_mx_q).* (oHRSmfg_mx_q./oEMPmfg_mx_q);

% United States

INFCPI_us_a  = [NaN;(iCPI_us_a(2:na)./iCPI_us_a(1:na-1)-1)*100];
INFCPI_us_q  = [NaN;(iCPI_us_q(2:nq)./iCPI_us_q(1:nq-1)-1)*100];

GR_us_a      = 1.02.^[1:na]';
GR_us_q      = 1.005.^[1:nq]';

Ychk_us_a    = iGDP_us_a./(iPGDP_us_a.*wPOP1564_us_a.*GR_us_a);
Ychk_us_a    = Ychk_us_a  * iGDP_us_a(y2000)/Ychk_us_a(y2000);
Y_us_a       = oRGDP_us_a./(wPOP1564_us_a.*GR_us_a);
oRG_us_a     = oRGC_us_a+oREX_us_a-oRIM_us_a;
G_us_a       = oRG_us_a./(wPOP1564_us_a.*GR_us_a);
G_us_a       = G_us_a  * iGDP_us_a(y2000)/Y_us_a(y2000);
C_us_a       = oRC_us_a./(wPOP1564_us_a.*GR_us_a);
C_us_a       = C_us_a  * iGDP_us_a(y2000)/Y_us_a(y2000);
oRI_us_a     = oRIF_us_a+oRII_us_a;
I_us_a       = oRI_us_a./(wPOP1564_us_a.*GR_us_a);
I_us_a       = I_us_a  * iGDP_us_a(y2000)/Y_us_a(y2000);
Y_us_a       = Y_us_a  * iGDP_us_a(y2000)/Y_us_a(y2000);
L_us_a       = (oEMP_us_a./wPOP1564_us_a).* (oHRSmfg_us_a+oOHRSmfg_us_a);

Ychk_us_q    = iGDP_us_q./(iPGDP_us_q.*wPOP1564_us_q.*GR_us_q);
Ychk_us_q    = Ychk_us_q  * mean(iGDP_us_q(q2000))/mean(Ychk_us_q(q2000));
Y_us_q       = oRGDP_us_q./(wPOP1564_us_q.*GR_us_q);
oRG_us_q     = oRGC_us_q+oREX_us_q-oRIM_us_q;
G_us_q       = oRG_us_q./(wPOP1564_us_q.*GR_us_q);
G_us_q       = G_us_q  * mean(iGDP_us_q(q2000))/mean(Y_us_q(q2000));
C_us_q       = oRC_us_q./(wPOP1564_us_q.*GR_us_q);
C_us_q       = C_us_q  * mean(iGDP_us_q(q2000))/mean(Y_us_q(q2000));
oRI_us_q     = oRIF_us_q+oRII_us_q;
I_us_q       = oRI_us_q./(wPOP1564_us_q.*GR_us_q);
I_us_q       = I_us_q  * mean(iGDP_us_q(q2000))/mean(Y_us_q(q2000));
Y_us_q       = Y_us_q  * mean(iGDP_us_q(q2000))/mean(Y_us_q(q2000));
L_us_q       = (oEMP_us_q./wPOP1564_us_q).* (oHRSmfg_us_q+oHRSmfg_us_q);

%--------------------------------------------------------------------------
%
% PLOT RESULTS
%
%--------------------------------------------------------------------------

ally         = [1948:2004]';
allq         = ptime(1948.1,228,4);
ta           = [y0:y1]';
tq           = ptime(y0+.1,length(ta)*4,4);
ia           = [find(y0==ally):find(y1==ally)]';
iq           = [((ia(1)-1)*4+1):(ia(length(ia))*4)]';


%USER CAN FILL IN SPECIFICS
