Warning: Matrix close to singular or badly scaled

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.

Warning: Matrix close to singular or badly scaled

Postby Serenity6 » Fri May 06, 2016 1:12 am

Hi, all,

I'm trying to find the optimal macroprudential and monetary rules in a DSGE model using optimal simple rules.
However I obtained a multiple of warnings as follows:


Configuring Dynare ...
[mex] Generalized QZ.
[mex] Sylvester equation solution.
[mex] Kronecker products.
[mex] Sparse kronecker products.
[mex] Local state space iteration (second order).
[mex] Bytecode evaluation.
[mex] k-order perturbation solver.
[mex] k-order solution simulation.
[mex] Quasi Monte-Carlo sequence (Sobol).
[mex] Markov Switching SBVAR.

Using 64-bit preprocessor
Starting Dynare (version 2015-10-23).
Starting preprocessing of the model file ...
Substitution of endo lags >= 2: added 4 auxiliary variables and equations.
Found 83 equation(s).
Evaluating expressions...done
Computing static model derivatives:
- order 1
Computing dynamic model derivatives:
- order 1
- order 2
Processing outputs ...
done
Preprocessing completed.


OPTIMAL SIMPLE RULE


OSR: Initial value of the objective function: 30.1947

-----------------
f at the beginning of new iteration, 30.1946739199
Predicted improvement: 0.133201213
lambda = 1; f = 29.9297296
lambda = 1.9332; f = 29.6850440
lambda = 3.7372; f = 29.2186078
lambda = 7.2247; f = 28.3387215
lambda = 13.967; f = 26.6940188
lambda = 27; f = 103423018.0523657
lambda = 18.18; f = 25.6739418
lambda = 23.049; f = 101859488.5679415
lambda = 19.99; f = 100134318.3320013
lambda = 18.354; f = 25.6315359
lambda = 19.319; f = 25.3943247
lambda = 20.335; f = 100327449.5864580
lambda = 19.719; f = 25.2953508
lambda = 20.086; f = 100188043.3105255
lambda = 19.865; f = 100064119.4085202
Norm of dx 0.0051614
----
Improvement on iteration 1 = 4.899323116
warning: possible inaccuracy in H matrix
-----------------
f at the beginning of new iteration, 25.2953508037
Predicted improvement: 29.750447518
lambda = 1; f = 100554997.7040317
lambda = 0.33333; f = 103423018.0523658
lambda = 0.11111; f = 103423018.0523656
lambda = 0.037037; f = 103423018.0523656
lambda = 0.012346; f = 101664723.0438191
lambda = 0.0041152; f = 100540719.5171381
lambda = 0.0013717; f = 100168255.6644537
lambda = 0.00045725; f = 100044268.4353072
lambda = 0.00015242; f = 100002955.6048355
lambda = 5.0805e-005; f = 25.2923052
lambda = 9.8216e-005; f = 25.2894634
lambda = 0.00018987; f = 100008031.1053914
Warning: Matrix is close to singular or badly
scaled.
Results may be inaccurate. RCOND =
8.287261e-018.
> In dyn_first_order_solver at 314
In stochastic_solvers at 238
In resol at 141
In osr_obj at 48
In csminit1 at 140
In csminwel1 at 118
In dynare_minimize_objective at 203
In osr1 at 102
In osr at 60
In e at 981
In dynare at 223
lambda = 0.00012785; f = 25.2883736
lambda = 0.00016209; f = 100004266.2215708
lambda = 0.00014058; f = 100001351.2700622
Warning: Matrix is close to singular or badly
scaled.
Results may be inaccurate. RCOND =
4.201578e-018.
> In dyn_first_order_solver at 314
In stochastic_solvers at 238
In resol at 141
In osr_obj at 48
In csminit1 at 140
In csminwel1 at 118
In dynare_minimize_objective at 203
In osr1 at 102
In osr at 60
In e at 981
In dynare at 223
lambda = 0.00012907; f = 25.2851655
lambda = 0.00013585; f = 100000711.3056649
lambda = 0.00013174; f = 100000153.7416213
Warning: Matrix is close to singular or badly
scaled.
Results may be inaccurate. RCOND =
3.495697e-018.
> In dyn_first_order_solver at 314
In stochastic_solvers at 238
In resol at 141
In osr_obj at 48
In csminit1 at 140
In csminwel1 at 118
In dynare_minimize_objective at 203
In osr1 at 102
In osr at 60
In e at 981
In dynare at 223
lambda = 0.00012933; f = 25.2870071
Warning: Matrix is close to singular or badly
scaled.
Results may be inaccurate. RCOND =
7.934372e-019.

Can somebody please explain what this means and what I can do about it? Thanks!
Serenity6
 
Posts: 4
Joined: Wed Jun 10, 2015 3:41 am

Re: Warning: Matrix close to singular or badly scaled

Postby jpfeifer » Fri May 06, 2016 8:16 am

This means that the Newton-type solver tries some parameter values that result in the matrices arising during solving the model being close to singular. This can happen but is no reason to worry unless the solver terminates prematurely due to this. I tried your file and it stops after 153 iterations, with no warning appearing after iteration 3, so you should be fine.
------------
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: Warning: Matrix close to singular or badly scaled

Postby Serenity6 » Sun May 08, 2016 9:50 pm

Thanks a lot, Dr. Pfeier! Could you tell me how you find that it stops after 153 iterations, with no warning appearing after iteration 3? Did you use any commands? Much appreciated!
Serenity6
 
Posts: 4
Joined: Wed Jun 10, 2015 3:41 am

Re: Warning: Matrix close to singular or badly scaled

Postby jpfeifer » Mon May 09, 2016 9:21 am

Just look at the output of the solver. You can see e.g.
Improvement on iteration 1 = 4.899323116

This gives you the iteration. I had no
Results may be inaccurate. RCOND =
8.287261e-018.
> In dyn_first_order_solver at 314
In stochastic_solvers at 238
In resol at 141
In osr_obj at 48
In csminit1 at 140
In csminwel1 at 118
In dynare_minimize_objective at 203
In osr1 at 102
In osr at 60
In e at 981
In dynare at 223

after iteration number 3 (though this might be different on different computers)
------------
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: Warning: Matrix close to singular or badly scaled

Postby Serenity6 » Tue May 10, 2016 10:45 pm

Get it, thanks a lot, Dr. Pfeifer!
Serenity6
 
Posts: 4
Joined: Wed Jun 10, 2015 3:41 am


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 14 guests