Integration of matrices and vectors in model environment?

For technical support, tips and tricks, suggestions, or any other information regarding the EViews model object.

Moderators: EViews Gareth, EViews Moderator

jali
Posts: 2
Joined: Wed May 19, 2010 1:02 pm

Integration of matrices and vectors in model environment?

Postby jali » Thu May 20, 2010 2:09 am

Hello!

Is it possible to integrate matrix and vector objects (changing over time) into the model environment and do matrix calculations inside it?

For example, I have a single-equations macroeconomic model. For estimating real exports it would be useful to use the real exchange rate of the trading partners weighted with the export share of the corresponding trading partners. These shares can be defined as a vector changing over time, the same applies for the country-by-country exchange rates. In excel I would use the function "sumproduct" in these cases...

Another example: with input-output-tables (e.g. 50*60 matrices) one can link the demand side of the economy with the supply side. These tables show how production in the economic sectors is affected by a change in private consumption for example. To calculate these effects, inverse coefficients of the matrix has to be derived. And the matrix itself can or should change over time also.

The handbook is not saying anything about this question, and my own tries has been unsuccessful so far. I guess that the model environment is limited to simple mathematical and basic logical operations, and my aim goes beyond the abilities of Eviews?!

Regards, Jan

EViews Chris
EViews Developer
Posts: 161
Joined: Wed Sep 17, 2008 10:39 am

Re: Integration of matrices and vectors in model environment?

Postby EViews Chris » Thu May 20, 2010 12:23 pm

For the most part, you're not going to be able to do matrix calculations during a model solve. You can use elements of matrices that have already been calculated before the model solve as coefficients in an equation.

It would also be possible to write an EViews program where you allowed only a single iteration during each call to the model solve procedure. You could then cary out matrix calculations 'between' iterations. This would effectively be a sort of Gauss-Seidel algorithm for updating the matrices as you solved the model.

As far as the IO model goes, you could presumably use EViews to solve the model by translating the IO matrix into a set of equations. i.e something like this:

y1 = A(1,1)*y1 + A(1,2)*y2 + B(1,1)*x1 + B(1,2)*x2
y2 = A(2,1)*y2 + A(2,2)*y2 + B(2,1)*x1 + B(2,2)*x2

where the y's are the output levels and the x's are the non-manufactured inputs (this isn't my area, so I'm not sure of the correct terminology here) and A and B are coefficient matrices.

You probably wouldn't want to have to write out equation text like this by hand, but it wouldn't be hard to program something that generated the required text.

If you wanted the coefficients to change over time, you could write an EViews program that called the model solve procedure inside a loop, solving only a single period each time and updating the matrix at each time period to new values.

jali
Posts: 2
Joined: Wed May 19, 2010 1:02 pm

Re: Integration of matrices and vectors in model environment?

Postby jali » Sun May 30, 2010 4:08 am

Thank you for your answer Chris; it seems to be possible with some (or a lot) detours, but not quite comfortable.
Wouldn't that be a feature worth thinking of to implement in Eviews? As far as I understand this would be possible in principle, TROLL for example seems to be capable of dealing with time-indexed arrays inside simulations...

peter193945
Posts: 2
Joined: Wed Oct 02, 2013 4:51 pm

Re: Integration of matrices and vectors in model environment

Postby peter193945 » Wed Oct 02, 2013 5:01 pm

Dear Chris and Jan
Has version 8 improved things? It has new matrix capabilities, so is the situation that Chris described still correct? I am interested in using input-output matrices in an integrated econometric/IO model. Thanks

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 11851
Joined: Tue Sep 16, 2008 5:38 pm

Re: Integration of matrices and vectors in model environment

Postby EViews Gareth » Wed Oct 02, 2013 5:02 pm

Nothing has changed in that respect.
Follow us on Twitter @IHSEViews

EViews Glenn
EViews Developer
Posts: 2597
Joined: Wed Oct 15, 2008 9:17 am

Re: Integration of matrices and vectors in model environment

Postby EViews Glenn » Thu Oct 03, 2013 1:04 pm

Can you provide additional detail on exactly what you want solved?

peter193945
Posts: 2
Joined: Wed Oct 02, 2013 4:51 pm

Re: Integration of matrices and vectors in model environment

Postby peter193945 » Thu Oct 03, 2013 7:14 pm

Dear Glenn

The attached code shows a toy model. The B matrix is a standard Leontief (I-A)^(-1) matrix. I have used the clue in the thread and created 16 Bi,j variables for the sample period. This works, but is indeed inconvenient when the number of industries gets above toy numbers (e.g. 100). A time dimension to vectors and matrices would seem to be the desired enhancement, as Jan suggested. Further, one would want to set up equations which create adjustments to the IO coefficient matrices as well, as part of the model solution. Again, time-dimensioned vectors and matrices would seem to be desirable to make for a more elegant and useful coding system. Multiple dimensioned, with time as a standard dimension, would be useful, e.g. consumers expenditure might be usefully dimensioned by time, industry and consumption category.

program TOY

smpl 1990 2012

equation eq_fd_agr.ls log(FD_AGR) c log(GRO_AGR(-1)) log(GDP)
equation eq_fd_min.ls log(FD_MIN) c log(GRO_MIN(-1)) log(GDP(-1))
equation eq_fd_man.ls log(FD_MAN) c log(GRO_MAN(-1)) log(GDP)
equation eq_fd_ser.ls log(FD_SER) c log(GRO_SER(-1)) log(GDP)

model TOY

smpl 1990 2012

TOY.merge eq_fd_agr
TOY.merge eq_fd_min
TOY.merge eq_fd_man
TOY.merge eq_fd_ser

TOY.append @identity GRO_AGR = B11 * FD_AGR + B12 * FD_MIN + B13 * FD_MAN + B14 * FD_SER
TOY.append @identity GRO_MIN = B21 * FD_AGR + B22 * FD_MIN + B23 * FD_MAN + B24 * FD_SER
TOY.append @identity GRO_MAN = B31 * FD_AGR + B32 * FD_MIN + B33 * FD_MAN + B34 * FD_SER
TOY.append @identity GRO_SER = B41 * FD_AGR + B42 * FD_MIN + B43 * FD_MAN + B44 * FD_SER

TOY.solve

Thanks (PS how does one put the code into a little window?)

Peter


Return to “Models”

Who is online

Users browsing this forum: No registered users and 2 guests