Steady state file- problem with fsolve

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.

Steady state file- problem with fsolve

Postby georam11 » Tue Feb 28, 2017 11:05 am

Dear Prof Pfeifer,

I have tried to incorporate the DMP framework to asset pricing model. Solving for the steady state is not possible analytically, hence i wrote a steady state.m file.

I have attached both the m file and mod file. Fsolve does not seem to solve my highly non linear equation to get theta_t. Please could you explain how to give the initial value under fsolve for the attached m file?

Looking forward to your reply.

Many Thanks
Ammu
Attachments
Version4_28Feb_steadystate.m
(3.42 KiB) Downloaded 85 times
Last edited by georam11 on Wed Apr 12, 2017 9:07 am, edited 1 time in total.
georam11
 
Posts: 13
Joined: Tue Jun 07, 2016 7:02 am

Re: Steady state file- problem with fsolve

Postby jpfeifer » Tue Feb 28, 2017 11:49 am

What do you mean? You are already providing an initial value. In
Code: Select all
[theta_t,fval,exitflag]=fsolve(@(theta_t)(exp(m+dn)*((1-s)+(((exp(k_h1t)*(1+exp(iota*theta_t))^(1/iota))+exp(k_h2t))^(-1))*(((1-eta)*(1-epsitlon)*(1-alphat)*exp(alphat*(log((delta-1+exp(-m))/(((epsitlon*nu)^(epsitlon/(1-epsitlon)))*(1-epsitlon)*alphat*exp((a+log((1+s*(1+exp(-iota*theta_t))^(-1/iota))))*(1-alphat))))/(alphat-1)-log((1+s*(1+exp(-iota*theta_t))^(-1/iota)))))*exp((1-alphat)*a)*((epsitlon*nu)^(epsitlon/(1-epsitlon))))-eta*(exp(k_h1t+theta_t)+ (exp(k_h2t)/((1+exp(-iota*theta_t))^(1/iota))))-(1-eta)*exp(bt))))-1,log(2),options);

it's the
Code: Select all
log(2)
------------
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: Steady state file- problem with fsolve

Postby georam11 » Mon Mar 06, 2017 6:44 am

Hello Prof Pfeifer,

Sorry if my question was not clear.

I tried giving some random initial values in the above code to see if I would be able to solve for a steady state value for theta_t.

However, I was unable to solve for theta_t. So I am asking if there is a methodology where I can give an initial value instead of log(2) to help me solve the equation?

Many Thanks
Ammu
georam11
 
Posts: 13
Joined: Tue Jun 07, 2016 7:02 am

Re: Steady state file- problem with fsolve

Postby jpfeifer » Tue Mar 07, 2017 12:15 pm

What you can always do is check for the
Code: Select all
exitflag

and add an if-clause that tries to solve the equation with a different starting value whenever the exitflag>0 (which should be the error codes.)
------------
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: No registered users and 7 guests