Page 2 of 3

Re: Urgent assistance: usual Bayesian estimation problem

PostPosted: Wed Aug 14, 2013 1:17 pm
by jpfeifer
I corrected the above code. The variable naming was not consistent.

To set it to a small identity, just set
Code: Select all
hh=1e-4*eye(size(hh))

Re: Urgent assistance: usual Bayesian estimation problem

PostPosted: Mon Sep 16, 2013 7:53 pm
by AS90
Dr. Pfeifer: I'm still working on it, besides holidays have interfered. I hope that my next post shall but encompass glee. Howbeit, sincere gratitude for all you've set forth hereto. Cheers.

Re: Urgent assistance: usual Bayesian estimation problem

PostPosted: Tue Sep 17, 2013 12:12 pm
by AS90
Not so gleeful after all upon return. Anyways, whilst utilising the modified "dynare_estimation_1.m" code version

Code: Select all
if ~options_.mh_posterior_mode_estimation && options_.cova_compute
        [cholmat,negeigennvalues]=cholcov(hh,0);
if negeigennvalues~=0 && ~isnan(negeigennvalues)
  [V,D] = eig(hh);
  D=abs(D);
  temp=diag(D);
  temp(temp<1e-8)=1e-8;
  D=diag(temp);
  hh=1e-4*eye(size(hh));
  [hh,negeigenvalues1]=cholcov(hh,0);
end


en lieu of the classic one

Code: Select all
if ~options_.mh_posterior_mode_estimation && options_.cova_compute
    try
        chol(hh);
    catch
        disp(' ')
        disp('POSTERIOR KERNEL OPTIMIZATION PROBLEM!')
        disp(' (minus) the hessian matrix at the "mode" is not positive definite!')
        disp('=> posterior variance of the estimated parameters are not positive.')
        disp('You should  try  to change the initial values of the parameters using')
        disp('the estimated_params_init block, or use another optimization routine.')
        warning('The results below are most likely wrong!');
    end
end


I have come across the following hindrance when exploiting mode_compute=4.

Code: Select all
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.
 
Starting Dynare (version 4.3.3).
Starting preprocessing of the model file ...
Substitution of endo lags >= 2: added 3 auxiliary variables and equations.
Found 20 equation(s).
Evaluating expressions...done
Computing static model derivatives:
 - order 1
Computing dynamic model derivatives:
 - order 1
 - order 2
Processing outputs ...done
Preprocessing completed.
Starting MATLAB/Octave computing.

 
You did not declare endogenous variables after the estimation/calib_smoother command.
Prior distribution for parameter rho_g has two modes!
Warning: File 'usvs1/prior' not found.
> In CheckPath at 41
  In set_prior at 264
  In dynare_estimation_init at 123
  In dynare_estimation_1 at 59
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
Loading 67 observations from simdata.m

Initial value of the log posterior (or likelihood): -16917479858827.47
-----------------
-----------------
f at the beginning of new iteration, 16917479858827.4726562500
Predicted improvement: 725111275279083473207296.000000000
lambda =          1; f = 354799973695706816.0000000
lambda =    0.33333; f = 39437255816629904.0000000
lambda =    0.11111; f = 4396954658578081.5000000
lambda =   0.037037; f = 503588139409747.3125000
lambda =   0.012346; f = 70991951559073.2187500
lambda =  0.0041152; f = 22925739150193.5273438
lambda =  0.0013717; f = 17585059111086.7675781
lambda = 0.00045725; f = 16991653627368.1953125
lambda = 0.00015242; f = 16925720821237.9707031
lambda = 5.0805e-05; f = 16918395332725.2246094
lambda = 1.6935e-05; f = 16917581515835.4941406
lambda =  5.645e-06; f = 16917491133829.4179688
lambda = 1.8817e-06; f = 16917481105415.2265625
lambda = 6.2723e-07; f = 16917479995823.9375000
lambda = 2.0908e-07; f = 16917479873822.2539062
lambda = 6.9692e-08; f = 16917479860426.5898438
lambda = 2.3231e-08; f = 16917479858984.1835938
lambda = 7.7435e-09; f = 16917479858839.1464844
lambda = 2.5812e-09; f = 16917479858827.7714844

lambda =

  -6.2723e-07

