Estimation Help (FVRR)


I have been trying to estimate a pared-down version of Fernandez-Villaverde and Rubio-Ramirez (2006) “Benchmark DSGE Model” using South Korean data, and I’ve run into a number of issues along the way - I am new to Dynare so I would greatly appreciate any help!

I suspect that my issue comes from either mis-specified or miscaled shocks, but I can’t figure out how to fix it. When I run the estimation, the posterior estimates seem reasonable with the exception of the standard errors of the three shocks (monetary policy, intertemporal preference, and labor disutility shocks) and the labor disutility parameter, which are all absurdly large. I get an error saying that the matrix is badly scaled/close to singular, and I think that stems from my shocks being miscaled - but all my shocks are explosive unless I set them at extremely small values. Depending on what I do, I also sometimes get errors saying the matrix isn’t positive definite or that the hessian matrix “at the mode” is not positive definite.

I’m not sure if my shocks are specified incorrectly or if my priors are inappropriate. The model is entered nonlinearly but written for Dynare to loglinearize. I kept the the shocks written as they were (I was trying to follow Pfeifer 2013 but I am a little confused here), for example:
Euler equation: d/exp© = exp(lam)
where d is a preference shock that follows law of motion log(d)=rhod*log(d(-1))+epsd, but I’m not sure if that’s correct? I would greatly appreciate any help!

Data and mod files are attached. I’ve applied log differences yd, c, and l (without scaling by 100) and logged inflation and interest rate.
test4_steadystate.m (4.47 KB)
test4.mod (5.43 KB)
data.txt (13.9 KB)

I forgot to mention that the posterior estimates for the Taylor coefficients are often absurdly large as well - sorry for the double post!

Hard to tell. A couple of things:

  1. Your data looks as if it has a seasonal pattern. Did you use seasonally adjusted data before computing growth rates?
  2. The psy in your model is not identified with the current observables. Therefore, you cannot estimate it.
  3. Your prior for the rhos implies an asymptote at the unit root. That is not a good idea. Choose a lower mean or standard deviation
  4. Starting estimation at the prior mean is often not a good idea. In your case, you start with a prior standard deviation of 10%, which seems rather large.
  5. You are not estimating the mean of inflation and of the interest rate. Using non-demeaned observables for these variables is then not recommended.

Thanks so much for the response! I wasn’t expecting it to be so quick. If you don’t mind, I also have a number of follow up questions:

  1. My data came seasonally adjusted, so the fact that it looks like it has a seasonal pattern is a bit surprising. Do you think there might be an issue with the data (that is messing with estimation) or should I use a different filter?
  2. I’m still having difficulty finding appropriate (and appropriately scaled) priors for my shocks. When I set the standard errors at low values (like .01, .001) I get a message that the matrix is singular to working precision or badly scaled, and when I try to set higher values, the graphs are jagged and not smooth.
  3. Kind of a follow up to the second question, but I’m trying to figure out why I get the message that the matrix is singular - this shouldn’t be the case because I have five observables with three shocks and three measurement errors. Either the values are too small/miscaled or I’m specifying the measurement equations incorrectly. In the steady state file, for example, I initialize yd_obs=0; while in the mod file the observation equation is yd_obs=yd-yd(-1)+eps_y (I’m using first differences). Is this incorrect?

Thanks again!!

  1. In particular l_obs looks very strange. There is something funny going on in your data. If you look at autocorrelation plots of your data, there seem to be periodic spikes. It could also be that the data has been seasonally adjusted, but the one outlier you have (I guess Great Recession) messes up the adjustment.
  2. Priors are chosen before seeing the data. Good priors typically are somewhat diffuse and put a high probability on shock sizes around 1 percent. For measurement error, there is less good guidance. Which graphs are jagged? The mode_check-plots? And where does the warning appear? If at the beginning of mode-finding, then it is ok.
  3. Your observation equations looked OK. What you should try to do is simulate data from you model calibrated to sensible values and then compare the simulated data to the actual data. It should be similar in mean and variance.
1 Like

Thanks so much for the response! I’m sorry to keep bothering you, but I was hoping you could answer a couple more questions for me.

  1. The data I have for hours worked is somewhat strange and I’m not sure how I should treat it - I switched it from total labor hours*employed persons to average hours in a working week (I thought that was more appropriate for FVVR). The problem is it shows a steady decline through time (possibly from changing norms?). Do you have any recommendations for treating such data?
  2. I think the warning about the matrix being singular appears at the end of mode-finding (when fsolve finishes). I can’t work out what is causing the problem because I have 7 shocks (including 4 measurement error) to 5 observables, which would mean at least 3 shocks are dropping out. Are there ways to figure out which parts of the matrix are causing it to be singular?

