Category Archives: Tools

What’s the empirical distribution of parameters?

Vensim‘s answer to exploring ill-behaved problem spaces is either to do hill-climbing with random restarts, or MCMC and simulated annealing. Either way, you need to start with some initial distribution of points to search.

It’s helpful if that distribution is somehow efficient at exploring the interesting parts of the space. I think this is closely related to the problem of selecting uninformative priors in Bayesian statistics. There’s lots of research about appropriate uninformative priors for various kinds of parameters. For example,

  • If a parameter represents a probability, one might choose the Jeffreys or Haldane prior.
  • Indifference to units, scale and inversion might suggest the use of a log uniform prior, where nothing else is known about a positive parameter

However, when a user specifies a parameter in Vensim, we don’t even know what it represents. So what’s the appropriate prior for a parameter that might be positive or negative, a probability, a time constant, a scale factor, an initial condition for a physical stock, etc.?

On the other hand, we aren’t quite as ignorant as the pure maximum entropy derivation usually assumes. For example,

  • All numbers have to lie between the largest and smallest float or double, i.e. +/- 3e38 or 2e308.
  • More practically, no one scales their models such that a parameter like 6.5e173 would ever be required. There’s a reason that metric prefixes range from yotta to yocto (10^24 to 10^-24). The only constant I can think of that approaches that range is Avogadro’s number (though there are probably others), and that’s not normally a changeable parameter.
  • For lots of things, one can impose more constraints, given a little more information,
    • A time constant or delay must lie on [TIME STEP,infinity], and the “infinity” of interest is practically limited by the simulation duration.
    • A fractional rate of change similarly must lie on [-1/TIME STEP,1/TIME STEP] for stability
    • Other parameters probably have limits for stability, though it may be hard to discover them except by experiment.
    • A parameter with units of year is probably modern, [1900-2100], unless you’re doing Mayan archaeology or paleoclimate.

At some point, the assumptions become too heroic, and we need to rely on users for some help. But it would still be really interesting to see the distribution of all parameters in real models. (See next …)

Timing Vensim models

Need to time model runs? One way to do it is with Vensim’s log commands, in a cmd script or Venapp:

LOG>MESSAGE|timing.txt|"About to run."

These commands were designed for logging user interaction, so they don’t offer millisecond resolution needed for small models. For that, another option is to use the .dll.

Generally, model execution time is close to proportional with equation count x time step count, with exceptions for iterative functions (FIND ZERO) and RK auto integration. You can use the .dll’s vensim_get_varattrib to count equations (expanding subscripts) if it’s helpful for planning to maximize simulation speed.

Circling the Drain

“It’s Time to Retire ‘Crap Circles’,” argues Gardiner Morse in the HBR. I wholeheartedly agree. He’s assembled a lovely collection of examples. Some violate causality amusingly:

“Through some trick of causality, termination leads to deployment.”

Morse ridicules one diagram that actually shows an important process,

The friendly-looking sunburst that follows, captured from the website of a solar energy advocacy group, shows how to create an unlimited market for your product. Here, as the supply of solar energy increases, so does the demand — in an apparently endless cycle. If these folks are right, we’re all in the wrong business.

This is not a particularly well-executed diagram, but the positive feedback process (reinforcing loop) of increasing demand driving economies of scale, lowering costs and further increasing demand, is real. Obviously there are other negative loops that restrain this one from delivering infinite solar, but not every diagram needs to show every loop in a system.

Unfortunately, Morse’s prescription, “We could all benefit from a little more linear thinking,” is nearly as alarming as the illness. The vacuous linear processes are right there next to the cycles in PowerPoint’s Smart Art:

Linear thinking isn’t a get-out-of-chartjunk-free card. It’s an invitation to event-driven unidirectional causal thinking, laundry lists, and George Richardson’s Dead Buffalo Syndrome. What we really need is more understanding of causality and feedback, and more operational thinking, so that people draw meaningful graphics, employing cycles where they appropriately describe causality.

h/t John Sterman for pointing this out.

Vensim + data with ODBC

I haven’t had much time to write lately – too busy writing Vensim code, working on En-ROADS, and modeling the STEM workforce.

So, in the meantime, here’s a nice tutorial on the use of ODBC database links with Vensim DSS, from Mohammad Jalali:

This can be a powerful way to ingest a lot of data from diverse sources, and to share and archive simulations.

Big data is always a double-edged sword in consulting projects. Without it, you don’t know much. But with it, your time is consumed with discovering all the flaws of the data, which remain because most likely no one else ever looked at it seriously from a strategic/dynamic perspective before. It’s typically transactionally correct, because people verify that they get their orders and paychecks. But at an aggregate level it’s often rife with categorization mismatches across organizational boundaries and other pathologies.


I cringed when I saw the awful infographics in a recent GreenBiz report, highlighted in a Climate Progress post. A site that (rightly) criticizes the scientific illiteracy of the GOP field shouldn’t be gushing over chartjunk that would make USA Today blush. Climate Progress dumped my mildly critical comment into eternal moderation queue purgatory, so I have to rant about this a bit.

Here’s one of the graphics, with my overlay of the data plotted correctly (in green):

“What We Found: The energy consumed per dollar of gross domestic product grew slightly in 2010, the first increase after steady declines for more than half a century.”

Notice that:

  • No, there really wasn’t a great cosmic coincidence that caused energy intensity to progress at a uniform rate from 1950-1970 and 1980-2009, despite the impression given by the arrangements of points on the wire.
  • The baseline of the original was apparently some arbitrary nonzero value.
  • The original graphic vastly overstates the importance of the last two data points by using a nonuniform time axis.

The issues are not merely aesthetic; the bad graphics contribute to distorted interpretations of reality, as the caption above indicates. From another graphic (note the short horizon and nonzero baseline), CP extracts the headline, “US carbon intensity is flat lining.”

From any reasonably long sample of the data it should be clear that the 2009-2011 “flat lining” is just a blip, having little to do with the long term emission trends we need to modify to achieve deep emissions reductions.

The other graphics in the article are each equally horrific in their own special way.

My advice to analysts is simple. If you want to communicate information, find someone numerate who’s read Tufte to make your plots. If you must have a pretty picture for eye candy, use it as a light background to an accurate plot. If you want pretty pictures to persuade people without informing them, skip the data and use a picture of a puppy. Here, you can even use my puppy:

Diagramming for thinking

An article in Science asks,

Should science learners be challenged to draw more? Certainly making visualizations is integral to scientific thinking. Scientists do not use words only but rely on diagrams, graphs, videos, photographs, and other images to make discoveries, explain findings, and excite public interest. From the notebooks of Faraday and Maxwell to current professional practices of chemists, scientists imagine new relations, test ideas, and elaborate knowledge through visual representations.

Drawing to Learn in Science, Shaaron Ainsworth, Vaughan Prain, Russell Tytler (this link might not be paywalled)


However, in the science classroom, learners mainly focus on interpreting others’ visualizations; when drawing does occur, it is rare that learners are systematically encouraged to create their own visual forms to develop and show understanding. Drawing includes constructing a line graph from a table of values, sketching cells observed through a microscope, or inventing a way to show a scientific phenomenon (e.g., evaporation). Although interpretation of visualizations and other information is clearly critical to learning, becoming proficient in science also requires learners to develop many representational skills. We suggest five reasons why student drawing should be explicitly recognized alongside writing, reading, and talking as a key element in science education. …

The paper goes on to list a lot of reasons why this is important. Continue reading