Dynare 4.2.0 Error using Rand

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.

Re: Dynare 4.2.0 Error using Rand

Postby hlt215 » Wed Nov 05, 2014 6:02 pm

I'll try being more precise. My understanding is that the conditional expectation of a shock is always zero iff I'm integrating over the full distribution, that is from -inf to +inf. But if one integral's boundary is an endogenous variable, the expected value of the epsilon-shock shouldn't be zero. I think I can better explain myself if you have a look at the attached document from where it should be clearer what I would need to do.

Thank you for your time.
Attachments
dynare.pdf
(69.65 KiB) Downloaded 138 times
hlt215
 
Posts: 14
Joined: Mon Sep 15, 2014 11:54 am

Re: Dynare 4.2.0 Error using Rand

Postby hlt215 » Wed Nov 12, 2014 3:06 pm

Hi, anybody?
hlt215
 
Posts: 14
Joined: Mon Sep 15, 2014 11:54 am

Re: Dynare 4.2.0 Error using Rand

Postby jpfeifer » Wed Nov 12, 2014 8:24 pm

The answer is not so easy. If you don't have a recursive representation to get rid the integral by defining the whole thing as a variable (e.g. http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=3087), you can only try a external function http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=2259. Unfortunately, I don't have experience with models like this. You may want to look at how Christiano/Motto/Rostagno (2014): RIsk shocks, AER dealt with this. They have replication files online.
------------
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

Re: Dynare 4.2.0 Error using Rand

Postby hlt215 » Wed Nov 12, 2014 11:44 pm

Using external functions is actually what I did. It looked to be quite a successful method, in the sense that I think I can succeed to implement the first integral in this way:

1) Declaring the external function before the model block:
external_function(name=integral_afa2,nargs=1,first_deriv_provided);

2) Writing a function afa2.m that looks like
function f = afa2(epsilon)
f = epsilon.*normpdf(epsilon,0,1);
end

3) integral_afa_2 is then a function that integrates afa_2

My problem, however, is about the second integral. In particular, I am not able to write a function like the one in 2) but for the variable 'w' and associated to the epsilon-pdf.
Something like:
f = w.*normpdf(epsilon,0,1); (But this doesn't work)

Thank you for your references, I will try to have a look.
hlt215
 
Posts: 14
Joined: Mon Sep 15, 2014 11:54 am

Previous

Return to Dynare help

Who is online

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