*(Note: this post uses the MathJax package to display properly formatted equations; they may or may not display properly on your browser. Please let me know if you have severe problems, as I might be using MathJax in the future.*)

The text

*Monetary Economics*by Wynne Godley and Marc Lavoie has become the standard work for learning about these models. One of the advantages of the book is that researchers have built code (and spreadsheets) to solve the various models included in it. This means that it is possible to interact with the solutions, regardless of your software preferences.

From my limited knowledge of the literature, it seems that the preferred platform amongst SFC academics is Eviews. For someone with a casual interest in the subject, this software has the drawback of being commercial software. However, there is now code available to solve the models for the open source language R -- which is what I use to generate the plots on my website.

*(I have developed my own variation of SFC models with Python; previous models I have built were with that system. Python is also open source. You could not use my Python system to solve the models in Godley and Lavoie; I decided to take the algorithms in a somewhat eccentric direction. I can easily model fairly complex systems, at the cost of losing the mathematical elegance that academics require. My system is not really ready for "prime time," so I have not released the code yet.)*

## Software Repository

The web site*sfc-models.net --*aimed at SFC modelling researchers -- has a code repository: http://models.sfc-models.net/

For the models in

*Monetary Economics*, there is solution code in:

- Eviews (commercial);
- Matlab (commercial, but widely available at Universities);
- R (open source);
- Excel spreadsheets (commercial, but presumably can be viewed in Open Office).

Although I am only discussing the simplest model -- model SIM, which I referred to in a previous article -- the models in

*Monetary Economics*get increasingly complex. One might be able to modify an existing model to study a system of interest.
It should be noted that without access to the text, the models may be difficult to follow. (What are these variables? Where did the equations come from?) I am assuming here that the reader has access to a description of the model. (In my previous article, although I skipped the equations, I explained how the various economic variables related to eachother.)

## Excel Spreadsheet

As I discussed in

*Finding the Solution in a Simple SFC Model,*there is an Excel spreadsheet which solves the system time point-by-time point. (Note that by setting the tax rate to zero, I blew up the steady state solution.) The spreadsheet contains graphs of the output.

A spreadsheet like this is probably the best introduction a non-programmer could hope for. It is possible to see all the variables -- and how they evolve over time -- in one shot. However, with all the equations hidden in cell formulae, it is not obvious how the solution is arrived at from a technical standpoint. (More on this below.)

## Eviews Code

The link for the code for model SIM (in Chapter 3): gennaro.zezza.it/software/eviews/glch03.phpEven if you do not have Eviews, the code is straightforward to read, which is actually unfortunate, as discussed below. I will now excerpt some fragments of the program.

Eviews code: Initialisation (partial) |

The code first defines variables (above). As the code indicates, the variables are all time series, defined at an annual frequency from 1945 to 2010.

Chart: Eviews code - creation of model, with equations specified (partial). |

The critical step -- solving the model is done as shown below.

In other words, the program invokes the "solve" method on the "model" object, which is defined by proprietary Eviews code. (One hopes that there is some technical documentation for that method somewhere.)

There are two ways of looking at this.

- If you are an Eviews user, this is very convenient. You can directly read off the equations from Godley and Lavoie (or from your pen-and-pencil analysis of another model), and directly simulate those equations in Eviews.
- If you do not have Eviews, the code tells you precisely nothing about how to find a solution to the system. You have exactly the same information as is given in the equations in the book.

Since I did not have access to Eviews, I was not particularly happy with that situation. Rather than trying to emulate the Eviews solution technique, I took the modelling framework in a different direction, using Python. (That will be the topic of later articles.) However, my response is not useful for those of you who want to work through Godley and Lavoie, and/or read the academic literature (which has tended to follow the same formalism).

## R and Matlab Models

Graphical Output from R code (model SIM). |

The

*sfc-models.net*code page contains source code for the solution of models using R and Matlab.
The solution technique is more transparent -- the solution to the system of equations is determined iteratively. That is, we start off with an initial guess at the solution, and then the estimate is improved over a series of iterations. If the system of equations is well behaved, the algorithm will converge to the solution.

(I no longer have access to Matlab, so I have not tested the code. The R code is developed using object-oriented code. Although I prefer object-oriented programming, I have not really used those techniques in R, so I have not extensively played with the code.)

Even if you prefer other programming languages, it would be easier to develop an algorithm that emulates the low-level code used in the R and Matlab versions.

