Matirx forms in Dynare

Hello.I want to make Besyian estimation on some very non-linear system. Is it possible to express in Dynare product of parameters and variables in matrix/vector form. For example I want to estimate parameters a1,a2 but I want to write in Dynare [a1 a2][x y]’ and not a1x+a2y where x y are variables. This is a very easy case but It could be that we can not express one equation in simple form because it could include very complicated non-linear expressions which one can not write down analytically equation by equation. So we can write only in matrix products. For example Ainv(B)Cz where z is a vector of variables but A,B.C are matrices of parameters. Here it is impossible to write in analytical form as equation by equation.
Thank you very much in advance.

Hi, It’s possible to deal with matrices but not in the mod file.

In your example, if A is a row matrix, Ainv(B)Cz is again a linear combination of endogenous variables (if A is not a row vector then Ainv(B)Cz is a collection of linear combinations). I Assume these matrices are non linear functions of parameters you want to estimate, so we have A(theta), B(theta) and C(theta) where theta is a vector of (deep) parameters. If A is a row vector then v = Ainv(B)C is also a row vector with, say, n elements v1, v2, …, vn. Declare v1, …, vn has parameters in the mod file (as the elements of theta). Given theta you can build the matrices and compute v = Ainv(B)C in the steady state file. You just have to put these values in the vector M_.params (the place where Dynare stores the values of the parameters). Finally in the model block of the mod file you have an equation with something like v1z1+v2z2+…+vn*zn.

Hope it helps.
Best, Stéphane.