lambda = -6.2723e-07; f = 16917536766842.5214844
lambda = -2.0908e-07; f = 16917486180643.0429688
lambda = -6.9692e-08; f = 16917480560822.5234375
lambda = -2.3231e-08; f = 16917479936685.8984375
lambda = -7.7435e-09; f = 16917479867432.6699219
lambda = -2.5812e-09; f = 16917479859769.2148438
Norm of dx 1.2043e+10
----
Improvement on iteration 1 =        0.000000000
improvement < crit termination
smallest step still improving too slow, reversed gradient
Objective function at mode: 16917479858827.472656
 
MODE CHECK
 
Fval obtained by the minimization routine: 16917479858827.472656
 
 
RESULTS FROM POSTERIOR MAXIMIZATION
parameters
      prior mean     mode    s.d. t-stat prior pstdev

eta       2.450   2.4500 10.0000  0.2450 norm  0.7500
sigma_c   1.620   1.6200 10.0000  0.1620 norm  0.3750
h         0.690   0.6900 10.0000  0.0690 beta  0.1000
omicron   5.860   5.8600 10.0000  0.5860 norm  2.0000
omega     3.230   3.2300 10.0000  0.3230 norm  0.1000
rho_rn    0.880   0.8800 10.0000  0.0880 norm  0.1000
phi_pi    1.480   1.4800 10.0000  0.1480 norm  0.1000
phi_y     0.080   0.0800 10.0000  0.0080 norm  0.0500
tau       0.660   0.6600 10.0000  0.0660 beta  0.1000
xi        0.870   0.8700 10.0000  0.0870 beta  0.1000
rho_kappa   0.490   0.4900 10.0000  0.0490 beta  0.1000
rho_z     0.750   0.7500 10.0000  0.0750 beta  0.1000
rho_s     0.866   0.8660 10.0000  0.0866 beta  0.1000
rho_a     0.822   0.8220 10.0000  0.0822 beta  0.1000
rho_vphi   0.700   0.7000 10.0000  0.0700 beta  0.1000
rho_g     0.980   0.9800 10.0000  0.0980 beta  0.1000
standard deviation of shocks
      prior mean     mode    s.d. t-stat prior pstdev

e_kappa   0.250   0.2500 10.0000  0.0250 invg     Inf
e_z       0.250   0.2500 10.0000  0.0250 invg     Inf
e_a       0.250   0.2500 10.0000  0.0250 invg     Inf
e_s       0.250   0.2500 10.0000  0.0250 invg     Inf
e_vphi    0.250   0.2500 10.0000  0.0250 invg     Inf
e_g       0.250   0.2500 10.0000  0.0250 invg     Inf
 
Log data density [Laplace approximation] is -16917479858756.599609.
 
Warning: File 'usvs1/metropolis' not found.
> In CheckPath at 41
  In metropolis_hastings_initialization at 62
  In random_walk_metropolis_hastings at 69
  In dynare_estimation_1 at 931
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Multiple chains mode.
MH: Searching for initial values...
MH: I couldn't get a valid initial value in 100 trials.
MH: You should Reduce mh_init_scale...
MH: Parameter mh_init_scale is equal to 0.400000.
MH: Enter a new value...  0.01
MH: I couldn't get a valid initial value in 100 trials.
MH: You should Reduce mh_init_scale...
MH: Parameter mh_init_scale is equal to 0.010000.
MH: Enter a new value...  0.009
MH: Initial values found!
 
MH: Number of mh files                   : 1 per block.
MH: Total number of generated files      : 3.
MH: Total number of iterations           : 1000.
MH: average acceptation rate per chain   :
     0     0     0

 
MH: Total number of Mh draws: 1000.
MH: Total number of generated Mh files: 1.
MH: I'll use mh-files 1 to 1.
MH: In mh-file number 1 i'll start at line 500.
MH: Finally I keep 500 draws.
 
MH: I'm computing the posterior mean and covariance... Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  6.048776e-20.
> In compute_mh_covariance_matrix at 74
  In marginal_density at 50
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  6.048776e-20.
> In marginal_density at 56
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
 Done!
 
