Multiple graph in one graph

Hi all,

I have problem to combine 2 IRFs in 1 graph. After running the file, I get the following error in which it asks me for the data file.
Error using makedataset (line 107)
makedataset: I can’t find a datafile (with allowed extension m, mat, csv, xls or xlsx)!

Is there a way to not do all the estimation again?
2.rar (1.3 MB)

That is not the full error message. And which file are you executing?

I run “mohsen.m”
The full error message is

Error using makedataset (line 107)
makedataset: I can’t find a datafile (with allowed extension m, mat, csv, xls or xlsx)!
Error in dynare_estimation_init (line 538)
[dataset_, dataset_info, newdatainterfaceflag] = makedataset(options_, options_.dsge_var*options_.dsge_varlag, gsa_flag);
Error in dynare_estimation_1 (line 116)
dynare_estimation_init(var_list_, dname, [], M_, options_, oo_, estim_params_, bayestopt_);
Error in dynare_estimation (line 105)
dynare_estimation_1(var_list,dname);
Error in NDF (line 405)
oo_recursive_=dynare_estimation(var_list_);
Error in dynare (line 235)
evalin(‘base’,fname) ;
Error in mohsen (line 1)
dynare NDF.mod;

If you run Dynare to estimate the model, of course you need the dataset.

But mohsen is matlab file. As I said, I run “mohsen.m”

I know, but your very first line is

dynare NDF.mod;

which runs Dynare

What should I do that Dynare does not run this file?

You need the datafile.

I do not want to estimate again. Isn’t there a way to compare IRFs without re-estimating?

If you already ran the model, then you can delete the call to dynare in that m-file and directly proceed to loading the results.

I run the following file:

load('NDF_results.mat', 'oo_');
irf1=oo_.irfs;
save irf1;
load irf1;
load('NDF2_results.mat', 'oo_');
irf2=oo_.irfs;
save irf2;
load irf2;

ending_cell={'_epsyoil'};
for ii=1:length(ending_cell)
HOR=1:1:100;
var={'Y','L'};
figure
for jj=1:length(var)
subplot(1,2,jj) 
eval(['irf1.' var{1,jj},ending_cell{1,ii}]);
eval(['irf2.' var{1,jj},ending_cell{1,ii}]);
hold on
plot(HOR,[eval(['irf1.' var{1,jj},ending_cell{1,ii}])],'LineWidth',1,'-k',HOR,[eval(['irf2.' var{1,jj},ending_cell{1,ii}])],'LineWidth',1,'--r')
title([var{1,jj}] )
end
end

But I get the following error:

Error using plot
Data must be a single matrix Y or a list of pairs X,Y.
Error in mohsen (line 24)
plot(HOR,[eval([‘irf1.’ var{1,jj},ending_cell{1,ii}])],‘LineWidth’,1,’-k’,HOR,[eval([‘irf2.’
var{1,jj},ending_cell{1,ii}])],‘LineWidth’,1,’–r’)

It should be

load('NDF_results.mat', 'oo_');
irf1=oo_.irfs;
load('NDF2_results.mat', 'oo_');
irf2=oo_.irfs;

ending_cell={'_epsyoil'};
for ii=1:length(ending_cell)
HOR=1:1:100;
var={'Y','L'};
figure
ending_cell={'_epsyoil'};
HOR=1:1:100;
var={'Y','L'};
for ii=1:length(ending_cell)
    figure
    for jj=1:length(var)
        subplot(1,2,jj)
        plot(HOR,irf1.([var{1,jj},ending_cell{1,ii}]),'-k',...
            HOR,irf2.([var{1,jj},ending_cell{1,ii}]),'--r','LineWidth',1)
        title([var{1,jj}] )
    end
end
end

I did but I get the following error:

Error: File: mohsen.m Line: 7 Column: 1
At least one END is missing: the statement may begin here.

What does END mean?

Sorry, there was an end missing. I corrected the code above.

I ran the file again but still got the following error:
Error using plot
Data must be a single matrix Y or a list of pairs X,Y.
Error in mohsen (line 18)
plot(HOR,irf1.([var{1,jj},ending_cell{1,ii}]),‘LineWidth’,1,’-k’,…

Which Dynare version are you using?

I am using version 4.5.6

Then please provide the saved workspace and the full error message.

the saved workspace is:
matlab.mat (516.9 KB)

and the full error message is:

Error using plot
Data must be a single matrix Y or a list of pairs X,Y.
Error in mohsen (line 18)
plot(HOR,irf1.([var{1,jj},ending_cell{1,ii}]),‘LineWidth’,1,’-k’,…

I fixed the code above.