Tuesday, April 5, 2016

A Master Equation for SIM Models Using the GDP Object DRAFT


There seems to be a path from the barter economy to the money economy.  The SIM spreadsheet model is a simple emulation of a stable money beginning but we need a better path from start to monetary stability, Lets's see if we can find that path and equations for building a SIM style of model.

The Barter Economy

First, we will build an economy measured in transactions and described by GDP (Gross Domestic Product). This is a barter economy without money. We label GDP as GDPt (using the sub t as a identifier). There is a private sector (PSt) and a government sector (Gt). Government is allowed to levy tax to enable spending. The tax is applied at a rate of TRt on a period basis.

We can write three equations that will describe this eonomy:

(1)     Gt + PSt = GDPt
(2)     GDPt*TRt = Gt
(3)     GDPt*(1-TRt) = PSt

With these three equations and an assigned (or discovered) value of TRt, we can describe this economy in a spreadsheet environment. Years can be represented by columns marching across the page. These three equations are a simple measurement with no memory between periods (There is no need for memory because transactions are events.)

Introducing Money

Modern economies are money based, not transaction based. How can we introduce money into this spreadsheet model?

Figure 1. A barter economy can be converted into a money economy. The GDP curves are considered to be square or rectangular hyperbolas, with the property xy =1.                        
From Figure 1, we can see that GDP can be represented by transactions or money. How would we make and display the transition from transactions to money?

Unlike transactions, money has a characteristic of duration. Money is an object with a lifespan. The three transaction equations will need to be supplemented with additional terms and equations that record the money carried between periods.

We will define money that is held from one measurement period into a second period as wealth (H). Wealth from a previous period will be labeled H-1.

Wealth held in more than one period must be dynamic. There must be a method of creation, holding, and destruction. Money can be created by borrowing [Exactly how is an ongoing debate among economist and philosophers.] In this simple model we will assume that government can borrow from itself, spend this borrowed money into existence, and finally destroy money with taxation. While the money is in existence, the private sector will be allowed to store money as wealth.

There is no way to know when the private sector will spend it's stored wealth. There is no way to know how much money the private sector will save from each period. We do know that the private sector cannot save more than that part of GDP left after government extracts it's share. The private sector gets a remainder. This sequential nature of events will be important later when we design equations.

We are ready to write equations that describe the entry of money into a transaction economy. We will use three assumptions to simplify the equation construction:
  1.  Government will have no savings.
  2.  Government will spend new money into existence unless it has tax money to spend. This is similar to government beginning a new program and using money it borrows from itself to fund the program.
  3.  Equations 1, 2 and 3 are still valid but they are missing wealth terms. We  add the necessary wealth terms and drop the sub t label-modifier.
We will take an empirical approach. Because we cannot hope to predict the actions of people, we will build in adjustable parameters that can be calibrated to reasonable values discovered by measurements of existing actual economies. What we need is a mathematical system that repeats at every replication with some memory of the past. We are ready to begin.

Building the Dynamic Money Equation

If government spends (G) and collects taxes (T) at rate (TR), we can write

(4)     GDP*TR = G = T

For the private sector share of GDP,  write

(5)     GDP*(1-Tr) = PS

Here is a critical point. These equations describe a stable economy.  If we stopped this analysis using only equations 4 and 5, we would be assuming that government recovered the entire initial amount spent. [In equation 4, we wrote that the tax collected equals the amount initially spent. This describes a stable economy, not a dynamic economy with wealth remaining at the end of the period.] The GDP for any period can only be as big as allowed by the remaining wealth circulating completely expanded in the economy.

The act of saving money from the present period will be treated as second tax.   This savings rate tax (α1) will be applied to the private sector share of annual GDP (AGDP) to fund the annual amount saved H. We can write

(6) AGDP*(1-TR)*α1 = H

We assume that government will tax the annual GDP so we write

(7) AGDP*TR = AT