Thanks again - I really appreciate it!

  1. Either go for demeaned growth rates of labor or use a linear trend to deal with the low-frequency movement.
  2. I still don’t know where exactly which message appears. Please post the respective part from Dynare’s log-file.

This is where the warning shows up (I’m aware of the posterior kernel warning but I’ll try to address it later):

fsolve completed because the vector of function values is near zero
as measured by the default value of the function tolerance, and
the problem appears regular as measured by the gradient.


(minus) the hessian matrix at the “mode” is not positive definite!
=> posterior variance of the estimated parameters are not positive.
You should try to change the initial values of the parameters using
the estimated_params_init block, or use another optimization routine.
Warning: The results below are most likely wrong!

In dynare_estimation_1 (line 694)
In dynare_estimation (line 89)
In test7 (line 325)
In dynare (line 180)


Fval obtained by the minimization routine: 100000000.000000

Most negative variance 0.000000 for parameter 1 (epsd = 0.008973)

Equation solved.

fsolve completed because the vector of function values is near zero
as measured by the default value of the function tolerance, and
the problem appears regular as measured by the gradient.

Warning: Matrix is singular to working precision.

In dynare_estimation_1 (line 709)
In dynare_estimation (line 89)
In test7 (line 325)
In dynare (line 180)

prior mean mode s.d. prior pstdev

chiw 0.500 0.4999 Inf beta 0.2000
chi 0.500 0.5008 Inf beta 0.2000
tetp 0.500 0.5001 Inf beta 0.2000
tetw 0.500 0.4998 Inf beta 0.2000
gamR 0.500 0.5026 Inf beta 0.2000
gam_PI 1.500 1.5014 Inf norm 0.3000
gam_y 0.250 0.2510 Inf norm 0.0500
rhod 0.800 0.8014 Inf beta 0.1500
rhof 0.800 0.8008 Inf beta 0.1500

standard deviation of shocks
prior mean mode s.d. prior pstdev

epsd 0.010 0.0090 Inf invg 2.0000
epsphi 0.010 0.0087 Inf invg 2.0000
epsm 0.010 0.0109 Inf invg 2.0000

standard deviation of measurement errors
prior mean mode s.d. prior pstdev

yd_obs 0.063 0.0668 Inf unif 0.0200
c_obs 0.073 0.0707 Inf unif 0.0200
PI_obs 0.002 0.0038 Inf unif 0.0010
l_obs 0.074 0.0751 Inf unif 0.0200

Log data density [Laplace approximation] is NaN.

Error using dynare_estimation_1 (line 771)
Estimation:: Mode value(s) of SE_epsd are outside parameter bounds.
Error in dynare_estimation (line 89)
Error in test7 (line 325)
Error in dynare (line 180)
evalin(‘base’,fname) ;

Something is really wrong here.

[quote]Fval obtained by the minimization routine: 100000000.000000

is an error code, not a proper mode. Also, which version of Dynare are you using and what is line 709 of

dynare_estimation_1where the singularity warning appears. If it’s

invhess = inv(hh);
in Dynare 4.4.3 then it’s no wonder given the problems in mode-finding before.

I’m using version 4.4.3 and line 709 does indeed say that. Is there anything I can do to fix it?

Fix your estimation, i.e. find a proper mode.

Thank you!

Is there a way to estimate something like exp(shock standard error)? For example, if my Taylor rule is:

is there a way to get Dynare to directly estimate exp(standard error epsm)?


I don’t fully understand what you mean. You will be estimating the variance of

At first order

so the estimated standard deviation of exp(epsm) will be the one of epsm.

I’m sorry, that was a rather obvious question on my part.

I was wondering if you could answer another question for me, this time related to predetermined variables. I’m still using the same baseline model as before (pared-down FVRR) but I’ve introduced the element of gender by differentiating between male and female labor - so aggregate labor is a CES function of male and female labor. I’ve gotten the steady state file to work, but now I get the following message:

"There are 4 eigenvalue(s) larger than 1 in modulus
for 6 forward-looking variable(s)

The rank condition ISN’T verified!"

Does this mean I should set male and female labor as predetermined, as I did with k? I’m a little confused about how the timing would work here.

Again, thank you so much - my thesis really would not have gotten off the ground without your help.

That depends on your labor market structure. In a search and matching model, you might have labor predetermined, but not in a frictionless labor market.