Initial values using Fsolve

Hi,

I am trying to enhance Gambacorta and Signoretti paper by adding a disturbance shock for the loan amount as well as an impatient household.
Although, i manage to replicate the original paper with the help from the authors and getting initial values using Fsolve, i cannot find the steady state with the new items i have added. Basically, the solver stops prematurely, so i am not sure whether it is because of the No of iteration or a model without a solution.

Can you help?

Attached is the file .m file used to find the solution.
DSGE_19.m (3.7 KB)

You need to provide the full files.

@jpfeifer, attached you may find both filesDSGE_Fsolve.mod (9.2 KB) DSGE_19.m (3.7 KB)

Your mod-file returns various preprocessing errors. Did you upload the most recent version?

@jpfeifer basically yes, but i thought that the issues had to only do with the steady state.
At any case, i made some amendments and can solve the model, but when changing some of the parameters in the monetary rule (i.e phi_AP, phi_B) the model cannot be solve. Do i need completely new initial values in order to solve it? Why is this DSGE_19_Shocks_2.mod (5.6 KB) happening?

Attached the model

and the fsolve functionfuncheck_2.m (3.1 KB)

Again I am getting an error

ERROR: DSGE_19_Shocks_2.mod: line 42, cols 1-6: syntax error, unexpected VAREX

because you forgot a semicolon.

Attached the correct file.DSGE_19_Shocks_2.mod (5.6 KB)

The attached file runs and computes a steady state, so where is the problem?

The issue is that if i change some of the parameters in the monetary rule (like phi_AP or phi_B) the model cannot be solve.

Please be more careful and precise. When does that happen and what is the error message. Using

phi_AP   = 1;    
phi_B    = 1;    

works.

@jpfeifer Thank you vrey much for your prompt answer and help.
Basically i was putting in phi_pie=0 and was plugging phi_AP and phi_B to 0.5, to check if the monetary rule doesn’t target inflation at all and targets y or just AP.

Again, you did not answer my question. What is the error message in this case?

@jpfeifer excuse me for my late response.When i was putting in phi_pie=0 and was plugging phi_AP and phi_B to 0.5, to check if the monetary rule doesn’t target inflation at all and targets just AP or loans i receive the below:
Warning: Matrix is singular to working precision.

In trust_region>dogleg (line 202)
In trust_region (line 112)
In dynare_solve (line 185)
In evaluate_steady_state (line 223)
In resol (line 104)
In check (line 73)
In DSGE_19_Shocks_2 (line 435)
In dynare (line 235)
Error using print_info (line 83)
Impossible to find the steady state. Either the model doesn’t have a steady state, there are an
infinity of steady states, or the guess values are too far from the solution

Error in check (line 76)
print_info(info, 0, options);

Error in DSGE_19_Shocks_2 (line 435)
oo_.dr.eigval = check(M_,options_,oo_);

Error in dynare (line 235)
evalin(‘base’,fname) ;

My guess is that without inflation feedback, the steady state inflation cannot be endogenously determined (indeterminacy). For that reason, the steady state cannot be found.

Dear @jpfeifer i have tried to solve with fsolve (.m file) and many iterations the model, concluding with residuals very close to 0 ( until 4-5 demicals).

I then input them as initial values in the attached DSGE model waiting to be solved, but dynare couldn’t find the steady state, besides the results of fsolve. Any idea on how to overcome that? Why do you think it doenst work?

Attached also the matlab file used for the fsolveDSGE_LTV.mod (5.7 KB) funcheck_LTV.m (3.2 KB)

If you put resid before steady, you will see that some equations show large residuals, while most others have 0 residuals. Given that you say you solved the steady state until the residuals were close to 0, there is something strange here.

Dear prof @jpfeifer i have already resid command before steady but the model doesn’t run as i get the below message:

Warning: Matrix is singular to working precision.

In trust_region>dogleg (line 202)
In trust_region (line 112)
In dynare_solve (line 185)
In evaluate_steady_state (line 223)
In resol (line 104)
In check (line 73)
In DSGE_LTV (line 425)
In dynare (line 235)
Error using print_info (line 83)
Impossible to find the steady state. Either the model doesn’t have a steady state, there are an
infinity of steady states, or the guess values are too far from the solution

Error in check (line 76)
print_info(info, 0, options);

Error in DSGE_LTV (line 425)
oo_.dr.eigval = check(M_,options_,oo_);

Error in dynare (line 235)
evalin(‘base’,fname) ;

As for fsolve, i use in matlab the below code to solve the .m file and get the residuals of the system:
opt = optimoptions(‘fsolve’,‘MaxFunEvals’, 1e7, ‘MaxIter’, 1e7);
x0 = rand(1,37);
[bestx,residues] = fsolve(@funcheck_LTV,x0,opt);
residue = sum(residues.^2);
bestx, residue

Any idea why it doesn’t run at all? Morever, if you run the .m file with fsolve do you actualy get residuals close to 0 (like i did)?

PS. Attached the .m and dynare fileDSGE_LTV.mod (5.7 KB) funcheck_LTV.m (3.2 KB)

Sorry, I meant putting it before check. It seems the equation system you are solving in your m-file differs from the one in your mod-file. That is the only explanation.

Thanks @jpfeifer. After playing a bit with the initial values in the equations with big residuals and some small modifications in the model i manage to find the steady state.