MH: I'm computing the posterior log marginale density (modified harmonic mean)...
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  6.048776e-20.
> In marginal_density at 67
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: The support of the weighting density function is not large enough...
MH: I increase the variance of this distribution.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  1.766881e-18.
> In marginal_density at 102
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  1.628578e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  7.020776e-19.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  3.854419e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  1.434634e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  3.001022e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  1.185226e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  2.664325e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  1.092922e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  2.740423e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  1.211734e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  8.509851e-19.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  5.124496e-19.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  1.230393e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  4.619124e-19.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  2.226457e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  9.653391e-19.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: There's probably a problem with the modified harmonic mean estimator.
 
 
ESTIMATION RESULTS
 
Log data density is -Inf.
 
parameters
          prior mean post. mean   conf. interval  prior     pstdev

eta          2.450     2.5128     2.4941   2.5234  norm      0.7500
sigma_c      1.620     1.5726     1.5293   1.6490  norm      0.3750
h            0.690     0.7136     0.6796   0.7588  beta      0.1000
omicron      5.860     5.8657     5.8194   5.8977  norm      2.0000
omega        3.230     3.1770     3.1271   3.2162  norm      0.1000
rho_rn       0.880     0.8338     0.8009   0.8599  norm      0.1000
phi_pi       1.480     1.3702     1.2954   1.4627  norm      0.1000
phi_y        0.080     0.0732     0.0564   0.0975  norm      0.0500
tau          0.660     0.7306     0.6805   0.8035  beta      0.1000
xi           0.870     0.8748     0.8302   0.9003  beta      0.1000
rho_kappa      0.490     0.4879     0.4520   0.5515  beta      0.1000
rho_z        0.750     0.8181     0.7703   0.8459  beta      0.1000
rho_s        0.866     0.8520     0.8303   0.8792  beta      0.1000
rho_a        0.822     0.8696     0.8229   0.9085  beta      0.1000
rho_vphi      0.700     0.6995     0.5958   0.7931  beta      0.1000
rho_g        0.980     0.9080     0.7955   0.9659  beta      0.1000
 
standard deviation of shocks
          prior mean post. mean   conf. interval  prior     pstdev

e_kappa      0.250     0.2046     0.1689   0.2707  invg         Inf
e_z          0.250     0.2836     0.1910   0.3328  invg         Inf
e_a          0.250     0.3017     0.2543   0.3651  invg         Inf
e_s          0.250     0.4057     0.3421   0.4611  invg         Inf
e_vphi       0.250     0.2365     0.1649   0.3108  invg         Inf
e_g          0.250     0.3230     0.2239   0.4111  invg         Inf
Warning: BETAINV did not converge for a = 0.9408, b = 0.0192, p = 0.999.
> In betainv at 61
  In draw_prior_density at 47
  In PlotPosteriorDistributions at 80
  In dynare_estimation_1 at 951
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
Total computing time : 0h00m52s


It need be recollected that the model's structural shocks have diminished to six: equalling the amount of observed variables, thus annihilating the erstwhile raised issue of stochastic singularity. Why do you believe to be there yet an issue with the modified harmonic mean estimator? Withal, mode_compute=6 doesn't even work. As mentioned in a previous post of mine, ulterior model re-specification would but integrally belittle the underlying research question; I would just wish to estimate these parameters in one way or another: how is one to surmount this all? Thank you.

Re: Urgent assistance: usual Bayesian estimation problem

PostPosted: Tue Sep 17, 2013 1:29 pm
by jpfeifer
Judging from the extremely high initial likelihood, your model did not solve correctly at all. Try providing initial values that lead to the model at least initially being solved.

Re: Urgent assistance: usual Bayesian estimation problem

PostPosted: Tue Sep 17, 2013 1:44 pm
by AS90
The initial values well suit the model, particularly in the orbit of calibration: the impulse response functions are extremely lifelike. Why is it generating a matrix close to singular (or badly scaled)? And why isn't mode_compute=6 not even working any longer? Gill & King (2004) do bear a valid point on computer question relevance discernment inability. Howbeit, could the file be courteously observed?

Re: Urgent assistance: usual Bayesian estimation problem

PostPosted: Tue Sep 17, 2013 8:11 pm
by jpfeifer
But you are not providing those calibrated values as initial values for calibration. Thus, the prior mean is taken. See the manual on how to provide starting values for estimation.

Re: Urgent assistance: usual Bayesian estimation problem

