Auxiliary function and arrays

I am working with a DSGE model. Is it possible to build an external function say myf which takes as input an array of endogenous variables? Say I have an endogenous varible X. I would like this function to be located within the model block and to take as inputs X,X(-1),…,X(-T). Or in other words, I would like the function to be: myf([X,X(-1),…,X(-T)]). Is it possible to do so? Of course I would also need info on how I can build such an array in Dynare to begin with. Or do I need to have the function take the arguments one by one? This would not be compatible with my objective, given that the T I consider is large.

For what exactly do you need this? The values of an endogenous variable cannot be exogenously given.

I want to have an investment fund within my model. Its role is simply to take inflows and compound them for an extended period of time. I also want to assume that withdrawals from said fund follow a given rule which is going to be a function of interest rates (and inflows). The array X would contain expected future, present and lagged interest rates. In this sense Y = myfun(X), would be another endogenous variable (but not a control variable of the agents) and it would characterize the withdrawals. I could summarize such dynamics directly within the mod file using boolean operators available via the macro processor, but was looking for a more elegant solution (also boolean operations are more easily constructed in an m file in general).

I still don’t get it. If you have

Y = myfun(X)

then Y is an endogenous variable in the model and agents need to be able to forecast its distribution. You cannot simply fix these values. That would be inconsistent with rational expectations

1 Like

Understood. You are right. So I would need to build this object within the mod file using the macro processor. In this case the values would not be “fixed” and hence I would be consistent with RE. Thank you.