Perfect foresight model - What variables predetermined and forward looking?

Hi everybody,

I have a deterministic model which I want to solve along the transition using the perfect foresight solver. I am new to Dynare and am still a bit confused about the timing of predetermined and forward looking variables. Is there a way to check for which variables the initial and for which variables the terminal condition is used? Is it possible to see that in the M_ or oo_ structures and/or can it be checked in the .m files generated by Dynare?

Thank you!

For starters, run


% print states
if M_.maximum_endo_lag~=0
    lag_index=find(M_.lead_lag_incidence(1,:));
    fprintf('\nThe following variables appear with a lag and are therefore states:\n')
    for var_iter=1:length(lag_index)
       fprintf('%s\n',M_.endo_names{lag_index(var_iter)})
    end    
else
    lag_index=[];
end

%print forward-looking variables
if M_.maximum_endo_lead~=0
    lead_index = find(M_.lead_lag_incidence(M_.maximum_lag+2,:));
    fprintf('\nThe following variables appear with a lead and are therefore forward-looking variables:\n')
    for var_iter=1:length(lead_index)
       fprintf('%s\n',M_.endo_names{lead_index(var_iter)})
    end  
else
    lead_index=[];
end

%print purely static ones
static_index = setdiff(1:M_.endo_nbr,union(lag_index,lead_index));
if ~isempty(static_index)
    fprintf('\nThe following variables do not appear with a lead or lag and are therefore purely static variables:\n')
    for var_iter=1:length(static_index)
       fprintf('%s\n',M_.endo_names{static_index(var_iter)})
    end    
end
1 Like