PostPosted: Tue Sep 17, 2013 10:09 pm
by AS90
I do ken what you mean but I guess we have been through this:

Code: Select all
eta, 2.45, normal_pdf, 2, 0.75;


with 2.45 as the initial, starting or commencing value for the full information estimation procedure under scrutiny. Nevertheless, the outcome varies not.

Code: Select all
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.
 
Starting Dynare (version 4.3.3).
Starting preprocessing of the model file ...
Substitution of endo lags >= 2: added 3 auxiliary variables and equations.
Found 20 equation(s).
Evaluating expressions...done
Computing static model derivatives:
 - order 1
Computing dynamic model derivatives:
 - order 1
 - order 2
Processing outputs ...done
Preprocessing completed.
Starting MATLAB/Octave computing.

 
You did not declare endogenous variables after the estimation/calib_smoother command.
Prior distribution for parameter rho_g has two modes!
Warning: File 'usvs1/prior' not found.
> In CheckPath at 41
  In set_prior at 264
  In dynare_estimation_init at 123
  In dynare_estimation_1 at 59
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
Loading 67 observations from simdata.m

Initial value of the log posterior (or likelihood): -16066322706048.12
-----------------
-----------------
f at the beginning of new iteration, 16066322706048.1230468750
Predicted improvement: 613049708085010484953088.000000000
lambda =          1; f = 887739114016133888.0000000
lambda =    0.33333; f = 98651958521113696.0000000
lambda =    0.11111; f = 10975609237057046.0000000
lambda =   0.037037; f = 1233793092106692.0000000
lambda =   0.012346; f = 151369223390114.9062500
lambda =  0.0041152; f = 31099953773500.9921875
lambda =  0.0013717; f = 17736717970434.7265625
lambda = 0.00045725; f = 16251919451168.7500000
lambda = 0.00015242; f = 16086943657534.4746094
lambda = 5.0805e-05; f = 16068613620336.5000000
lambda = 1.6935e-05; f = 16066577151716.4472656
lambda =  5.645e-06; f = 16066350944818.5703125
lambda = 1.8817e-06; f = 16066325833183.2207031
lambda = 6.2723e-07; f = 16066323050489.6523438
lambda = 2.0908e-07; f = 16066322743718.1386719
lambda = 6.9692e-08; f = 16066322710082.0253906
lambda = 2.3231e-08; f = 16066322706451.1367188
lambda = 7.7435e-09; f = 16066322706081.0820312
lambda = 2.5812e-09; f = 16066322706049.3125000

lambda =

  -6.2723e-07

lambda = -6.2723e-07; f = 16066370588169.4121094
lambda = -2.0908e-07; f = 16066328025234.1621094
lambda = -6.9692e-08; f = 16066323296720.5039062
lambda = -2.3231e-08; f = 16066322771563.8730469
lambda = -7.7435e-09; f = 16066322713291.0605469
lambda = -2.5812e-09; f = 16066322706841.7070312
Norm of dx 1.1073e+10
----
Improvement on iteration 1 =        0.000000000
improvement < crit termination
smallest step still improving too slow, reversed gradient
Objective function at mode: 16066322706048.123047
 
MODE CHECK
 
Fval obtained by the minimization routine: 16066322706048.123047
 
 
RESULTS FROM POSTERIOR MAXIMIZATION
parameters
      prior mean     mode    s.d. t-stat prior pstdev

eta       2.450   2.0000 10.0000  0.2000 norm  0.7500
sigma_c   1.620   1.0000 10.0000  0.1000 norm  0.3750
h         0.690   0.7000 10.0000  0.0700 beta  0.1000
omicron   5.860   4.0000 10.0000  0.4000 norm  2.0000
omega     3.230   5.0000 10.0000  0.5000 norm  0.1000
rho_rn    0.880   0.7500 10.0000  0.0750 norm  0.1000
phi_pi    1.480   1.5000 10.0000  0.1500 norm  0.1000
phi_y     0.080   0.1250 10.0000  0.0125 norm  0.0500
tau       0.660   0.7700 10.0000  0.0770 beta  0.1000
xi        0.870   0.7500 10.0000  0.0750 beta  0.1000
rho_kappa   0.490   0.8500 10.0000  0.0850 beta  0.1000
rho_z     0.750   0.8500 10.0000  0.0850 beta  0.1000
rho_s     0.866   0.8500 10.0000  0.0850 beta  0.1000
rho_a     0.822   0.8500 10.0000  0.0850 beta  0.1000
rho_vphi   0.700   0.8500 10.0000  0.0850 beta  0.1000
rho_g     0.980   0.8500 10.0000  0.0850 beta  0.1000
standard deviation of shocks
      prior mean     mode    s.d. t-stat prior pstdev

