clear all; close all; sdate = qq(2016,1); edate = sdate + 15; rng = sdate:edate; frng = sdate-1:edate; %% take the model % read model file m = model('nk.model','linear=',true); % solve the model m = solve(m); m = sstate(m); get(m,'sstate') %% simulate rep = report.new('nk_model_behaviour'); db = zerodb(m,sdate); % create zeros for all model variables, db.eps_y(sdate) = 1; % db.eps_pie(sdate) = 1; % db.eps_i(sdate) = 1; sdb = simulate(m,db,rng,'deviation', true, 'anticipate',false); s = dbextend(db,sdb); % plot IRFs f1=figure; plot(frng,[s.y s.pie s.i],'linewidth',2,'marker','o'); legend('y','\pi','i'); ylabel('% odchylka od ss'); title('Poptavkovy sok'); grid on; rep.userfigure('Poptavkovy sok',f1); % dbplot(s,{'y','pie','i'}); %% simulate: nakladovy sok db = zerodb(m,sdate); % create zeros for all model variables, % db.eps_y(sdate) = 1; db.eps_pie(sdate) = 1; % db.eps_i(sdate) = 1; sdb = simulate(m,db,rng,'deviation', true, 'anticipate',false); s = dbextend(db,sdb); % plot IRFs f2=figure; plot(frng,[s.y s.pie s.i],'linewidth',2,'marker','o'); legend('y','\pi','i') title('Nakladovy sok'); grid on; rep.userfigure('Nakladovy sok',f2); %% simulate: monetarni sok db = zerodb(m,sdate); % create zeros for all model variables, % db.eps_y(sdate) = 1; % db.eps_pie(sdate) = 1; db.eps_i(sdate) = 1; sdb = simulate(m,db,rng,'deviation', true, 'anticipate',false); s = dbextend(db,sdb); % plot IRFs f3=figure; plot(frng,[s.y s.pie s.i],'linewidth',2,'marker','o'); legend('y','\pi','i') title('Monetarni sok'); grid on; rep.userfigure('Monetarni sok',f3); %% ocekavany vs. neocekavany db = zerodb(m,sdate); % create zeros for all model variables, db.eps_y(sdate+5) = 1; % db.eps_pie(sdate+5) = 1; % db.eps_i(sdate+5) = 1; sdb = simulate(m,db,rng,'deviation', true, 'anticipate',true); s = dbextend(db,sdb); % plot IRFs f4=figure; plot(frng,[s.y s.pie s.i],'linewidth',2,'marker','o'); legend('y','\pi','i'); title('Poptavkovy sok'); grid on; rep.userfigure('Ocekavany sok',f4); %% vice vzadhledici PC % vicenasobna parametrizace m(2) = m(1); m(2).b1 = 0.8; %vzadhledici pc % m(2).c2 = 0; %striktni inflacni cilovani % m(2).c1 = 2; %vetsi vaha inflaci m = solve(m); db = zerodb(m,sdate); % create zeros for all model variables, db.eps_y(sdate) = 1; % db.eps_pie(sdate) = 1; % db.eps_i(sdate+5) = 1; sdb = simulate(m,db,sdate:edate+10,'deviation', true, 'anticipate',true); s = dbextend(db,sdb); % plot IRFs f5=figure; subplot(221) plot(s.y,'linewidth',2,'marker','o'); title('vystup'); grid; subplot(222) plot(s.pie,'linewidth',2,'marker','o'); title('inflace'); grid; subplot(223) plot(s.i,'linewidth',2,'marker','o'); title('urokova mira'); legend('benchmark','BWL PC') grid; rep.userfigure('Vzadhledici PC',f5); %rep.publish('nk_obrazky4prednes.pdf','display',false); %% model with smoothing of int. rate % puvodni model m = model('nk.model','linear=',true); m = solve(m); m = sstate(m); db = zerodb(m,sdate); % create zeros for all model variables, db.eps_y(sdate) = 1; sdb = simulate(m,db,rng,'deviation', true, 'anticipate',false); s = dbextend(db,sdb); % rozsireny model n = model('nk2.model','linear=',true); n = solve(n); n = sstate(n); sdbn = simulate(n,db,rng,'deviation', true, 'anticipate',false); sn = dbextend(db,sdbn); f6=figure; subplot(221) plot([s.y sn.y],'linewidth',2,'marker','o'); title('vystup'); grid; subplot(222) plot([s.pie sn.pie],'linewidth',2,'marker','o'); title('inflace'); grid; subplot(223) plot([s.i, sn.i],'linewidth',2,'marker','o'); title('urokova mira'); legend('benchmark','model with IR smoothing') grid;