Problem with analytic_derivation


I have problem with analytic_derivation calculation. I use dynare 4.3.1, matlab

I have following error message:

[quote]??? Error using ==> mtimes
Input arguments must be 2-D.

Error in ==> sylvester3 at 16

Error in ==> getH at 428

Error in ==> dsge_likelihood at 495
[dum, DT, DOm, DYss] = getH(A, B, Model,DynareResults,DynareOptions,kron_flag,indparam,indexo,iv);

Error in ==> sfd at 50
[dummy,v(:)] = feval(funfcn{3},x,varargin{:});

Error in ==> sfminbx at 193
H = sfd(x,g,Hstr,group,],DiffMinChange,DiffMaxChange,funfcn,varargin{:});

Error in ==> fminunc at 288
[x,FVAL,LAMBDA,EXITFLAG,OUTPUT,GRAD,HESSIAN] = sfminbx(funfcn,x,l,u, …

Error in ==> dynare_estimation_1 at 212
[xparam1,fval,exitflag] = fminunc(objective_function,xparam1,optim_options,dataset_,options_,M_,estim_params_,bayestopt_,oo_);

Error in ==> dynare_estimation at 70

Error in ==> model_D7 at 1807

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

Matrix “d” has 3 dimension (within sylvester3 or getH). My version of matlab don’t understand what is product of 2D matrix with 3D matrix. I don’t understand what should be result of such product too. Could you help me to understand what result should be?

Only works for stationary models without missing observations.

As I understand, it’s not a problem of missing observation. Code of getH function creates 3D matrix. Code of sylvester3 tries to make product of this matrix and always think that d is 2D matrix.

elem = zeros(m,m,param_nbr); d = elem; for j=1:param_nbr, elem(:,:,j) = (Dg0(:,:,j)-Dg1(:,:,j)*A); d(:,:,j) = Dg2(:,:,j)-elem(:,:,j)*A; end xx=sylvester3(a,b,c,d);

Is correct idea of following understanding?

    for j=1:param_nbr,
        elem(:,:,j) = (Dg0(:,:,j)-Dg1(:,:,j)*A);
        d(:,:,j) = Dg2(:,:,j)-elem(:,:,j)*A;

Could you post the mod-file

I’m sorry for delay. This model isn’t finished.
data_USA2_75_12Q2.rar (30.4 KB)
model_D7_steadystate.m (40.9 KB)
model_D7.mod (120 KB)