## Existence And Uniqueness

One of the most basic questions we can ask about a mathematical system -- does a solution exist, and is it unique? If we cannot answer those questions, we have to have concerns whether the mathematical model can be related to real world behaviour.

The existence of a solution is obviously important. If there is no solution, the model tells us nothing. Although it is entertaining to write down equations like:

\[ x = x + 1, \]

it is just a long-winded way of writing out the empty set ($\emptyset$). There is an infinite number of models that have no solution, so we cannot use the information that there is no solution in a useful way.

Non-uniqueness of the solution is more awkward. As long as we do not subscribe to some wacky quantum metaphysics, we normally assume that there is one "real world." As a result, it is hard to relate a mathematical model with two or more solutions to real-world behaviour. What is the model predicting? (Within economics, there appears to be a lot of metaphyiscal musings about "multiple equilibria" related to this concept; such reasoning makes little sense when translated into mathematics.)

For a linear system (such as model SIM), non-uniqueness and non-existence of solutions result in the same end point for iterative solution methods -- the algorithm does not converge.

- If there is no solution, the algorithm has nothing to converge to (absent some very bad luck).
- If the solution is non-unique, a linear model has a set of solutions that are a linear subspace of the space of all possible values for the variables. In other words, an infinite number of solutions. This lack of uniqueness means that the algorithm cannot converge to a single point; each iteration will be drawn towards a different point in the set of all possible solutions. (Once again, assuming that we are not unlucky.)

As a result, we can be fairly indifferent to worrying about the existence and uniqueness properties when dealing with linear systems. If we can find a solution, we know that one exists, and we can be fairly sure that the solution is in fact unique.

Unfortunately, this is no longer true for nonlinear systems. The set of solutions can take almost any conceivable form, including the possibility of a few isolated solutions. Iterative techniques will converge to one of these local solutions, without offering any indication that other solutions exist.

In the context of economics, it might be possible that there are two solutions to a model -- one with high unemployment, another with low unemployment. Researchers doing iterative solution techniques could end up with simulations with quite divergent outputs, solely based on very hard-to-replicate differences in the search technique.

This reasoning is why I have reservations about purely iterative solution techniques. They might be necessary, but we need to be cautious.

## Tom Brown's Models

Tom Brown, who has commented upon some of my SFC articles, has done a number of simulations of model SIM and other SFC models. For example, his version of a model by Nick Edmonds. Some of his work revolves around converting the models to continuous time, a technique that I have reservations towards. (A continuous time framework is favoured by Jason Smith, in his "Information Transfer Economics" theory.)

I have had difficulty with the loading time with some of his pages on my underpowered "writing laptop," so I have not had a chance to look into his work too closely.

## Canonical Linear Dynamic Models

For a linear model like SIM, what we would like to do is to convert it into the canonical linear time-invariant form (which is described in any standard multi-variable systems textbook):

\[ x(t+1) = A x(t) + B \hat{u}(t), x(0) = x_0. \]

In this case, $x$ is a vector of variables, residing in $R^n$. For those of you who are unfamiliar with matrix notation (or purged the concept from memory), that means we are stacking up $n$ time series variables into a single object. Using economic lingo, $x(t)$ are the

*endogenous*variables, and the vector $\hat{u}(t)$ is the vector of*exogenous*variables ("inputs").
However, the equations within Godley and Lavoie are not in that format; what we see is a bunch of algebraic equations; in the case of model SIM, 11 of them. (Which is impressive, since there is technically only one true state variable.) Even the exogenous variable -- government spending -- is specified as an algebraic equation.

After some manipulation, it is possible to convert the equations for model SIM into the format:

\[ x(t+1) = A_1 x(t+1) + A_2 x(t) + B_1 u(t+1). \]

(Since there is a little of algebra involved, I would only attempt that conversion within a PDF document.)

We can then convert this to:

\[ (I - A_1) x(t+1) = A_2 x(t) + B_1 u(t+1). \]

Finally (assuming $(I-A_1)^{-1}$ exists),

\[ x(t+1) = (I - A_1)^{-1} A_2 x(t) + (I - A_1)^{-1} B_1 u(t+1). \]

If we correct for the time shift in $u(t)$ (we can define $\hat{u}(t) = u(t+1)$), we can relate to the canonical format via:

\[ A = (I-A_1)^{-1} A_2, \]

