How External function works in the Dynare?

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

How External function works in the Dynare?

Postby inside » Fri Jun 23, 2017 4:17 pm

Would somebody explain me about my misunderstanding?
I have the some very easy rbc model.
I created penalty function (it's positive only if x<0, and eq=0 for x>0). It’s don’t have any influence on the model, I just put pen = penal(inv);
Why the IRF is so strange?
When I look on endo_simul, there is some problem: variable pen doesn’t equal penal(inv). It’s positive when inv positive too. Why is it?
How can I check, that the function work? I used debug and funtion work well.
Thank to everyone for help.
Attachments
penal.m
(139 Bytes) Downloaded 77 times
t1.mod
(602 Bytes) Downloaded 86 times
inside
 
Posts: 1
Joined: Fri Jun 23, 2017 3:39 pm

Re: How External function works in the Dynare?

Postby jpfeifer » Fri Jun 23, 2017 5:10 pm

You should use
Code: Select all
external_function(name = penal,nargs=1,first_deriv_provided,second_deriv_provided);

as your function has the derivatives as the further outputs. The wiggly behavior came from the second order approximation paired with a finite difference approximation to the derivatives.
However, the fundamental problem is that your function has a zero first and second derivative at the steady state and will therefore not react to anything. Moreover, there is a kink at 0 that will not captured by a Taylor approximation.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany


Return to Dynare help

Who is online

Users browsing this forum: Google [Bot] and 12 guests