Since you don't sem to have any explicit forward-looking / rational expectations elements in your system (the equation for Pie
depends only on lags), I don't know why you are expressing your time subscripts as $T+2$ rather than $t$, $t-1$, $t-2$.
Your system is essentially linear, so I would suggest that you define your system as a vector state variable with a matrix of coefficients, which you can then update to simulate a time series using NestList
. If you also had stochastic elements, which the above equations don't seem to do, then you would use FoldList
. Because you have two lags of variables on the right-hand side of the equations, the first lag is also a state variable, which you need to track as part of the state vector.
Once you do that, you will realise that you have not specified equations for some of your variables, including $R$ (I'm guessing interest rates) and $YNlev$ (I'm guessing nominal GDP). You need to do this to have a complete system. In the latter case, it is presumably just the identity that $YNlev = Ylev * Pi$.
Now, to comment on your usage of Mathematica. You can definitely do this in Mathematica, but before you start, as with any new programming language, you really need to familiarise yourself with some very basic aspects of the syntax. The most relevant ones given your proposed input are:
- It's always better to use lower-case letters for single-letter variable names, to avoid conflicts with built-in Mathematica symbols. In the case of your input,
C
and I
will conflict with the default symbol for constants and the square root of -1, and of course Pi
conflicts with $\pi$.
- Understand the difference between
Set
(=
), SetDelayed
(:=
) and Equal
(==
). For your application, you need Equal
, not Set
as you’ve used.
- In Mathematica, parentheses are only for grouping, eg
Expand[2(a+b)]
gives 2 a + 2 b
. Parameters of any kind of function or expression are contained in square brackets [ ]
. You will probably find the tutorial on the four kinds of bracketing in Mathematica useful.
The other functions that might be useful to you are RSolve
and RecurrenceTable
. Rather than solve out your system for you, here is a simple example of the kind of output you might expect.
simple = RecurrenceTable[{y[t + 2] == 0.8 y[t + 1] + 0.15 y[t] - 0.2 r[t + 1],
r[t + 2] == r[t + 1] + 0.1 y[t + 1], y[0] == 2, y[1] == 2, r[0] == 1},
{y, r}, {t, 1, 250}];
ListLinePlot[simple]
Nest
andFold
which will (probably) help you solve your equations for (presumably) a series of time steps into the future (?). Sorry if that seems blunt but I don't think this is a forum to learn how to type equations into Mathematica. $\endgroup$