where AT is the annual tax collected by government.

We assume that the amount saved added to the amount collected in taxes equals the amount spent by government added to the amount spent from savings during the period. We can write

(8) H + AT = G + H-1.

We can combine equations 6, 7, and 8 to write

(9) AGDP*(1-TR)*α1 + AGDP*TR = G + H-1.

Rearrange equation 9 to write the master equation for period GDP

(10) AGDP = (G + H-1) / ((1-TR)*α1 + TR).

Now we can examine equation 10 to see that if we assign values to terms G, TR, and α1, we have defined AGDP. The values for these three parameters will be discovered by empirical methods.

Tie to the SIM Model

Wynne Godley and Marc Lavoie in their book "Monetary Economics (2007) , chapter 3, describe an economic model SIM. Several versions of these models are available on the Internet. The parameters used in this post can be directly converted to the SIM parameters.

TR -> θ || G -> G || α1->α1 || α2->α2 || H->H || AGDP->Y

We have not yet used the term α2. We used the term H-1 (wealth) to provide the memory between periods. Empirically, we find that there is no need for all of the wealth saved in one period to be used in a second period. We use the factor α2 ( Propensity to consume wealth) to modify the amount of wealth used in a later period. Therefore, we can write (for example)

H-0 = α2*H-1
$H_0 = \alpha_2 H_{-1}$

and use H-0 as the starting wealth in the next replication. Term α2 is also empirically determined.

Using the Equation in a Spreadsheet

We can use equation 10 to build a spreadsheet model of an economy without using spreadsheet iteration. This makes the model much easier to understand. Each of the three empirical parameters can be adjusted to create a unique model. The wealth carried between periods can be adjusted by changing term α2. 

Spreadsheet columns can represent time periods. Each period can be adjusted to introduce "jump" changes in later periods. [Later adjustments require a second empirical entry table and decision logic in the spreadsheet column structure. This is easy to do but tedious in construction]


