First time using 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.

First time using fsolve

Postby sodmoraes » Sun Nov 01, 2015 1:56 pm

Dear all,

I´m new to dynare(and matlab) and i´m trying to calculate the steady state of my model. Since my model have a lot of nonlinear equations i want to solve for the steady state using an external matlab code(fsolve) to find the steady state of all the equilibrium equations of my model. My question is how should i input the equations in the .m steady state file so i can get the steady state of all variables using fsolve(i dont wanna write each variable in the .m file as defined in terms of the variables defined before, since the equations are highly nonlinear)?Basically, my question is how should i input all my model equilibrium equations in the steady state .m file?

I know i should rewrite all equations so they are in the form F(x) = 0. My questions are: what should i do with lagged variables and steady state terms? For example, please look at this equations:

1) k = i + ( 1 - delta)*k(-1); ** Should i put all variables in the steady state so k = k(-1) = k and rewrite all the other equations in this fashion?

Another problem is that some equations of my model have steady state terms(taylor rule and some shock equations):

2) ln(R/R_ss) = alfa_r* ln(R(-1)/R_ss) + (1 - alfa_r)*(alfa_pi*ln(Pi/Pi_ss) + alfa_y*ln(y/y_ss)) + e_r; **How should i rewrite this equation,so i can solve the steady state of my model using fsolve?

Thanks.

Adriano
sodmoraes
 
Posts: 3
Joined: Sun Nov 01, 2015 12:52 pm

Re: First time using fsolve

Postby jpfeifer » Sun Nov 01, 2015 4:41 pm

Why would you want to do that? Dynare itself already has a numerical solver for finding the steady state. Unless you manually simplify your steady state to make the problem lower-dimensional (like breaking it down to one nonlinear equation as is done in the NK_baseline.mod in the Dynare examples folder), you do not gain anything by using a steady state file.
------------
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: First time using fsolve

Postby sodmoraes » Mon Nov 02, 2015 12:22 am

Hi,

Thank you for your prompt reply. I tought that solving for the steady state using fsolve(with a .m stead statle file, instead of using dynare numeric solver)was better, since i didn´t need to have reliable initial values for the variables( i know you need to give starting points while using fsolve, but i tought it didnt need to be as accurate as when using dynare).

To clarify my situation, i´m trying to run a dsge model for my master´s degree(i attached my code) and i log-linearized the model(as i didn´t know the ss values of the variables).However, some of my original (non-linear) equations involve sums, so some of my linearized equations have ratios of steady state values. So i tried to provide the initial values for this steady state variables( in the parameter block of the mod file, as the model is log-linearized), but i think my guesses weren´t that good( i got some from the literature, some from the original paper and some were guesses) as i ran into a problem with BK violated condiditions(more eigenvalues larger than 1 than forward variables) and i think the problem is probably caused by my choices to steady state of the variables .So i tought if a created a .mod file ,to calcultate the steady state of all my model equations(not log-linearized), i could find the ss and solve this problem...


Thanks,

Adriano.
Last edited by sodmoraes on Wed Nov 04, 2015 1:12 am, edited 1 time in total.
sodmoraes
 
Posts: 3
Joined: Sun Nov 01, 2015 12:52 pm

Re: First time using fsolve

Postby jpfeifer » Mon Nov 02, 2015 9:52 am

i log-linearized the model(as i didn´t know the ss values of the variables)

That statement makes no sense. When you loglinearize your model, you still need to know the steady state values of the original loglinear equations for the parameter values you now need to set. But you are introducing an additional complication in that Dynare will not check the correctness of your steady state computations when you enter log-linearized equations.
------------
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