22 February 2011

Complex numbers... What the heck?

by Jaromir Benes

This post is mostly for those of you who came across IRIS only recently. And it was inspired by an amusing (no offence meant:) exchange on the Dynare discussion forum. In IRIS, complex numbers are used in several contexts that have nothing to do with complex numbers themselves. It is simply the convenient fact that they can carry two pieces of information within a single number (the real part and the imaginary part) that we make use of.

1. Description of steady state (balanced-growth path)

Complex numbers are used to describe the steady state, or we'd better say balanced-growth path, of a model. Because in IRIS, models can have any number of deterministic and stochastic trends, we need, in general, to capture one point on the BGP, and describe both the level and the growth (rate) of each variable at that point. Of course there are infinitely many such points; to be able to compute the (still valid) first-order expansion we just need to pick and describe an arbitrary one. How do we do that? That's a separate topic in itself, and I promise to write both a short post on this blog as well as a more technical knowledge base article on the subject.

We use a complex number to describe the steady state, or BGP, of each variable. The real part is simply the level at a particular moment while the imaginary part is the growth (rate). There is, though, one more little intricacy in the way the BGP is expressed depending on whether a variable is linearised or log-linearised (yes, you can choose yourself whether each individual variable is linearised or log-linearised):

  • the growth rate of linearised variables is the difference between two consecutive periods, xt – xt-1 on the BGP;
  • the growth rate of log-linearised variables is the ratio of two consecutive periods (the gross rate of growth), xt / xt-1 on the BGP.

2. Anticipated and unanticipated shocks

Second, complex numbers are used to set up simulations in which you wish to combine both anticipated and unanticipated shocks.

If you simulate only one kind of them (i.e. only anticipated shocks or only unanticipated shocks) you use the 'anticipate' option in the simulate or jforecast functions. By default, it is true meaning that all shocks found in the input database are anticipated. If you switch to false, all shocks will be treated as unanticipated. As simple as that.

Now, if you want to combine both anticipated and unanticipated shocks in one simulation or one forecast you do it the following way:

  • You set 'anticipate' to either true or false; this will be called the basic mode;
  • All shocks entered in the input database as real numbers will be simulated in the basic mode;
  • All shocks entered in the input database as imaginary numbers will be simulated in the other mode (i.e. unanticipated if 'anticipated' is true, and vice versa);
  • You can, of course, create a complex number with both a real and an imaginary part; you can then think of it as two shocks, one anticipated and the other unanticipated.

3. Std deviations of anticipated and unanticipated shocks

Third, and this is really for the masters of the art of economic modelling and forecasting, complex numbers are used to enter (possibly) time-varying std deviations of shocks in conditional forecasts produced by the jforecast function.

If you wish the std deviations of shocks to vary over time in your conditional forecast, or simply to deviate from the values currently assigned in the model object, you use the fourth input argument (a so-called tune database) to pass in a database with std deviation time series. Because it matters a lot whether a shock is anticipated or unanticipated in conditional forecasts, IRIS gives you the freedom to describe any combination of time-varying std deviations of anticipated and unanticipated shocks (in fact, each single shock at each single time can have its anticipated part and its unanticipated part).

And yes, complex numbers are used yet another time to that end. It works the same way as anticipated and unanticipated shocks above. You set the 'anticipate' option to the basic mode in the jforecast function. Then all std deviations entered as real numbers are treated as describing the shocks in the basic mode while the imaginary std deviations are treated as describing the shocks in the other mode.

3 comments:

  1. about 3rd point...
    please, correct me. some unreal situation to test my understanding:

    say, i make a forecast with judgments on levels of exchange rate for the first two periods of forecast. all shocks are un-anticipated (basic mode). then i put zero values for the real part of std deviation of an inflation equation residual for some future period. and make imaginary part of that std deviation non-zero (abd very high) for the same period. will it explain the situation i model in a way that some expected future inflation shock (together with unexpected shocks arised in first two periods) cause my exchange rate take values i put judgmentally?

    ReplyDelete
  2. Yes. Keep in mind, though, that when you're using the conditional forecast technique (as opposed to the endogenise/exogenise technique implemented through a simulation plan), all shocks with non-zero std deviations are used to reproduce the desired tunes.

    Obviously, if the number of shocks with non-zero std devs is larger than the number of tunes, there are infinitely many combinations of shocks that exactly reproduce your desired tuns. In that case, the likelihood maximising combination is chosen (a sort of minimum-square-error criterion).

    ReplyDelete