function Egger_etal

load datasetEgger;

n = 126; 


Y = TRADE;
X=cell(9,1);  Z=cell(12,1);
X{1}=DIST;    Z{1}=DIST; 
X{2}=BORD;    Z{2}=BORD; 
X{3}=LANG;    Z{3}=LANG; 
X{4}=CONT;    Z{4}=CONT; 
X{5}=DURAB;   Z{5}=DURAB;
X{6}=POLCOMP; Z{6}=POLCOMP;
X{7}=AUTOC;   Z{7}=AUTOC;
X{8}=CURCOL;  Z{8}=CURCOL;
X{9}=PTA;     
              Z{9}  = PTA*PTA> 0 & PTA*PTA<=20; 
              Z{10} = PTA*PTA>20 & PTA*PTA<=40;
              Z{11} = PTA*PTA>40 & PTA*PTA<=60;
              Z{12} = PTA*PTA>60 & PTA*PTA<=120;



gmm0 = zeros(9,1); D = ones(n,n); %D = ones(n,n)-eye(n);

[gmm_endo se_endo] = gravityiv1(Y,X,Z,gmm0),
[gmm_exo  se_exo ] = gravityiv1(Y,X,X,gmm0),




function vech = vech(matA)
[M,N] = size(matA);
if (M == N)
    vech  = [];
    for i=1:M-1
        vech = [vech; matA(i+1:end,i)];
    end
else
     error('Input must be a symmetric matrix.')
end
