Dynare - "LoadError: InexactError: Int64(NaN)" for the simplest model

Hi! I was computing the transition path in the perfect foresight Solow growth model from a given initial capital stock, and keep getting “LoadError: InexactError: Int64(NaN)” when I tried to run the .mod file. I can’t figure out what went wrong given that the code is so simple (please see below). Can someone help me out here? Many many thanks!

var k;

parameters alpha, delta, s;

alpha = 1/3;
delta = 0.05;
s = 0.1;

model;
k = (1-s)*k(-1)^alpha + (1-delta)*k(-1);
end;

steady_state_model;
k = (delta/(1-s))^(1/(alpha-1));
end;

histval;
k(0) = 1;
end;

perfect_foresight_setup(periods = 300);
perfect_foresight_solver;

Maybe k(0) needs to be a Float?

Try

k(0) = 1.0

Thanks but still getting the same error message.

Btw, this is the command I used to run the mod file:

using Dynare
context = @dynare “./solow.mod”;

This doesn’t look like valid Julia syntax. What is this, and what is a mod-file? Please provide context and self-contained code.

Reading this should help: Please read: make it easier to help you

Edit: OK, I see now the Dynare package loading. The OP was just really confusing.

Thank you for reporting the problem! The current implementation of perfect foresight simulation assumes a shock to an exogenous variable. Your model is perfectly valid on principle, we need to cover the case without exogenous variable or shocks. Wait please for the next release.

P.S. In the future, please refrain to post the same question here and on https://forum.dynare.org/. This forces us to answer twice.

1 Like

@geekbear We release v0.5.3 that should fix the problem for models without exogenous variables or shocks. Thanks again for alerting us of the problem

Thanks so much. I’m new to the community and will not duplicate posts in the future.

1 Like