impulses responses as a pdf
Show older comments
Hi, I am trying to obtain the impulse responses as a pdf when I run the codes. Could you please help me to figure out that? I mean I need to save it as a pdf and use it later on in latex.
% IR Compute and plot empirical impulse responses for a SVAR
% with gdp per capita and per-capita hours using the
% following datasets:
% Also allow for alternative differencing of hours by
% changing alpha in the code.
randn('seed',1004)
rand('seed',912)
%
% User Options:
% data = 1 if Brazil
% nt = number of years to plot
%
% p = number of lags in VAR
%
% nrep = number of replications for boot-strapped confidence bands
%
% alpha in [0,1] with 0 implying hours in levels,
% 1 implying hours differenced
% <1 implying quasi-differenced
%
%
data = input(' Which dataset? ("help ir" shows 4 options) ');
if isempty(data);
data = 1;
end;
nt = 20;
p = 2;
nrep = 1000;
alpha = 1;
% Load data on productivity and hours
if data==1;
load ../data/literature/sev/brazil.csv
gdp = brazil(:,1);
hpc = brazil(:,2);
t = ptime(1970,length(hpc),1);
end;
gdpd = cumsum(X1(:,1))*100;
segd = cumsum(se1_1)*100;
segd = sort(segd')';
for i=1:nt;
hrsd(i,1) = (alpha.^[i-1:-1:0])*X1(1:i,2)*100;
sehd(i,:) = (alpha.^[i-1:-1:0])*se1_2(1:i,:)*100;
end;
sehd = sort(sehd')';
for i=1:nt;
hrsz(i,1) = (alpha.^[i-1:-1:0])*X2(1:i,2)*100;
sehz(i,:) = (alpha.^[i-1:-1:0])*se2_2(1:i,:)*100;
end;
sehz = sort(sehz')';
%
% Plot results with 95% confidence bands
%
bnds = [round(.025*nrep),round(.975*nrep)];
figure(1)
plot(0:nt-1,gdpd,0:nt-1,segd(:,bnds),'k--')
title('Response of Hours to Technology Shock')
figure(2)
plot(0:nt-1,hrsd,0:nt-1,sehd(:,bnds),'k--')
title('Response of GDP to Technology Shock')
Answers (0)
Categories
Find more on Regression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!