\[ B = (I - A_1)^{-1} B_1. \]

We can then apply standard dynamic system theory to discuss the properties of the solution.

From a technical point of view, the existence of the matrix inverse $(I - A_1)^{-1}$ is what determines the existence and uniqueness of a solution to the system. Godley and Lavoie emphasise the importance of the number of equations needed to close the system ($n$ equations for $n$ variables). The existence of the matrix inverse indicates whether you have properly chosen the equations to close the system. (For example, if you choose $x_1 = x_2$ and $x_2 = x_1$ as two equations in two unknowns, you do not have enough information to find a unique solution.)

However, it should be noted that most interesting SFC models will involve nonlinearities. (In the case of model SIM, the model would be nonlinear if wages were no longer fixed.) In which case, we might be stuck with iterative methods of solution. (In my Python models, I use a variety of end runs to avoid the use of iterative solution methods.)

**See Also:**

(c) Brian Romanchuk 2015

Hi Brian. Thanks for the reference.

ReplyDeleteThis was my "latest word" on SIM (SIM7): I do both the continuous and discrete time and derive what to set the parameters to give desired steady states and a time constant. There's a link at the bottom to a spreadsheet post updated to incorporate that solution (SIM6). You can download the spreadsheet in SIM6 using the icon in the lower right along the black bar across the bottom of the embedded sheet. Also it works OK on my phone.

DeleteI see MathJax is working for you! Great. For SIM with the sample period (i.e. time step) $T_s = 1$ "period" (as G&L specify), then for convenience if we define the constant:

Delete$$X \equiv 1-\alpha_1 (1-\theta) \tag 1$$

then the discrete time state space system equations are:

$$

\begin{align}

H_{n+1} & = A\, H_n + B\, G_{n+1} \quad \text{(state update equation)} \tag 2\\

Z_{n+1} & = C_Z\, H_n + D_Z\, G_{n+1} \quad \text{(measurement equation)} \tag 3\\

\\

\text{where} \\

\\

A & = \alpha_2 \theta / X \tag 4\\

B & = \theta / X \tag 5\\

Z_{n} & = \begin{bmatrix} Y_n & T_n & Y_{Dn} & C_n \end{bmatrix}^T \quad \text{(measurement vector)} \tag 6\\

C_Z & = \begin{bmatrix} \frac{\alpha_2}{X} & \frac{\alpha_2 \theta}{X} & \frac{\alpha_2 (1-\theta)}{X} & \frac{\alpha_2}{X} \end{bmatrix}^T \tag 7\\

D_Z & = \begin{bmatrix} \frac{1}{X} & \frac{\theta}{X} & \frac{(1-\theta)}{X} & \frac{1 - X}{X}\end{bmatrix}^T \tag 8

\end{align}

$$

Where, of course, $H$ plays the role of your $x$ "state" (just one in this case, rather than a column vector) and $G$ is the exogenous input (your $u$).

DeleteAlso I know you have reservations about continuous time equivalents, however Marc Lavoie seems to think they're OK (at least in a passing comment), somewhere in this lecture (I think towards the middle). Not to say I don't see your point, however.

DeleteThere's nothing wrong with using continuous time, but you just have to remember that these are only models. Real economies involve a collection of discrete transactions all carried out on different terms. In a discrete model, we lump a whole load of transactions together in a given period and just use averages and aggregates. In a continuous model, we approximate the transactions to some kind of function. Both are simplifications - it's just a model.

DeleteI don't think Jason gets this. He seems to want to know what the continuous function is that underlies the functions in a typical discrete SFC model - but there isn't one.

Tom - yes, there's only one true state variable (high powered money), but it's slightly trickier to transition from the original equations to the shortened version correctly (without doing algebra by hand, which is not easily extended to more complex systems). If you use the x,y decomposition, you need to stack them into a single vector, then do the matrix algebra to find the canonical form. I stayed with the simpler version of the matrix algebra, where I kept the two vectors together. If I go further, I would create a PDF version (eventually, but I need to finish off another report).

DeleteMy aversion to continuous time is probably a reaction to Jason Smith's comments. If you accept that a continuous time model is actually an approximation of a system where events occur essentially at irregularly spaced discrete times, then there's no problem (so long as you avoid time delays, etc.). But if you want to philosophize about the underlying instantaneous behaviour, you are in for a world of hurt. From a mathematical perspective, even assuming that a solution exists is not obvious, if you start throwing in things like expectations.