e_kappa   0.250   0.2500 10.0000  0.0250 invg     Inf
e_z       0.250   0.2500 10.0000  0.0250 invg     Inf
e_a       0.250   0.2500 10.0000  0.0250 invg     Inf
e_s       0.250   0.2500 10.0000  0.0250 invg     Inf
e_vphi    0.250   0.2500 10.0000  0.0250 invg     Inf
e_g       0.250   0.2500 10.0000  0.0250 invg     Inf
 
Log data density [Laplace approximation] is -16066322705977.250000.
 
Warning: File 'usvs1/metropolis' not found.
> In CheckPath at 41
  In metropolis_hastings_initialization at 62
  In random_walk_metropolis_hastings at 69
  In dynare_estimation_1 at 931
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Multiple chains mode.
MH: Searching for initial values...
MH: I couldn't get a valid initial value in 100 trials.
MH: You should Reduce mh_init_scale...
MH: Parameter mh_init_scale is equal to 0.400000.
MH: Enter a new value...  0.01
MH: Initial values found!
 
MH: Number of mh files                   : 1 per block.
MH: Total number of generated files      : 3.
MH: Total number of iterations           : 1000.
MH: average acceptation rate per chain   :
     0     0     0

 
MH: Total number of Mh draws: 1000.
MH: Total number of generated Mh files: 1.
MH: I'll use mh-files 1 to 1.
MH: In mh-file number 1 i'll start at line 500.
MH: Finally I keep 500 draws.
 
MH: I'm computing the posterior mean and covariance... Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  7.163005e-18.
> In compute_mh_covariance_matrix at 74
  In marginal_density at 50
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  7.163005e-18.
> In marginal_density at 56
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
 Done!
 
MH: I'm computing the posterior log marginale density (modified harmonic mean)...
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  7.163005e-18.
> In marginal_density at 67
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: The support of the weighting density function is not large enough...
MH: I increase the variance of this distribution.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  6.586269e-18.
> In marginal_density at 102
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  6.592658e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  7.168076e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  6.786268e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  7.834621e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  7.125031e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  7.781055e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  7.221069e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  7.115450e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  6.977791e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  7.016878e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  7.455596e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  6.778913e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  6.844161e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  6.910434e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  6.745399e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  7.237027e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: There's probably a problem with the modified harmonic mean estimator.
 
 
ESTIMATION RESULTS
 
Log data density is -Inf.
 
parameters
          prior mean post. mean   conf. interval  prior     pstdev

eta          2.450     2.0414     1.9497   2.1627  norm      0.7500
sigma_c      1.620     1.0338     0.9648   1.0706  norm      0.3750
h            0.690     0.7590     0.7120   0.8417  beta      0.1000
omicron      5.860     3.9508     3.8862   3.9914  norm      2.0000
omega        3.230     5.0411     5.0301   5.0482  norm      0.1000
rho_rn       0.880     0.8121     0.7024   0.8801  norm      0.1000
phi_pi       1.480     1.5601     1.4707   1.7117  norm      0.1000
phi_y        0.080     0.1868     0.1349   0.2436  norm      0.0500
tau          0.660     0.7389     0.6294   0.8507  beta      0.1000
xi           0.870     0.8081     0.7207   0.8520  beta      0.1000
rho_kappa      0.490     0.7700     0.7154   0.8380  beta      0.1000
rho_z        0.750     0.8773     0.7800   0.9973  beta      0.1000
rho_s        0.866     0.8493     0.6923   0.9485  beta      0.1000
rho_a        0.822     0.7998     0.7452   0.8788  beta      0.1000
rho_vphi      0.700     0.8193     0.7023   0.8815  beta      0.1000
rho_g        0.980     0.8206     0.7586   0.9122  beta      0.1000
 
standard deviation of shocks
          prior mean post. mean   conf. interval  prior     pstdev

