
Originally Posted by
bradbrad
Ron - Thank you very much for this.
May I complicate it slightly?
If x were now a vector of variables and e a vector of shocks assumed to be multivariate normal and correlated with each other, how would you obtain the 1000 samples each of 100 observations?
Assuming that you have a function noise(N,Reps,sigma) which produces a row vector of length Reps each of who's elements is a column vector of dimension N which is multivariate normal with covariance matrix sigma:
Code:
nt=100; nx=4; nreps=1000
sigma=[1, 0.1; 0.1, 1];
x=zeros(nt,nx,nreps);
for t = 1:nt
x(t+1,:,:)=a*x(t,:,:) + noise(4,1000,sigma);
end RonL