This comment has been removed by the author.

DeleteRoger, you need another ")" or one less "(":

Delete(Period National Income) * (Îž + (1-Îž)(1-Î±1) = Government

This comment has been removed by the author.

DeleteThanks Tom. I had the same omission in the last equation. The first should be

Delete(Period National Income) * (Îž + (1-Îž)(1-Î±1)) = Government

The last equation should be

(Period National Income)*(Îž + (1-Îž)(1-Î±1)) =

Government + (Last Period Wealth) * Î±2)

Thanks for looking and commenting.

This comment has been removed by the author.

Delete[To keep things trim, I will delete the original comment and re-post with the correct equations. And there was a second bracket error in the last equation, now corrected]

Delete[Tom, I think the following equations accomplish the same things you are doing, but in a different way.]

Knowing the SIM model, would these equations make any sense to you?

(Period National Income) * (Îž + (1-Îž)(1-Î±1)) = Government

Where National Income, Îž and Î±1 are the same terms as in SIM. In SIM, government is "20". National Income becomes "Period National Income" in this equation.

Knowing Period National Income, we can calculate the tax collected by government

Tax = (Period National Income) * Îž

Knowing the Tax, we can calculate the total period wealth in the private sector

Period Wealth = (Last Period Wealth) + Government - Tax

Finally, for all following periods,

(Period National Income)*(Îž + (1-Îž)(1-Î±1)) =

Government + (Last Period Wealth) * Î±2

where, to conform to SIM, last-period-wealth-spent-in-current-period is reduced by term Î±2.

The terms Î±1 and Î±2 both control the sequential rate of convergence to the steady state (when term "Government" is stable for each period). If both Î±1 and Î±2 are set to one (1), the jump to steady state will be instant.

Roger, I give a link above for SIM7. In there I give SIM steady state gains (K values). What you write looks familiar. See if they match. I know your expression for T does. But my SS gains are only expressions of theta for what I call the measurements above. H is different.

DeleteI see, you're not just doing SS. I won't have time to dig in for a while unfortunately, but I'll eventually get to it.

DeleteTom, I downloaded SIM7 and took a look. I can not find the formulas nor the K values. I only see three sheets (results,parameters, and notes). In results, the columns begin with term Ar in column L.

DeleteSorry.

Roger, nothing to download for SIM7: it's just equations:

Deletehttp://banking-discussion.blogspot.com/2016/03/sim7-determining-both-time-constant-tc.html

In particular, equations 5 (KT = 1), 3A, 4A, 6A and 8A.

DeleteEquation 8A is the ratio of the system time constant to the sample period: Tc/Ts = -1/(log(1-V)) which is approximately 1/V for |V|<<1 (V is a stand in for the ratio of parameters there).

DeleteBTW, I erased my comment about what I think Jason is doing... too much speculation on my part.

DeleteRoger, you write:

Delete(A) "(Period National Income) * (Îž + (1-Îž)(1-Î±1)) = Government"

First of all

(Îž + (1-Îž)(1-Î±1)) = 1-Î±1(1-Îž) = X

It shows up a lot, so I label it X in my comment above and on SIM7.

By "Period National Income" do you mean Y? Well, T = ÎžY, so that's right.

