function [para1,s1,irf1,irf2,R]=est_var_ols(dat,L,H)
y1 = dat(L+1:end,:);
N=cols(y1);
x1 = prepare(dat,L);
x1=x1(L+1:end,:);
para1 = x1\y1;
e1=y1-x1*para1;
s1=(e1'*e1)/(rows(y1)-cols(x1));
A0=chol(s1);
shock1=zeros(1,N);
shock1(1)=1;
irf1=irfsimx(para1,N,L,A0,shock1,H,1);
shock2=zeros(1,N);
shock1(2)=1;
irf2=irfsimx(para1,N,L,A0,shock2,H,1);
R=max(abs(eig(comp1(vec(para1),N,L,1))));