function [Y]=BondSim(THETA)

%Simulate data from Non-nested Info Bond model

% load('lastxopt');

[EE,M,MH,N,NN,R,D1,D2,D3,P,F1]=termsolve(THETA);

yc=[3,12,24,36,48,60;];

T=528;

dimX=length(M(:,1));   %dimension of state;
dimS=length(N(1,:));   %dimension of shocks;
dimY=length(D1(:,1));   %dimension of observables;

% randn('state',1234)

X=zeros(dimX,T+1);
Y=zeros(dimY-2,T);


shocks=randn(dimS,T);
for tt=2:T+1;
  X(:,tt)=M*X(:,tt-1) + N*shocks(:,tt-1);
  Y(:,tt) = D1(3:end,:)*X(:,tt)+D2(3:end,:)*X(:,tt-1)+R(3:end,:)*shocks(:,tt-1);
end

