# Creating Graphs through a static model

Hi,

I have a very simple question, but I do not know how to make it in Dynare. Assume, I have found the steady state of my model.

What I would like to do, is to create a graph where it shows how the steady state value changes when a particular parameter from the model changes. That is, I want to plot the relationship between a particular endogenous variable and a parameter of the model. Is there any command way on how to do it?

I am using Dynare 4.3.2 in Matlab. Any help on this will be much appreciated.

There is no built-in capacity to do so. You would need to loop over your parameter using Matlab and then extract the result. The general approach is shown here: [Loop over parameters)

I have created the following m.file in matlab

[code]sig=0.1:0.01:0.7;
mu=zeros(length(sigma1),1);

alpha=0.36;
A=0.25;
k2=(1-alpha)/alpha;
r=(1-alpha)A(k2)^alpha;
tauk=0.01;
tauh=0.2;
tau=0.2;
sigma2=(0.25)^2;

for i=1:length(sig);
sigma1=sig(i);
save parameterfile alpha A k2 r tauk tauh tau sigma1 sigma2
dynare model_bb_taxk
mu(i)=result(17,1);
end; [/code]

and my mod. file modified to include this:

```load parameterfile; set_param_value('alpha', alpha); set_param_value('A', A); set_param_value('k2', k2); set_param_value('r', r); set_param_value('tauk', tauk); set_param_value('tauh', tauh); set_param_value('tau', tau); set_param_value('sigma1', sigma1); set_param_value('sigma2', sigma2);```

But, matlab is returning the following errors:

[code]Undefined function ‘sig’ for input arguments of type ‘double’.

Error in loop_sigma1 (line 14)
sigma1=sig(i);[/code]

if I take out the “mu(i)=result(17,1);” part of the m.file code. And returns the following error, when I include the aforementioned part:

[code]Subscript indices must either be real positive integers or logicals.

Error in loop_sigma1 (line 18)
mu(i)=result(17,1);[/code]

But, once i take the dynare my.file command the m.file runs perfectly.

Can you please suggest what I should amend ? It seems to me that i am doing something that confuses matlab once I include the dynare withing the loop.

You should have followed my example, not the person I corrected. You are only trying to vary one parameter, sigma1. For this case, write a standard mod-file without loading a parameter matrix and then use

[code]clear all
sig=0.1:0.01:0.7;
mu=zeros(length(sigma1),1);
dynare model_bb_taxk noclearall %first call for setting up the environment

for i=1:length(sig);
set_param_value(‘sigma1’, sig(i)); %set parameter for subsequent runs
info = stoch_simul(var_list_); %get the model solution including the steady states
if info; %check whether model solution exists
disp('Computation fails for rho = ’ num2str(sig(i))]);
else
mu(i)=oo_.steady_state(strmatch(‘Variable Name here’,M_.endo_names,‘exact’),1); %extract result using the variable name
end;
end;
[/code]