Parallel simulations of VAR
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
clear
clc
tic
bet = .2;
rho = .8;
gam = 0.06;
particles = 50000;
N = particles;
Time = 150;
T = Time;
y = zeros(particles,T);
e_y = zeros(particles,T);
u = zeros(N,T);
e = normrnd(0,1,[N,T]);
v = normrnd(0,1,[N,T]);
u(:,1) = e(:,1);
phi = [0,inv(1-bet*rho)]';
R_t = eye(2);
for i = 2:T
u(:,i) = rho*u(:,i-1) + e(:,i);
end
for n = 1:N
for i = 2:T
x = [1,u(i-1)]';
phi = phi + gam*inv(R_t)*x*(y(n,i-1)-phi'*x)';
R_t = R_t + gam*(x*x' - R_t);
e_y(n,i) = phi(1) + phi(2)*rho*u(n,i);
y(n,i) = bet*e_y(n,i) + u(n,i) + v(n,i);
end
end
toc
In the code above I am attempting to simulate a VAR process that is driven by two gaussian processes, one of which enters to create an autoregressive process. My goal is to efficiently and repeatedly simulate this VAR model in order to use a particle filter to estimate the parameters. As it is written now, however, simulating the model this many times requires about 45 seconds of computer time, which renders any simulation-based estimation procedure hopeless.
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Monte-Carlo finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!