Y[2] = G[2]/X (from my equations above, because H[1] = 0, so your (A) is correct.

(B) "Period Wealth = (Last Period Wealth) + Government - Tax"

That's H[n+1] = H[n] + G[n+1] - T[n+1], so yes, your (B) is correct.

(C) "(Period National Income)*(Îž + (1-Îž)(1-Î±1)) =

Government + (Last Period Wealth) * Î±2"

That's Y[n+1] = Î±2*H[n]/X + G[n+1]/X

Which matches my equation for Y[n+1] when n > 1 (i.e. when H[n] > 0, so that means (C) is good too). Or at least I agree with your equations (A), (B) and (C). All seems OK to me.

This comment has been removed by the author.

DeleteAnd yes, if you set Î±1 = Î±2 = 1, then my equation (8A) at SIM7 shows that Tc/Ts = -1/log(0) -> 0

DeleteI.e. the time constant Tc compared the sample period Ts goes to zero. However, G&L write that you must have 0 < Î±2 < Î±1 < 1 in their equation 3.7 here.

And in terms of what Brian wrote in his post, my X = 1 - A1, so A1 = Î±1(1-Îž), and while we're at it, his A2 = Î±2Îž and his B1 = Îž, which causes his A and B to equal mine.

DeleteI am still wrapping my mind around this. It sounds like three different approaches came to the same basic conclusion. That would be good.

DeleteI missed that

(Îž + (1-Îž)(1-Î±1)) = 1-Î±1(1-Îž) = X

I agree now that you pointed it out.

You are certainly demonstrating excellent math skills. It will take me a lot of study to understand your more general approach.

My derivation was inverted from yours. I will try to post the derivation either here or on my blog. That may not happen until Wednesday but will try for sooner.

Thanks for taking this detailed look at the three (four) equations.

[What follows is the derivation of the equations found in my earlier comment]

DeleteGoalFind the annual GDP (AGDP) increase from a single Original InJection (OIJ).

BackgroundWe know that a single money injection by government can be recovered by government with taxation. [We begin with zero and end with zero. In between zero and zero, we have additional GDP]. We are asking "How much activity can the money generate if every transaction is taxed?"

This is easy to answer if we ask the question in the correct way. Ask "If government injects money and then takes that money away with a tax on each transaction, what is the value of the total transactions required to recover the initial injection?"

GDP*Tr = OIJ

or

GDP = OIJ/ Tr

where monetary activity is GDP and tax rate is Tr.

This value of GDP is a limit. It says nothing about the timing of GDP events.

Convert into a series of annual eventsWe can convert GDP to annual events (AGDP) by considering every step is a division between two taxing authorities. The primary authority will receive the Tr share and the second authority will receive the remainder. Write this in two equations.

(1) AGDP*Tr = AT

where AT is the Annual Tax, and

(2) AGDP*(1-Tr)*Rr = AR

where Rr is the Remainder rate and AR is the Annual Remainder.

Notice that the sequence of events is important here. Tax is removed before a remainder can be calculated.

We know that the sum of the two tax divisions is the original injection:

(3) AT + AR = OIJ

Substitute 1 into 3 to get

(4) AGDP*Tr + AR = OIJ

Substitute 2 into 3 to get

(5) AGDP*Tr + AGDP*(1-Tr)*Rr = OIJ

Simplify 5 to get

(6) AGDP*( Tr + (1-Tr)*Rr) = OIJ

[ Now we have

Tr + (1-Tr)*Rr = 1-Î±1(1-Îž) = X

which brings congruence with Tom Brown's comment.]

This explains the derivation of the first equation contained in my earlier comment

“(Period National Income) * (Îž + (1-Îž)(1-Î±1)) = Government”

wherein I try to align my terms with the SIM model parameters.

[Tom: That is how I came up with the equations. It is not nearly as sophisticated as your (and Brian's) method.]

"It is not nearly as sophisticated as your (and Brian's) method"

DeleteI wouldn't say that. IMO, you're trying to gain insight into what the equations mean. I was more interested in putting them into a form I was familiar with. It's no accident that Brian and I named the "matrices" (really just both scalars in this case) $A$ and $B$ in the "state update equation" or why I named the two "matrices" (both 4x1 vectors in this case) in the measurement equation $C$ and $D$ (really $C_Z$ and $D_Z$ in my case since $C$ is unfortunately already the name of a measurement). It's because those four: $A, B, C$ and $D$ are commonly used in a "state space" representation of a system, both for continuous time and discrete time. It really only applies to linear systems. If $A, B, C$ and $D$ are functions of time, then it's a time varying linear system, and if they are not, then it's a linear time-invariant (LTI) system. Of the two, LTI systems are a bit easier to deal with. Once a system can be modeled in that way (linear or LTI), there's a huge variety of tools that you can use on it that have been developed over the decades. Even if a system is non-linear, sometimes it can be approximated as a linear system between time steps (where multiple iterations are sometimes required per time step for it to converge). Linear systems have the huge advantage of superposition, meaning that different solutions can be added together to produce the final output. This means you can look at the response of the system to an initial state $x_0 = x(0)$ and to the exogenous input $u$ (both of which can be further divided into sub-components) as additive. In discrete time the state update equation implements what's known as a 1st order difference equation, and in continuous time, this is referred to as a 1st order linear differential equation. Both are generalizations of the scalar 1st order differential equations you probably learned about somewhere along the line: $\dot{x} = a x + b u$, the "homogeneous" (i.e. $u = 0$) solution of which is $x(t) = e^{a t} x_0$. Which is where the term "time constant" I use comes from... it's the time constant $T_c = 1/|a|$ of that exponential. When $a < 0$ (i.e. the system is stable), $T_c$ is the time required for the system to decay to $e^{-1} \approx 0.37$ of $x_0$. This solution is known as a "mode" of the system. In the more general case where $x$ is n-dimensional, there will be up to n modes in the solution, which again, are all additive, with some modes potentially being complex (i.e. having real and imaginary components, and producing various kinds of oscillatory behavior). The notation $e^{A t}$ (the "matrix exponential" AKA the "state transition matrix") is used to denote this more general multi-mode solution of an LTI system. (note: time varying linear systems also have a transition matrix, but it's not a matrix exponential in general).

This is a good summary about converting between discrete and continuous time.

When $u$ is a step function (i.e. $0$ when $t < 0$, and stepping up to a constant $u_0$ for $t \geq 0$), the heterogeneous (i.e. $x_0 = 0$) solution to $\dot{x} = a x + b u$ is $(1 - e^{a t}) \bar{x}$ for $t \geq 0$ (and $0$ for $t < 0$), where $\bar{x} = (-b/a) u_0$ is (in the case of a stable system (i.e. $a < 0$)) the steady state solution for $x$. So the time constant $Tc$, in this case, is the time for the system to rise to $(1 - e^{-1}) \approx 0.63$ of $\bar{x}$, which is the situation with the example input G (a step) in SIM. More generally, the solution is the sum of the heterogeneous and homogeneous solutions.

DeleteTom, I find your comments very interesting. They are opening a view and providing a link into a vastly expanded world of geared relationships.

DeleteIt seems to me like the relation "1-Î±1(1-Îž) = X" is the key to making spreadsheet models into sequential flow displays of the economy as it flows through time. SIM begins this, but SIM describes only the initiation of an ongoing economic system. We need the ability to change the theta and alpha parameters "on the fly" to see how GDP and wealth react to changes.

Brian certainly initiated an interesting discussion!

Hi Roger,

DeleteI'm glad you found the comments interesting. That Wikipedia page link will have a more coherent presentation I'm sure. I'm definitely no expert on SFC modeling though. In the case of SIM it overlaps with my comments above. Like Brian says that's not always true. I don't even know if what you're postulating about X carries over to other models.

A couple of final thoughts: A and B for continuous time and discrete time "equivalents" are not the same. The transition matrix solution in continuous time is the A matrix for discrete time, for example.

In particular, for an LTI system $A_d = e^{A_c T_s} \approx I + A_c T_s$ (the approximation holding when the matrix norm $\lVert A_c T_s \rVert = \lVert A_c \rVert T_s \ll 1$, ... an generalization of the approximation you may recall from this comment I left you on John Handley's blog). The subscripts $d$ and $c$ denote discrete and continuous time, respectively. Note that $A_d$ is different for every sample period $T_s$ used. $B_d$ is generally more complicated, but can be approximated as $B_d \approx A^{-1}_c (A_d - I) B_c$. This approximation is exact when $\mathbf{u}$ is a "zero order hold" (ZOH) function, meaning it stays constant over each sample period. More generally, for LTI systems with an arbitrary input $\mathbf{u}$ you must integrate:

Delete$$\mathbf{x}_{n+1} = e^{A_c T_s} \mathbf{x}_{n} + \int_{0}^{T_s} e^{A_c (T_s - \tau)} B_c\, \mathbf{u}(\tau + n T_s) d \tau \tag 9$$

or more generally still, for a time-varying linear system

$$\mathbf{x}_{n+1} = \Phi_{(n+1) T_s, n T_s} \mathbf{x}_{n} + \int_{n T_s}^{(n+1) T_s} \Phi_{(n+1) T_s, \tau} B_c (\tau) \mathbf{u}(\tau) d \tau \tag {10}$$

Where $\Phi_{t_2, t_1}$ is the state transition matrix from time $t_1$ to time $t_2$. Or you can do a Taylor expansion on $u$ and find a separate $B_{di}$ for each $i^{th}$ term. As Brian has previously pointed out, a numerical integration accomplishes much the same thing, only instead of Taylor terms sampled at one time, it uses $\mathbf{u}$ sampled at a several times over a single nominal sample period.

Finally, as I mentioned in a comment above, some non-linear dynamic systems can be approximated over each sample period as a linear system. For example, you may have a non-linear system such as $\dot{\mathbf{x}} = \mathbf{f}(\mathbf{x},\mathbf{u} ,t$), where $\mathbf{f}, \mathbf{x}$ and $\mathbf{u}$ are generally vectors. One way to accomplish this is to approximate $\mathbf{f}$ as $A_c$ and $B_c$ where these matrices are the Jacobians of $\mathbf{f}$ wrt $\mathbf{x}$ (i.e. $A_c = \partial \mathbf{f}/\partial\mathbf{x}$) and $\mathbf{u}$ (i.e. $B_c = \partial \mathbf{f}/\partial\mathbf{u}$) respectively, and to rewrite the differential equation in terms of a small perturbation of $\mathbf{x}$ (call it $\delta{\mathbf{x}}$) about a nominal solution $\mathbf{x}*$: $\delta{\mathbf{x}} \equiv \mathbf{x} - \mathbf{x}*$. Similarly define $\delta{\mathbf{u}} \equiv \mathbf{u} - \mathbf{u}*$. Then we can write for an approximate perturbation to this non-linear differential equation $\delta{\dot{\mathbf{x}}} = A_c \delta\mathbf{x} + B_c \delta\mathbf{u}$. The discrete time approximation I gave above ($A_d \approx I + A_c T_s$) can be seen in this light as a two term vector Taylor expansion of $\mathbf{f}$ wrt $\mathbf{x}$, i.e. $A_d \approx I + (\partial\mathbf{f}/\partial\mathbf{x}) T_s$.

Roger, what I wrote above about modes is illustrated here as a collection of different single mode homogeneous solutions (AKA "impulse responses"). Note that they all appear to be stable (real parts < $0$) and the oscillatory ones have an unplotted imaginary component, 90 degrees out of phase (AKA "orthogonal" to them). Strictly real valued oscillations arise from equal magnitude conjugate pair modes (and a strictly real initial value or impulse, of course). $A$ being strictly real ensures that any complex modes present will be paired in this fashion with their conjugates. It's possible that a single large $A$ matrix could produce a superposition of all the modes pictured. The (possibly complex) value associated with each mode is an eigenvalue of $A$. Sometimes those are referred to as the spectral components of $A$. Thus concludes my short course on linear systems. Lol... (C:

DeleteTom, I think this is indeed a short course on linear systems! You have a great amount of content here. I confess that it is past my present understanding but it is a goal to gain understanding of the basics (and more) that you are describing.

DeleteI notice that you present SIM6 as interactive spreadsheet. Are you saving Excel as a web page and then posting the html file on your blog? Or are you using the Google Doc spread sheet? Or another way?

This evening has been spent using my equations to build a new Excel worksheet. So far, I am following a blend of your SIM6 and the original SIM screen layout. It works on the SIM parameters and makes a nice updating chart. Next, add more complexity.

So far, I have used the " 1-Î±1(1-Îž) = X " in the expanded form. Then I can vary theta and alpha to move the GDP curve. These parameters could be calibrated if desired but that would be a challenge in itself.

Lol... yes, I went way overboard. I'm more having fun learning to use MathJax than anything else (to do the equation formatting).

Delete"Are you saving Excel as a web page and then posting the html file on your blog? Or are you using the Google Doc spread sheet? Or another way?"

Back when I did the interactive version of Nick Edmond's model (that Brian links to in his post), I found that Microsoft was offering free access to an online version of Excel if you signed up for a hotmail account. It was a case in which MS actually had something that worked a lot better than Google Docs (and it was just as free). Maybe that has changed since, but the MS version of an embedded spreadsheet is truly interactive without exposing the original to modification by the unwashed masses (which was the big disadvantage of using a Google Docs version). All I did was develop my spreadsheet online (storing it on a free "OneDrive" server), and then choosing the "embed" option directly from MS's OneDrive (cloud) interface. It produces an HTML line that you simply copy and paste into the HTML editor side of blogger, and the spreadsheet appears there, and people can use it just like you've established they can (you have control over what they can do when you create the embedded link). But since everyone who sees it essentially has their own copy, I generally set it up to let people edit them right there on the blog page, so they can see the results w/o having to download the sheet.

Since that time I've purchased a copy of Excel which comes with access to OneDrive as well. I did this to gain access to the advanced features not present in the free online version (I don't even know if the free version is offered anymore). So I can either edit a copy on my laptop and then save it to OneDrive, or just keep it on OneDrive all the time.

To gain access to the "embed" feature go out to OneDrive (assuming you have an account) through your normal browser, find your file, put a check mark on it, and select "embed" from the menu along the top. I didn't find a way to do that from inside Excel. It works for Word documents as well (see my SIM4 post... that was my solution for putting fancy formatted equations on my blog before I learned MathJax).

It's very easy to do. Go to my SIM6 post with your browser, and select "view source" to see the HTML. Then search for "iframe" to find what the line looks like that embeds the sheet. You can edit that line directly to change things like the width and height, and the cells it displays (which is handy... so you don't have to go back to OneDrive to do that stuff).

Then anytime I change the original, it's automatically updated on the blog. No need to go back to OneDrive and make a new "iframe" HTML line. It works great!

"Although some researchers might want to include infinite horizon utility function optimisations.."

ReplyDeleteI wonder if you had me in mind here. I'm not aware of anyone else doing this. It's a line I pursue, because I'm interested in pinning down exactly where the differences lie between SFC conclusions and more mainstream conclusions. I find it informative, but I also want to be able to address those who dismiss SFC conclusions on the basis that they ignore forward looking behaviour. I believe that, in general, the important qualitative results of SFC models hold, even when you use mainstream behavioural assumptions and I want to be able to demonstrate that.

But fundamentally I agree with you. The benefit of SFC models is their analytical tractability, specifically when looking at issues involving complex balance sheet interactions. And these types of models can be extremely difficult to solve when they involve both forward looking behaviour and certain boundary conditions (such as a borrowing cap say, which may bind in some periods but not in others). At some point, it becomes too difficult to retain everything, in which case my view is that if you want a more informative model, it's the forward looking behaviour that has to go.

No, I was not thinking about your work when I wrote that; I probably should add a reference. I was thinking of the G&L models, and other literature, which lack the multi-period optimisations.

DeleteMy guess is the lack of forward optimisations is the main reason why DSGE modellers would scoff at the model that I am showing.

Brian,

DeleteCould you comment on the limitations you have encountered for using Python for simulating SFC models?

Today this post is filled with red fields that say [Math Processing Error]. I am using chrome browser.

The limitations of my framework are peculiar to the way I built it, and not the issue with the language. I built it an away so that I could simulate fairly complex systems, but I gave up on tracking the algebraic equations. This would rule it out for some academic uses, and I could not directly simulate the Godley & Lavoie models. The way my system works, each decision relies on information that is "currently available" (which includes some information from the current period), so there is no need to simultaneously solve for the "in-period equilibrium". It would have been possible to emulate the iterative techniques used by Matlab/R in Python.

DeleteAs for the post - I use Chrome, and it works for me. I have no idea how to make it display, other than checking to see whether your browser is out of date. This sort of thing is why I avoiding using MathJax in the first place. Although it's clunky, I kind of prefer pasting in a screen shot of the equations, since any browser can support that. I am supposed to be finishing off my report, but I expect that I might do a PDF with the formulae sooner or later. (One of my next projects will be a report on SFC models, but I will do it as a PDF, which I hope can be distributed on Amazon.)

Mathjax: back when I first encountered that on Jason's blog, I saw the LateX code, not the formulas. Here's my little dialog with him... I haven't had trouble since.

DeleteBrian,

DeleteThanks for your answer. I find Python to be flexible and powerful language so I assume it would work for fairly sophisticated models. I have thought about automating graphs of Fed flow of funds data using Python and Bokeh (a fairly simple process of reading and plotting data from a large file).

The math is appearing today. I did notice a file loading to support mathjax -- I think that file must download from the central server every time one lands on the page or refreshes the page. Odds are the support file did not download into chrome the other day.

Yes, it loads the processing code from the MathJax site. I find it loads much slower on my underpowered computer that uses Chrome than on my iPad.

DeleteThe only thing with Python is that you would probably need to track down the various math packages. I have been using Python as a scripting language to glue my database data acquisition together, and not for time series analysis, so I have not actually used those packages. I hacked together something simple that did what I wanted.

This comment has been removed by a blog administrator.

ReplyDeleteThis comment has been removed by a blog administrator.

ReplyDeleteThis comment has been removed by a blog administrator.

ReplyDelete