Problems with dsgesmoother

Dear Michel,

we are working with a simple RBC model, taking it to data, i.e. replicating the work in the fs2000ns.mod example. We get the following error:

[code]??? Error using ==> mtimes
Inner matrix dimensions must agree.

Error in ==> DsgeSmoother at 297
decomp(jnk,:,:,i) = QT*squeeze(decomp(jnk,:,:,i));

Error in ==> prior_posterior_statistics at 154
[alphahat,etahat,epsilonhat,alphatilde,SteadyState,trend_coeff,aK] = …

Error in ==> dynare_estimation at 949
prior_posterior_statistics(‘posterior’,data,gend);

Error in ==> hansen_stoch_exog_estim at 138
dynare_estimation(var_list_);

Error in ==> dynare at 102
evalin(‘base’,fname) ;[/code]

We investigate further the problem; we substitute the command decomp(jnk,:,:,i) = QT*squeeze(decomp(jnk,:,:,i)) with

decomp(jnk,:,:,i) = QT*squeeze(decomp(jnk,:,:,i))' in the dsgesmoother file code (line 297); Then computation finishes without errors and we get reasonable output.

Otherwise, to run fs2000ns.mod we have to work with the unmodified file.

As we don’t know the effects of correction, we would like to know if there’s something wrong in our model. For this purpose we attach the files.

hansen_stoch_exog_estim_steadystate.m (695 Bytes)hansen_stoch_exog_estim.mod (1015 Bytes)fsdat.m (4.52 KB)

Bests

Michele

Dear Michele,

I have been unable to reproduce the problem because I can’t run the model until the end.

  1. You can’t estimate a model with var_exo_det
  2. Even after making a a parameter equal to 0, I can’t obtain a mode good enough to start the Metropolis iterations

By the way, which version of Dynare are you using?

Kind regards,

Michel

Thanks for the reply, Michel.

We are using Dynare 4.0.2 on a linux machine (Matlab 7.2).

we have modified the files (attachment), as you said. If it is right, we go through the end of computation without errors on the metropolis algorithm (even if we run the command modified as described in our first post). We have simply calibrated the parameters a = 0.
hansen_stoch_exog_estim.mod (1.02 KB)
hansen_stoch_exog_estim_steadystate.m (710 Bytes)

We are using a var_exo_det as an attempt to introduce an exogeneous variable in the model. We would like to take this opportunity to ask you the right way to introduce it automatically (external file). We had used the shock_file option of the “shock” command, getting an error. Can you kindly suggest us a properly approach?

Many Thanks, again,

Michele

Hi,
I seem to be having a similar problem with the Kalman filter/smoothing algorithm (I think). Here is the error message the most recent version of Dynare 4 gives me:

??? Error using ==> mtimes
Inner matrix dimensions must agree.

Error in ==> DsgeSmoother at 322
decomp(jnk,:,:,i) = QT*squeeze(decomp(jnk,:,:,i));

Error in ==> dynare_estimation_1 at 995
[atT,innov,measurement_error,updated_variables,ys,trend_coeff,aK,T,R,P,PK,d,decomp] = DsgeSmoother(xparam1,gend,data,data_index,missing_value);

Error in ==> dynare_estimation at 57
dynare_estimation_1(var_list,varargin{:});

Error in ==> RBC_schat at 175
dynare_estimation(var_list_);

Error in ==> dynare at 102
evalin(‘base’,fname) ;

This error occurs after the MH algorithm has run and the posterior graphs have been displayed by Dynare, but before the smoothed data are plotted. THIS IS AN VERY SIMPLE DSGE MODEL BASED ON THE RBC model from the user manual!! I have only changed the path for the technological progress to be non-stationary.
RBC_schat_steadystate.m (1.89 KB)
simRBCgrow.m (15.7 KB)
RBC_schat.mod (1.53 KB)

Should anyone want to see the code for the simulation of the data, it is in the attached file RBC_simul_analyticSS.m. After running this mod file, the following commands must also be run in Matlab:

A=y;
A(1)=dA(1);
for i=2:1003;
A(i)=dA(i)*A(i-1);
end;
for i=1:1003;
Y_obs(i)=y(i)*A(i);
end;
oo_.endo_simul(10,:)=Y_obs;
datatomfile(‘simRBCgrow’,]);

I then throw away all other variables in simRBCgrow.m expect Y_obs to make the file smaller.

ps I was unable to attach more than 3 files. So I have added this extra message to upload these files as well.
RBC_simul_analyticSS_steadystate.m (1.9 KB)
RBC_simul_analyticSS.mod (1.1 KB)