difference equations in MATLAB - why the need to switch signs?

Posted by jefflovejapan on Stack Overflow See other posts from Stack Overflow or by jefflovejapan
Published on 2010-05-20T05:44:00Z Indexed on 2010/05/20 5:50 UTC
Read the original article Hit count: 337

Filed under:
|
|

Perhaps this is more of a math question than a MATLAB one, not really sure. I'm using MATLAB to compute an economic model - the New Hybrid ISLM model - and there's a confusing step where the author switches the sign of the solution.

First, the author declares symbolic variables and sets up a system of difference equations. Note that the suffixes "a" and "2t" both mean "time t+1", "2a" means "time t+2" and "t" means "time t":

%% --------------------------[2] MODEL proc-----------------------------%%    

% Define endogenous vars ('a' denotes t+1 values)
syms y2a pi2a ya pia va y2t pi2t yt pit vt ;
% Monetary policy rule
ia = q1*ya+q2*pia;
% ia = q1*(ya-yt)+q2*pia; %%option speed limit policy
% Model equations
IS = rho*y2a+(1-rho)yt-sigma(ia-pi2a)-ya;
AS = beta*pi2a+(1-beta)*pit+alpha*ya-pia+va;
dum1 = ya-y2t;
dum2 = pia-pi2t;
MPs = phi*vt-va;

   optcon  = [IS ; AS ; dum1 ; dum2; MPs];      

He then computes the matrix A:

%% ------------------  [3] Linearization proc  ------------------------%%       

% Differentiation
xx = [y2a pi2a ya pia va y2t pi2t yt pit vt] ; % define vars
jopt = jacobian(optcon,xx);

% Define Linear Coefficients
coef = eval(jopt);

B =  [ -coef(:,1:5)  ] ;  
C =  [  coef(:,6:10)  ] ;  

% B[c(t+1) l(t+1) k(t+1) z(t+1)] = C[c(t) l(t) k(t) z(t)]
A = inv(C)*B ; %(Linearized reduced form )

As far as I understand, this A is the solution to the system. It's the matrix that turns time t+1 and t+2 variables into t and t+1 variables (it's a forward-looking model). My question is essentially why is it necessary to reverse the signs of all the partial derivatives in B in order to get this solution? I'm talking about this step:

B =  [ -coef(:,1:5)  ] ;

Reversing the sign here obviously reverses the sign of every component of A, but I don't have a clear understanding of why it's necessary. My apologies if the question is unclear or if this isn't the best place to ask.

© Stack Overflow or respective owner

Related posts about matlab

Related posts about difference