e_kappa      0.250     0.2957     0.1881   0.3978  invg         Inf
e_z          0.250     0.1991     0.1272   0.2554  invg         Inf
e_a          0.250     0.3307     0.0653   0.4636  invg         Inf
e_s          0.250     0.1772     0.1680   0.1884  invg         Inf
e_vphi       0.250     0.2952     0.2244   0.4014  invg         Inf
e_g          0.250     0.2269     0.1038   0.3184  invg         Inf
Warning: BETAINV did not converge for a = 0.9408, b = 0.0192, p = 0.999.
> In betainv at 61
  In draw_prior_density at 47
  In PlotPosteriorDistributions at 80
  In dynare_estimation_1 at 951
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
Total computing time : 0h00m50s


What does this technically mean: "MH: There's probably a problem with the modified harmonic mean estimator."?

Re: Urgent assistance: usual Bayesian estimation problem

PostPosted: Wed Sep 18, 2013 8:34 am
by jpfeifer
As always, post the updated mod-file with the data-file

Re: Urgent assistance: usual Bayesian estimation problem

PostPosted: Wed Sep 18, 2013 9:29 am
by AS90
There files are herewith.
What is technically thwarting the estimation procedure?
What are: "MH: There's probably a problem with the modified harmonic mean estimator." and "Log data density is -Inf." striving to transmit?

Code: Select all
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.
 
Starting Dynare (version 4.3.3).
Starting preprocessing of the model file ...
Substitution of endo lags >= 2: added 3 auxiliary variables and equations.
Found 20 equation(s).
Evaluating expressions...done
Computing static model derivatives:
 - order 1
Computing dynamic model derivatives:
 - order 1
 - order 2
Processing outputs ...done
Preprocessing completed.
Starting MATLAB/Octave computing.

 
You did not declare endogenous variables after the estimation/calib_smoother command.
Prior distribution for parameter rho_g has two modes!
Warning: File 'usvs1/prior' not found.
> In CheckPath at 41
  In set_prior at 264
  In dynare_estimation_init at 123
  In dynare_estimation_1 at 59
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
Loading 67 observations from simdata.m

Initial value of the log posterior (or likelihood): -16066322706048.12
-----------------
-----------------
f at the beginning of new iteration, 16066322706048.1230468750
Predicted improvement: 613049708085010484953088.000000000
lambda =          1; f = 887739114016133888.0000000
lambda =    0.33333; f = 98651958521113696.0000000
lambda =    0.11111; f = 10975609237057046.0000000
lambda =   0.037037; f = 1233793092106692.0000000
lambda =   0.012346; f = 151369223390114.9062500
lambda =  0.0041152; f = 31099953773500.9921875
lambda =  0.0013717; f = 17736717970434.7265625
lambda = 0.00045725; f = 16251919451168.7500000
lambda = 0.00015242; f = 16086943657534.4746094
lambda = 5.0805e-05; f = 16068613620336.5000000
lambda = 1.6935e-05; f = 16066577151716.4472656
lambda =  5.645e-06; f = 16066350944818.5703125
lambda = 1.8817e-06; f = 16066325833183.2207031
lambda = 6.2723e-07; f = 16066323050489.6523438
lambda = 2.0908e-07; f = 16066322743718.1386719
lambda = 6.9692e-08; f = 16066322710082.0253906
lambda = 2.3231e-08; f = 16066322706451.1367188
lambda = 7.7435e-09; f = 16066322706081.0820312
lambda = 2.5812e-09; f = 16066322706049.3125000

lambda =

  -6.2723e-07

lambda = -6.2723e-07; f = 16066370588169.4121094
lambda = -2.0908e-07; f = 16066328025234.1621094
lambda = -6.9692e-08; f = 16066323296720.5039062
lambda = -2.3231e-08; f = 16066322771563.8730469
lambda = -7.7435e-09; f = 16066322713291.0605469
lambda = -2.5812e-09; f = 16066322706841.7070312
Norm of dx 1.1073e+10
----
Improvement on iteration 1 =        0.000000000
improvement < crit termination
smallest step still improving too slow, reversed gradient
Objective function at mode: 16066322706048.123047
 
MODE CHECK
 
