clear all
clc

%please install LeSage Package: http://www.spatial-econometrics.com/

%----------------------------------------------------------------
[data_cr]=xlsread('Schleer&Semmler_2016_DataSet.xls','cr_gr','B75:X134');
[data_gdp]=xlsread('Schleer&Semmler_2016_DataSet','gdp_gr','B75:X134');%Q1 1998
[data_ed]=xlsread('Schleer&Semmler_2016_DataSet','ed','B6:X65');%Q1 1998 : Q4 2012


% please select a country / country-group
gdp=data_gdp(1:end,20);
cr=data_cr(1:end,20);
ed=data_ed(1:end,20);
ed=diff(ed,1);

y=[gdp(2:end) cr(2:end)];
trans=[ed ed];
transv=trans(:,1);
transpos=0;
translag_common=3;

% please select lag length 
nlag_ic=[];

laglen=nlag_ic;
pmax=laglen;

% starting value search and estimation
dep=y(laglen+1:end,:);
ylag1=mlag(y,laglen);     ylag1=ylag1(laglen+1:end,:);
ylag2=ylag1; ylag3=ylag1; ylag4=ylag1;

transvar=lag(transv,translag_common);
transvar=transvar(laglen+1:end,:);

% please define starting values here,
 %startval=[ ];

startval=startval';
regs_1.eq{:,1}=ylag1; %eq1 linear
regs_1.eq{:,2}=ylag2; %eq1 nonlinear
regs_2.eq{:,1}=ylag3; %eq2 linear
regs_2.eq{:,2}=ylag4; %eq1 nonlinear

% please use here the package STVAR estimation
% https://www0.gsb.columbia.edu/faculty/sbigio/papers/SSTVAR_Toolkit_Guide.
% pdf
[results_VSTAR]=[];
results_vstar_est=results_VSTAR;

