# On histval and Dynare 4.6.0

Dear Dynare community;

I would really appreciate some help on a surely basic (but not for me issue). After updating to release 4.6.0 I am unable to run a very simple code (perfect foreseight Ramsey-Cass-Koopmans model). My code follows (in the hope that it is not too long)

``````% -------------------------------------------------------
% ENDOGENOUS VARIABLES
% -------------------------------------------------------
% Number of variables: 5
var  k, y, c, w, r;
predetermined_variables k;
% -------------------------------------------------------
% LIST OF PARAMETERS
% -------------------------------------------
parameters beta, delta, alpha, n, g;
beta = 0.95;
delta = 0.06;
alpha = 0.35;
n = 0.0;
g = 0.0;
% -------------------------------------------
% CLOSED FORM SOLUTION FOR THE STEADY STATE
% -------------------------------------------
kss = (alpha/(((1 + g)/beta) - (1 - delta)))^(1/(1 - alpha));
yss = kss^(alpha);
css = kss^alpha - kss*(n + g + g*n + delta);
wss = (1 - alpha)*(kss^(alpha));
rss = alpha*(kss^(alpha - 1)) - delta;
% -------------------------------------------------------
% MODEL DESCRIPTION
% -------------------------------------------------------
model;
y = k(+1)*(1 + n)*(1 + g) - (1 - delta)*k + c;
# aux = 1 + r(+1);
# u_1 = 1/c;
# u_2 = 1/c(+1);
u_1 = (beta/(1 + g))*u_2*aux;
y = k^(alpha);
w = (1 - alpha)*(k^(alpha));
r = alpha*(k^(alpha - 1)) - delta;
end;
% -------------------------------------------------------
% COMPUTING THE STEADY STATE: guessed values
% -------------------------------------------------------
initval;
k = kss;
y = yss;
c = css;
w = wss;
end;
steady (solve_algo = 0);

% ----------------------------------
% BLANCHARD-KAHN CONDITION CHECK
% ----------------------------------
check;

% -------------------------------------------------------
% COMPUTING THE DYNAMICS
% -------------------------------------------------------
% Where the economy starts. For instance, k0 = 0.5*kss
histval;
k(0) = 0.5*kss;
end;
simul (stack_solve_algo = 0, periods = 100);
``````

But I must be doing something wrong. This worked until release 4.5.7. This is the error code that I obtain

``````Error using  :  (line 59)
First date must preceed the second one!

Error in dseries (line 177)
o.dates = init:init+(nobs(o)-1);

Error in RCK_UNO_NIVELES.driver (line 186)
M_.histval_dseries = dseries(zeros(M_.orig_maximum_lag_with_diffs_expanded,
M_.orig_endo_nbr), dates(sprintf('%dY',
-M_.orig_maximum_lag_with_diffs_expanded+1)), [ M_.endo_names(1:M_.orig_endo_nbr);
]);

Error in dynare (line 293)
evalin('base',[fname '.driver']) ;
``````

I have read the manual, Section `4.7. Initial and terminal conditions`. But to be quite honest I do not understand. My guess is that the error has to do with the `endval` and the`histval` blocks. Am I right? Could you please give me hand on this?

Thanks a lot in advance.

Regards,
Cruz A. Echevarria

This looks like a bug. We will investigate it. Thanks for reporting it.

Dear Johannes,
Thanks a lot for your prompt response.

Regards,
Cruz

PS Apologies for the misspellings in my original post

I can confirm it is a bug. The `predetermined_variables`-command is not properly recognized.