Fval obtained by the minimization routine: 16066322706048.123047
 
 
RESULTS FROM POSTERIOR MAXIMIZATION
parameters
      prior mean     mode    s.d. t-stat prior pstdev

eta       2.450   2.0000 10.0000  0.2000 norm  0.7500
sigma_c   1.620   1.0000 10.0000  0.1000 norm  0.3750
h         0.690   0.7000 10.0000  0.0700 beta  0.1000
omicron   5.860   4.0000 10.0000  0.4000 norm  2.0000
omega     3.230   5.0000 10.0000  0.5000 norm  0.1000
rho_rn    0.880   0.7500 10.0000  0.0750 norm  0.1000
phi_pi    1.480   1.5000 10.0000  0.1500 norm  0.1000
phi_y     0.080   0.1250 10.0000  0.0125 norm  0.0500
tau       0.660   0.7700 10.0000  0.0770 beta  0.1000
xi        0.870   0.7500 10.0000  0.0750 beta  0.1000
rho_kappa   0.490   0.8500 10.0000  0.0850 beta  0.1000
rho_z     0.750   0.8500 10.0000  0.0850 beta  0.1000
rho_s     0.866   0.8500 10.0000  0.0850 beta  0.1000
rho_a     0.822   0.8500 10.0000  0.0850 beta  0.1000
rho_vphi   0.700   0.8500 10.0000  0.0850 beta  0.1000
rho_g     0.980   0.8500 10.0000  0.0850 beta  0.1000
standard deviation of shocks
      prior mean     mode    s.d. t-stat prior pstdev

e_kappa   0.250   0.2500 10.0000  0.0250 invg     Inf
e_z       0.250   0.2500 10.0000  0.0250 invg     Inf
e_a       0.250   0.2500 10.0000  0.0250 invg     Inf
e_s       0.250   0.2500 10.0000  0.0250 invg     Inf
e_vphi    0.250   0.2500 10.0000  0.0250 invg     Inf
e_g       0.250   0.2500 10.0000  0.0250 invg     Inf
 
Log data density [Laplace approximation] is -16066322705977.250000.
 
Warning: File 'usvs1/metropolis' not found.
> In CheckPath at 41
  In metropolis_hastings_initialization at 62
  In random_walk_metropolis_hastings at 69
  In dynare_estimation_1 at 931
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Multiple chains mode.
MH: Searching for initial values...
MH: I couldn't get a valid initial value in 100 trials.
MH: You should Reduce mh_init_scale...
MH: Parameter mh_init_scale is equal to 0.400000.
MH: Enter a new value...  0.01
MH: Initial values found!
 
MH: Number of mh files                   : 1 per block.
MH: Total number of generated files      : 3.
MH: Total number of iterations           : 1000.
MH: average acceptation rate per chain   :
     0     0     0

 
MH: Total number of Mh draws: 1000.
MH: Total number of generated Mh files: 1.
MH: I'll use mh-files 1 to 1.
MH: In mh-file number 1 i'll start at line 500.
MH: Finally I keep 500 draws.
 
MH: I'm computing the posterior mean and covariance... Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  7.163005e-18.
> In compute_mh_covariance_matrix at 74
  In marginal_density at 50
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  7.163005e-18.
> In marginal_density at 56
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
 Done!
 
MH: I'm computing the posterior log marginale density (modified harmonic mean)...
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  7.163005e-18.
> In marginal_density at 67
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: The support of the weighting density function is not large enough...
MH: I increase the variance of this distribution.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  6.586269e-18.
> In marginal_density at 102
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  6.592658e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  7.168076e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  6.786268e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  7.834621e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  7.125031e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  7.781055e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  7.221069e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  7.115450e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  6.977791e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  7.016878e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  7.455596e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  6.778913e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  6.844161e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  6.910434e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  6.745399e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: Let me try again.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =  7.237027e-18.
> In marginal_density at 108
  In dynare_estimation_1 at 948
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
MH: There's probably a problem with the modified harmonic mean estimator.
 
 
ESTIMATION RESULTS
 
Log data density is -Inf.
 
parameters
          prior mean post. mean   conf. interval  prior     pstdev

