Page 1 of 1

Need help for finding problems of following codes.

PostPosted: Sat Apr 09, 2011 1:32 pm
by kimjy39
Hello, I hope to find the problems of following codes.

I try to put some asset pricing issues at model in 'example1.mod' that included in a initial dynare subfile.
With this intention, I input some codes as follows.
Thus, I add 'p', 'p = beta*(c/c(+1))*(p(+1)+y(+1))', and 'p = 1'
----------------------------------------------------------------------
var y, c, k, a, h, b, p;
varexo e, u;

parameters beta, rho, alpha, delta, theta, psi, tau;

alpha = 0.36;
rho = 0.95;
tau = 0.025;
beta = 0.99;
delta = 0.025;
psi = 0;
theta = 2.95;

phi = 0.1;

model;
c*theta*h^(1+psi)=(1-alpha)*y;
k = beta*(((exp(b)*c)/(exp(b(+1))*c(+1)))
*(exp(b(+1))*alpha*y(+1)+(1-delta)*k));
y = exp(a)*(k(-1)^alpha)*(h^(1-alpha));
k = exp(b)*(y-c)+(1-delta)*k(-1);
a = rho*a(-1)+tau*b(-1) + e;
b = tau*a(-1)+rho*b(-1) + u;
p = beta*(c/c(+1))*(p(+1)+y(+1));
end;

initval;
y = 1.08068253095672;
c = 0.80359242014163;
h = 0.29175631001732;
k = 11.08360443260358;
a = 0;
b = 0;
e = 0;
u = 0;
p = 1;

end;

shocks;
var e; stderr 0.009;
var u; stderr 0.009;
var e, u = phi*0.009*0.009;
end;

stoch_simul;
---------------------------------------------------------------------


But the result is,
----------------------------------------------------------------------
Configuring Dynare ...
[mex] Generalized QZ.
[mex] Sylvester equation solution.
[mex] Kronecker products.
[mex] Sparse kronecker products.
[mex] Bytecode evaluation.
[mex] k-order perturbation solver.
[mex] k-order solution simulation.

Starting Dynare (version 4.2.0).
Starting preprocessing of the model file ...
ERROR: example1.mod:48.5-37: To use an external function within the model block, you must first declare it via the external_function() statement.

??? Error using ==> dynare at 126
DYNARE: preprocessing failed
--------------------------------------------------------------------------



Unfortunately, I cannot understand what the message, 'To use an external~', means.

Would you please let me know what went wrong? Thank you.

Re: Need help for finding problems of following codes.

PostPosted: Tue Apr 19, 2011 9:53 am
by SébastienVillemot
You need to declare your function as "external".

See the section about external functions in the reference manual: http://www.dynare.org/manual/re09.html