Am 28.01.2023 um 19:23 schrieb Federico Giri:
I have never tried to simulate a stock flow consistent model using hansl.

On Gennaro zezza's website you can find a lot of example of R script on how tò build a SFC model. 

With a Little bit of patience you can try tò translate It in gretl

Hi, let me expand a little both on the question and on the answer. Federico, I wasn't able to locate any code on Zezza's homepage. Do you mean this page? : https://www.unicas.it/didattica/docenti/schedadocente.aspx?UID=fa11c412-9cd1-4909-99fc-afc4af815666&Cognome=ZEZZA

About what gretl/hansl can do in relation to SFC: I haven't dealt with SFC models myself, I only know a bunch of colleagues who have. So take my following remarks with some caution.

In terms of econometrics, what you can do in gretl is to set up a general multiple-equation system in a 'system' block. Some documentation of this is available in chapter 34 of the user guide ("Multivariate models"). As explained in that chapter, this also allows to specify identities, which in my understanding is important to impose the restriction of being stock-flow consistent. (BTW, mainstream DSGE models are also stock-flow consistent, so I always found the name SFC a bit misleading, but let's not digress.) Of course you can also have contemporaneous relationships between endogenous variables in such a system, with the classical econometric complication that then you need appropriate instruments and you need to fulfill conditions for identification.

There is no point-and-click interface for specifying a general system, so you would need to  do a minimal amount of scripting. (There is a window that comes up if you select Model -> Multiple equation system in the GUI, and you have a little bit of mouse-connected helpers there, but in the end it's a 'system' block that you're writing there.) After estimation, you can also impose general coefficient restrictions (also cross-equation), with a 'restrict' block.

After you're done estimating the (possibly restricted) system, you can also forecast with that. Section 35.6 of the user guide has some documentation about it, and it's only half a page, so I definitely recommend reading it.

So, are "simulations" possible? This depends what you mean by that. In most cases, a simulation is just a conditional forecast, where the term "conditional" means for given future scenario values of the exogenous variables. This is certainly supported by gretl - of course you would have to provide the relevant values for the future exo series. If you run into problems there, feel free to ask for help here on the list.

If, on the other hand, by "simulation" you mean that you want to produce a path for the endogenous variables that matches or approaches a certain pre-specified target, this is not something that gretl currently offers. It is certainly doable to write a hansl program that would do it (using the excellent numerical optimizers that gretl has), but it wouldn't be trivial.

Finally, a remark about GMM estimation: AFAIK, a system-wide GMM estimation is not something that gretl currently offers.  The single-equation 'tsls' command does offer a --gmm option, but it's not clear to me if or how that would be directly usable in the context of a 'system' block. Note that I'm not saying you need to do GMM - the offered true system estimators 3SLS and FIML are perfectly fine and, some would say, perhaps even better in practice.

OK, that was a rather long message, but I hope that clarified some things.

cheers

sven