eta          2.450     2.0414     1.9497   2.1627  norm      0.7500
sigma_c      1.620     1.0338     0.9648   1.0706  norm      0.3750
h            0.690     0.7590     0.7120   0.8417  beta      0.1000
omicron      5.860     3.9508     3.8862   3.9914  norm      2.0000
omega        3.230     5.0411     5.0301   5.0482  norm      0.1000
rho_rn       0.880     0.8121     0.7024   0.8801  norm      0.1000
phi_pi       1.480     1.5601     1.4707   1.7117  norm      0.1000
phi_y        0.080     0.1868     0.1349   0.2436  norm      0.0500
tau          0.660     0.7389     0.6294   0.8507  beta      0.1000
xi           0.870     0.8081     0.7207   0.8520  beta      0.1000
rho_kappa      0.490     0.7700     0.7154   0.8380  beta      0.1000
rho_z        0.750     0.8773     0.7800   0.9973  beta      0.1000
rho_s        0.866     0.8493     0.6923   0.9485  beta      0.1000
rho_a        0.822     0.7998     0.7452   0.8788  beta      0.1000
rho_vphi      0.700     0.8193     0.7023   0.8815  beta      0.1000
rho_g        0.980     0.8206     0.7586   0.9122  beta      0.1000
 
standard deviation of shocks
          prior mean post. mean   conf. interval  prior     pstdev

e_kappa      0.250     0.2957     0.1881   0.3978  invg         Inf
e_z          0.250     0.1991     0.1272   0.2554  invg         Inf
e_a          0.250     0.3307     0.0653   0.4636  invg         Inf
e_s          0.250     0.1772     0.1680   0.1884  invg         Inf
e_vphi       0.250     0.2952     0.2244   0.4014  invg         Inf
e_g          0.250     0.2269     0.1038   0.3184  invg         Inf
Warning: BETAINV did not converge for a = 0.9408, b = 0.0192, p = 0.999.
> In betainv at 61
  In draw_prior_density at 47
  In PlotPosteriorDistributions at 80
  In dynare_estimation_1 at 951
  In dynare_estimation at 70
  In usvs1 at 322
  In dynare at 120
Total computing time : 0h00m50s

Re: Urgent assistance: usual Bayesian estimation problem

PostPosted: Wed Sep 18, 2013 11:34 am
by jpfeifer
Here, it signals problems in estimation before those steps. It looks as if your observables are inconsistent with the model. In particular, your observed variables are huge, but your prior standard deviation for the shocks is tiny. Thus, the likelihood is very small. I would guess it is a scaling issue.

Re: Urgent assistance: usual Bayesian estimation problem

PostPosted: Wed Sep 18, 2013 11:54 am
by AS90
Right; I see: would such envisage a thousandfold downsizing of them all then? Gratitude.

Re: Urgent assistance: usual Bayesian estimation problem

PostPosted: Thu Sep 19, 2013 8:34 am
by jpfeifer
Your observed variables have to be consistent with the model. There is no arbitrariness in scaling.

Re: Urgent assistance: usual Bayesian estimation problem

PostPosted: Fri Sep 20, 2013 4:44 pm
by AS90
In what sense are they inconsistent: as to their becomingness within the sphere of the sought parameters estimation, hence qualitatively? Am I thus to select diverse observables? Withal, by too large or huge what does one exactly intend: large or small enough so as to generate my desired IRFs? What does technically demarcate consistency? Thence: could you please elaborate on such remark of yours? Thanks.

Re: Urgent assistance: usual Bayesian estimation problem

PostPosted: Sat Sep 21, 2013 3:36 pm
by jpfeifer
In state space systems like the models we deal with, there is an observation equation. This equation describes how the observed data maps into the model variables. Often, we perform log-linearizations of the model. If your data then has a value of 0.1 this corresponds to a 10% deviation from steady state. Given that your observables are in the range of thousands, they are most probably inconsistent with the way you defined your model variables.

Re: Urgent assistance: usual Bayesian estimation problem

PostPosted: Sun Sep 22, 2013 9:19 am
by AS90
Very clear; thanks. Although what is one to specifically seek within the model so as to obtain such consistency? Is one to edit the optimisation problems for each sector so as to consequently alter the motion laws? If so, how does that exactly relate to data magnitude?

In other words: where is one to find this "variables definition" which you are referring to?

Given that your observables are in the range of thousands, they are most probably inconsistent with the way you defined your model variables.