We have found one possible path from the barter economy to a simulated monetary economy. This is a very simple model but flexible to allow inclusion of additional parameters. The ability to construct a mathematically satisfying simple model encourages further use and development of this mechanical method and theory.



  1. Hi Roger,

    I took a read through. Seems to make sense. This bit here though:

    H[0] = α2*H[-1]

    is just an example... not something done in SIM.

    1. Thanks for taking a look. I probably should have just applied α2 into Equation 10. Maybe this will be one of my edits before taking the DRAFT designation off.

      Hmmm, if I did that, the "integrator" would have 5 inputs, and would be self stabilizing when replicated in a spreadsheet. This control world you're opening for me is cool. Am I right in calling this an "integrating" equation?

    2. Well, really the only thing that's integrated is H. It's really being accumulated (the discrete time analog of being integrated). You need a formula like this:

      H[n+1] = A*H[n]

      With an optional input:

      H[n+1] = A*H[n] + B*G[n+1]

      This is what SIM has. I think yours is the same. Taking Z-transforms we have:

      z*H(z) = A*H(z) + z*B*G(z)

      So, then dropping the z argument, and looking at the transfer function (H/G) we have:

      H/G = z/(z - A)

      If A = 1, it would be an accumulator, but A is actually on (0,1) in the case of SIM. In fact, it's about 0.84 or so I think. Expressing that transfer function slightly differently it looks like:

      1/(1 - A*(z^-1))

      Which is entry #12 in this table of common Z-transform pairs:


      Where u[n] is the unit step (u[n] = 1, for n >=0, u[n] = 0, for n < 0). So what's that look like? Well, starting at n=0 and going forward, that produces the sequence:

      a, a^2, a^3, ..., a^m, ... off to infinity!

      The "ROC" in the table is the region of convergence, and it says that for this sequence to converge |z| > |a|.

      For SIM a = A = 0.85 which means the RoC includes the unit circle, which means it has a Fourier transform (in other words it's an summable function, not going off to infinity: i.e. it's stable).

      So, you don't really have an integrator (accumulator), you have a weighted accumulator (you could call it a weighted moving average, an autoregressive process, or a 1st order IIR low pass filter). If you interpret alpha1, alpha2 and theta as system parameters, then the input is G and it has just one input. A and B are functions only of the parameters.

    3. I didn't quite get that right for the sequence. It should be:

      1, a, a^2, a^3, ..., a^m, ... off to infinity!

      That 1 at the start is for n=0, which is a^0 = 1.

      The way you take the Z-transform is pretty straightforward (it's printed here).

      X(z) = sum, from n = -inf to +inf of (z^-n)*x[i]

      So check out that sequence... for all n < 0, it's zero, so we can ignore those. Otherwise, we get the following:

      X(z) = a^0*z^-0 + a*z^-1 + a^2*z^-2 + ... + a^m*z^-m + ...

      Now do the following:

      X(z) - X(z)*(a*z^-1)

      Do you see what you get? All the terms cancel except the 1st one:

      X(z) - X(z)*(a*z^-1) = a^0*z^-0 = 1*1 = 1

      Thus X(z) = 1/(1-(z^-1))

      Neat, eh?

    4. Another way to express the time-domain sequence above for x is:

      x[n] = 0, for n < 0
      x[n] = a^n, for n >= 0


      x[n] Z-transforms to X(z)

      X(z) inverse-Z-transforms to x[n]

      They are a Z-transform pair.

    5. x[n] the way I've written it there is the impulse response for SIM (where you should replace x with H of course). It's an "infinite impulse response" (IIR) because it never completely goes to zero.

    6. Another word for x[n] is a "geometric sequence" or if a is on (0,1) it's an exponentially decaying sequence.

    7. Just by looking at the the formula for the Z-transform in the case of x[n] you can see that for any z such that |z| = |a| then that summation will never converge. For example, say a = 0.5 and z = 0.5... then you're summing a unit step, which is a ramp: it goes off to infinity. The sum doesn't exist. The situation only gets worse for |z| < |a|. Thus |z| <= a is OUTSIDE the ROC.

    8. ... but as long as your ROC includes the unit circle, you're generally OK, which is the case for a = 0.5. But now consider a = 1.5. For the Z-transform sum to converge, the z argument to X(z) has to be |z| > 1.5. In other words, the unit circle is now outside the ROC. That's bad news! What it means is that the x sequence grows w/o bound (i.e. is unstable). Select z = 2 for example... that will converge, but what it means is you have to multiply each term of x by 1/2 the weight you applied to the previous term to shrink the whole sequence fast enough so the sum converges. You can think of the z variable as the shrinking or growing weight. a = 1.5 means z has to do some powerful shrinking just to make the transform exist. a = 0.5 means you can even apply a growing set of weights and the sequence still converges (up to a limit, of course).

    9. Now for fun consider the following sequence:

      x[n] = 2^n, for n <= 0
      x[n] = 0.8^n, for n > 0

      What's the ROC in that case? Does it have one? Actually it does, and it's shaped like a doughnut! The ROC is 0.8 < |z| < 2. It still includes the unit circle (i.e. |z| = 1), so we're OK: it's a stable function.

      Now how about this sequence?:

      x[n] = 0.7^n, for n < 100000
      x[100000] = -300000000
      x[n] = 1.1^n, for n > 100000

      What's its ROC? Does it have one? If it has one, does it include the unit circle? I'll let you think about that on your own. (Hint: most of those details in my specification of the sequence are irrelevant... there's just a few things you need to notice)

      You probably weren't expecting a quiz question from one of your readers, were you? =)

    10. BTW, I think I already covered this, but for a discrete time sequence, the Fourier transform is a continuous function of a frequency parameter, usually called omega, but I'll write it as w. w is dimensionless, but you can think of it representing radians. And all the Fourier transform is is the Z transform evaluated on the unit circle (i.e. with |z| = 1). Often, it's written like this:


      to distinguish it from the regular Z-transform of x:


      But there's nothing very special out it. Although, written as a function of w like that ... you'll note that the discrete time Fourier transform is cyclical, i.e.

      X(exp(i*w)) = X(exp(i*(w + m*2*pi))), for any integer m

      But actually evaluating the Fourier transform doesn't involve anything other than that summation formula I gave you above: just set z = exp(i*w) for some w and then evaluate the summation (provided the unit circle is inside the ROC).

    11. Error several comments up:

      X(z) = sum, from n = -inf to +inf of (z^-n)*x[i]

      Should be:

      X(z) = sum, from n = -inf to +inf of (z^-n)*x[n]

      I keep wanting to put "i" in for n, but we should reserve i for sqrt(-1) (like in exp(i*w))

  2. BTW, it's easy to add the ability to add fancy math formatting to a particular blog post if you want: just open the "HTML" editor tab instead of the "Compose" one, and put this line at the top:

    LABscript type="text/x-mathjax-config"RAB MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}}); LAB/scriptRAB LABscript src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"RAB LAB/scriptRAB

    But replace all the LAB with left angle brackets (less than signs) and all the RAB with right angle brackets (greater than signs) (I had to change them else blogger won't let me put that in my comment).

    Then, for example, to write H with 0 as a subscript, just type $H_0$. To replicate that whole equation use:

    $H_0 = \alpha_2 H_{-1}$ where the {} braces are needed when the subscript is more than one character. If you want that on a separate line and centered, use double dollar signs instead on either end ($$).

    More here:

    1. ... for the blog post you add that too, it works in the comments as well. And it won't mess up any of your old posts or comments either: you have to include that line at the top of each post you want that formatting ability turned on. I learned that a couple weeks back... it's kind of fun making very elaborate looking formulas, but you can keep it simple too if you want. Underneath it's using something called LaTex. There's lots of info about LaTex out there, including a Wikipedia list of symbols:

  3. Roger, I looked a bit at the Octave packages available. There's a control package. It includes these interesting functions:

    They also have an ordinary differential equation package that allows you to numerically solve differential equations (ODEs).

    This document from Mathworks talks about ODEs and linearizing them. It's pretty good.

    There's also an Octave econometrics package.

    1. Roger, I also noticed that Octave's control package has several functions for robust control. That's the kind of thing I was doing in grad school (but haven't used since). I spent some time perusing both the Octave and Matlab websites regarding their respective robust control packages... and of course the Matlab one has more to it and is better documented. Still, I'm pretty impressed that Octave at least has some of the basics there. For example, they have what's known as $H_{\infty}$ robust control synthesis. Here's one of the functions that makes use of that. As you can see their documentation is rather crude, but to figure out what's going on you can always just visit the Matlab pages that correspond to it.

      What I found interesting was that I never really understood some of those concepts all that well in grad school, and I think I can grasp them better now. Lol! How often does that happen? I'm by no means an expert though!

      But here's a fascinating example on Matlab's website (the robust control of an active suspension system for a car) that uses both $H_{\infty}$ and another technique called $\mu$-synthesis. One of my professors in grad school actually helped write that $\mu$-synthesis set of functions (he called it $\mu$-Tools at the time, which is now the name of software for composing music).

      I'm pointing it out because that seems like the perfect thing for an economic model that you're very uncertain about... embedded within that are ways to express your uncertainty in the model with what they call additive and multiplicative uncertainties.

    2. ... what could be less certain than an economic model? Lol.

    3. BTW, here's MATLAB's version of the robust control function mixsyn(). As you can see their page is MUCH better, documentation wise, but probably the Octave function does the same thing!

  4. Tom, I am so far behind you!

    I looked up this table at


    and noticed that if I scroll up the table, there is a very expansive discussion of the Z-transform. It takes me a while to get this into my head!

    I have an Excel spreadsheet working pretty well. I think I will post it today. I will revisit your instructions on Excel posting to refresh my memory from first reading. Like most everything I do, it is still a work in progress.

    OH, on your very first comment in this post, I think

    H[0] = α2*H[-1]

    did appear in SIM. The thing was, it appeared as simply


    in the body of the spreadsheet consumption equation.

    I will also try to enable the HTML ability of the post as you showed in a previous comment. I think I will also try to add the word DRAFT to the title. I wonder if Google will allow title changes once a post has been published? We shall see.

  5. Tom, Yes, both DRAFT title change and your code for Mathjax works. We can use Mathjax in this post now. Thanks again for the accurate help.

    I am working on Z-transforms this morning, trying to understand. I am forming a picture. Is this correlation correct: there must be something like a hinge (which is located by two points on a three dimensional system) between original and the transformed projection. With a hinge, the transform would be reversible.

    Second question: Brian Romanchuk in Techniques For Finding SFC Model Solutions writes "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})=Ax(t)+Bu^(t),x(_0)=x_0$ ."

    It seems to me that my equation 10 does that. Am I right?

    1. Hinge: I don't get the analogy.

      Your equation 10: The problem is you need one system variable appearing at two different times (for a discrete time model). For continuous time, you need a variable and it's time derivative.

      In your 10 I see $H_{-1}$ but I don't see $H_0$ or $H_n$ where $n \ne -1$. None of the other variables have a time index. Your equation 8 is close, but it has no index at all on one $H$. The only one that has that is the unnumbered one that I remarked about as not being accurate: $H_0 = \alpha_2 H_{-1}$.

    2. On the hinge analogy, if we added a fourth term, the transformation itself could be a time step. Is this what a Z-transform is all about?

    3. Also, here's a tip for MathJax, especially when you're new to it: put that HTML line at the top of a page (a page, not a post) that you don't share with the public, and then you can use that page to test something to make sure it looks like what you want. Alternatively, write in a different text editor, and then say try pasting in a comment on that page. Once you get the hang of it, you can wing it (like I just did above) for simple things. But if I were attempting anything complex, I'd definitely have a little experimental set up... it's an iterative process!

      Also I don't always use it. Sometimes it's just not necessary. It's a balance: how much effort do you need to make yourself clear.

      Another tip: white space is managed entirely by LaTeX between dollar signs... so you may think you're adding spaces, but you're not. That MathJax tutorial has a bit on space management w/in a LaTeX sting. For exaple, \, adds a thin space. \; adds a bigger space, and \quad adds yet a bigger one. There may be a \; too in there somewhere. \\ adds a new line.

      You can use my comments section on one of my test pages if you like (This page isn't normally linked to that the public can see):

    4. On the hinge analogy, Hmmmm.

      On $H_0$, it will appear in Eq. 10 if we write $\alpha_2H_{-1}$ which is the equivalent of writing it twice in the equation (I think).

    5. "On the hinge analogy, if we added a fourth term, the transformation itself could be a time step. Is this what a Z-transform is all about?"

      I'm still not getting you. I will make you a post to explain it better and show you the relationship to an "inner product" between vectors. An inner product is the amount one vector is aligned with another scaled by the 1st vector's size. When an inner product is 0, the vectors are orthogonal. It's sometimes called the "dot product." For example, suppose $v$ and $u$ are both N-vectors, meaning they are column vectors with dimensions Nx1 (N rows, 1 column). Then they both inhabit the same vector space, and this is how we write their dot product: $a = v^T u = u^T v$ where the T stands for transpose. Now suppose that v is infinitely long, and has terms like $v = [ 0 0 ... 0 1 a a^2 a^3 ... ]^T$ and u is infinitely long and looks like $u = [ ... z^{2} z^{1} z^{0} z^{-1} z^{-2} ... ]^T$ starting at -infinity and going to +infinity, and the row of v that = 1 corresponds to the row of u that = $z^0 = 1$. The Z-transform of v is then $v^T u = v \dot u = $ a scalar (if it exists!... the ROC concept is about determining if that inner product exists in the first place).

    6. This comment has been removed by the author.

    7. Well, I didn't take my own advice there! That comment looks a little off! The 0s are all run together in v, and my "dot" in the dot product showed up above them rather than between them.... and I didn't copy it to my clipboard, so I'd have to start all over to fix it.

      ... I'll do a post later.

      Let me try one more super simple example. Say you have a sequence $v$ that looks like this:

      $$v_0 = 1,\; v_1 = a,\; v_2 = a^2,\; ... v_9 = a^9$$

      and $v_n = 0$ for every other value of $n$. Notice that v is a SEQUENCE and not a scalar. Applying the formula for the Z-transform, we have:

      $$V(z) = 1 + a z^{-1} + a^2 z^{-2} + ... + a^9 z^{-9}$$


      $$V(z) a z^{-1} = a z^{-1} + a^2 z^{-2} + ... + a^9 z^{-9} + a^{10} z^{-10}$$

      and thus

      $$V(z) - V(z) a z^{-1} = 1 - a^{10} z^{-10}$$
      $$V(z) (1 - a z^{-1}) = 1 - a^{10} z^{-10}$$
      $$V(z) = \frac{1 - a^{10} z^{-10}}{1 - a z^{-1}}$$

      Now imagine that we increase the number of non-zero terms in $v_n$ for $n > 9$, and imagine that as n gets bigger and bigger, the magnitude of the product, written like this $|a^{n} z^{-n}|$ gets smaller and smaller and actually approaches 0. In that case we can still write $V(z)$ and it looks like:

      $$V(z) = \frac{1}{1 - a z^{-1}}$$

    8. ... and V(z) is a SCALAR, not a sequence. It's like an inner product between our original sequence (extended with 0s to be infinitely dimensional in both directions) and an infinitely long sequence of all possible integer powers of $z$.

    9. Hmmmm. Thinking!

      H is written twice in the sense that we have $H_0$ and $H_{-1}$ both in the single term $\alpha_2H_{-1}$. An unusual way of thinking about it but H is the term we are trying to evaluate.

      Hmmm. H is hidden in both GDP and G so we need to know the tax rate and G to extract it from GDP.

      This is the reason I thought we needed to begin the complete money system beginning at zero. Then we can logically set $H_{-1}$ to zero for the initial value. In the spreadsheet, we can set the initial value to anything; my spreadsheet SIM will still stabilize.

    10. This comment has been removed by the author.

    11. Roger, if you want to put your model into "cannonical form" (like Brian Romanchuk wrote about), then you can't have terms of $H_n$ hidden in other variables. You need to explicitly state what the difference equation is. Then write those other variables in term of $H_n$. My guess is terms like GDP will end up being in the "measurement equation" rather than the "state equation". Recall the two are as follows (first state, then measurement):

      $$x_{n+1} = A x_n + B u_n \tag 1$$
      $$y_n = C x_n + D u_n \tag 2$$

      Thus the equation for the vector y is the measurement equation, and that's probably where your GDP belongs. There are no dynamics generated in y on it's own: it simply inherits any dynamics it gets from a linear combination of those generated in x and those present in the exogenous input u.

    12. This comment has been removed by the author.

    13. ... just to be clear, my (1) above is the state update equation, and the state is the vector x. That's where you H belongs, and that's all that belongs there (I think), and thus your x will be a scalar not a vector (or a vector of dimension 1). u is the exogenous input (in SIM that's G), and y is the measurement, or output vector. In SIM that's the vector $[ Y\, T\, Y_D\, C ]^T$ where the superscript T is just the transpose signifier (the big T is the taxes paid that period, or the tax rate, formulated slightly differently).

    14. Regarding an initial value for H (or in my cannonical example, x), yes you can always set that to zero. The solution to the equations will be the sum of the system's response to it's initial value (with no input u) and the response to the initial value at 0 with a non zero input). That's the homogeneous and heterogeneous solution respectively, and because the system is linear you can add those solutions. If one of them doesn't exist (i.e. H is really 0 or u is really 0) you just need one of them. If both H and u are 0, then the system is trivially at 0 always.

    15. You spreadsheet will still stabilize with any initial H because the system is stable (it's pole (value of A in this case) is inside the unit circle)! If it were not, then it would run off to infinite magnitudes. So that's a good thing that it stabilizes!

  6. I caught a brief glimpse of your "Mechanical Testing Page" before you removed it! =) ... I tried leaving a comment letting you know it was a post rather than a page.

    One thing I forget to tell you is that by default blogger will make your pages visible... you have to do some extra steps to remove the page menu (unless you've already done that). For example, in my old blog, you can see the page menu in the horizontal bar across the top:


    Still, even with no extra work, it's not AS visible as posts are... especially if you give it a name like "." ... yep, just a single period. Hard to see!

    1. Wow, it was up for very few minutes!

      I think I have something figured out. If I go to the blogger Overview Page, it has an option "Pages". I had no pages but did have post. I now think I have a page that does not post, even though I published the page. The link is Mechanical Test Page

      Hmmm, I had to modify the href, removed the class keyword so that preview would accept. That may wreck the link. I could include the html.


      I do not see this page on the post list. I find it when I use the link.

      If you are at the test page, you should see a crude picture of transaction GDP. I am still trying to understand Z-transforms and the way it is written. I wonder if we and Brian all have the same SFC model goal. The picture has is still in the "think" stage so watch out for intellectual noise.

      Say, would it be alright to put your name in the post for acknowledgement when I finally convert it from DRAFT?

    2. Brian writes "x(t+1)=Ax(t)+Bu^(t),x(0)=x0.
      In this case, xx is a vector of variables, residing in RnRn. For those of you who are unfamiliar with matrix notation (or purged the concept from memory), that means we are stacking up nn time series variables into a single object. Using economic lingo, x(t)x(t) are the endogenous variables, and the vector u^(t)u^(t) is the vector of exogenous variables ("inputs")."

      OH, I think the light just went on. I need to think this through however.

    3. "Say, would it be alright to put your name in the post for acknowledgement when I finally convert it from DRAFT?"


      ... and you're right: I see no sign of your test page other than through the link you give there. Nice!... maybe it defaults to NOT including a menu of pages at the top (like in my old blog).

      Well done Roger: you've got a lot accomplished!

      Let's see if I can make a link to it:

    4. Roger, here's Wikipedia on state space representations:

      As you can see the really do use A, B, C and D. Also, that's precisely what Matlab and Octave expect:

      Matlab's ss() command.

      Also note the role of the three vectors x, y and z (potentially of different dimensions).

    5. "Also note the role of the three vectors x, y and z (potentially of different dimensions)."

      Should have been:

      "Also note the role of the three vectors x, y and u (potentially of different dimensions)."

      There is a z too that's often used: it usually represents an output (y) corrupted with measurement noise:

      $$z = y + \Psi v$$

      Where v is additive white Gaussian noise.

    6. This comment has been removed by the author.

    7. Actually, here's another Matlab page where they write down the cannonical model, but instead of $\Psi$ which would cause the noise process $\Psi v$ to have covariance $E[ \Psi v v^T \Psi^T] = \Psi \Psi^T$ given that $v$ is AWGN with unity covariance $E[v v^T] = I$, they just say that $E[v v^T] = R_2$. I find different authors diverge on how to name and treat the noise sequences and their covariances, but most stick to x, y, u and A, B, C and D.

    8. Also, bear in mind that Brian Romanchuk's presentation of the "cannonical form" of a state space model is actually slightly different. He's folding into his presentation his method for avoiding algebra on the SFC accounting equations. The Matlab and Wikipedia pages I link to above are closer to what you'll find in most literature.

    9. And look here: the state space equations for a Kalman-Bucy filter (where the noises are important), uses F or A and H for C, with the measurement noise (v) covariance being R and the process noise (w) covariance being Q. Lol... oh well. The main thing is not the names, but the form. =)

    10. ... Oh, and z for y (like I have it: as a noise corrupted y).

    11. ... and D = 0 (it's completely missing), which is actually pretty typical, as I've pointed out before. For your model (and for SIM) you'll need a D though!

  7. Roger, here's a page I put up about the Z-transform, including a Matlab script (that hopefully runs in Octave) which shows you an example of how it's calculate for a finite length sequence. The Z-transform of finite length sequences converge in the whole Z-plane (i.e. their ROC is the entire plane).

    It looks long, but it's VERY simple. Most of the script has to do with making the figures and console output look nice. Enjoy!

  8. Tom, Can you see the spreadsheet here?


    It seemed to transfer from Excel to Google Sheet reasonably OK. I see the check box is missing but there is a zero in the next column. Change the zero to 1 and the jump works.

    I could also put the Excel file on my web site but I have not accessed that for a couple of years. Need to find the password and more.

    Could also get a Microsoft online account. Trying the free stuff first.

    1. The spreadsheet link seems to work from here. I see you need to go to sheet 1 (it initially goes to sheet 4) and it is a little slow to load.

      I will fix it or get a workaround if you can see it.

      Something to sleep on. I think Eq. 10 is like a controlled regenerative stage. It has 5 inputs and one output. The output GDP is the stored result. Linear system block A is the regeneration control. A second external block A updates a memory containing wealth information, using the GDP output. I think the GDP output is the only information need to fill out the rest of SFC SIM parameters.

      The link to the state space page provides entry to a lot more information. I will study all of this much more.

    2. Hi Roger, yes I can see it and it works. I left a couple of messages in there for you... see if you can find them! =)

    3. ... that's the only drawback to the Google Docs approach: strangers or no-good-nicks or people like me can wander in off the internet and mess up your sheet! With Excel, each person viewing the sheet has their own personal copy and their edits do not change the original or what anybody else will see. If they mess up their own copy, they just need to refresh their browser to get an original copy back.

    4. I found the comment and you are right. There are IF(x,x,x) in two rows but Offset, much to my chagrin. Another thing to fix. Glad it works. Next, get better ways to protect the sheet or go to Excel. More on this tomorrow.

    5. I left more than one comment. =) (but all in the same place).

    6. ... a drawback of the Excel approach is that nobody can help you fix errors with it, unless you grant them some kind of special access to your "OneDrive" account. Also, they only have limited controls through the web-page: they cannot see or change formulas in cells, only the values (at most).

    7. ... all in all, I like the Excel approach better. I'd rather have the sheet protected. People can still download their own copy if they want to fix my formulas, and then email me a copy (or post a copy in Google, or on OneDrive that they let me download).

      It's not that I'm terribly worried what people will do, but I'd rather not have it slowly drift off into a non-functional sheet over time (if I'm not constantly monitoring it, say). Or maybe somebody will come along and erase everything and just write out in huge letters: "TOM BROWN SUCKS!!" ... Lol!

      hey, that gives me an idea..... who do I know that has a shared Google Docs sheet? Hmmm.... ;)

  9. This comment has been removed by the author.

  10. Tom, I created a new page displaying what I think might be the state-space. Equation 10 looks to me like a regenerative amplifier with degenerative feedback.

    Maybe it can be found at

    I have no idea of why the mathjax in the url.


Comments are welcomed but are moderated. It may take awhile before they appear to be viewed by all.