Wednesday, December 31, 2014

Use Your Models, Don't Believe in Them!

I formulated this principle when I was programming mathematical models of financial markets. I noticed that my colleague who generated the models (that I then implemented) was never particularly attached to them. He would run them so long as they were indicating profitable trades, and then abandon them when they stopped. I was also writing Economics for Real People at that time, and grappling with the issue of the relevance of mathematical models in the economic world. Noticing the modelers attitude, one day I asked him, "Would you say that our practice is to use our models, rather than to believe in them?"

"Absolutely," he replied.

Mary Morgan's book reaches a similar conclusion.

Models: What Are They Good For?

"Writing down a model and manipulating it allows economists to think through in a consistent and logical way how a number of variables might interrelate, and to find solutions to questions about such systems. This habit of making and using models extends the powers of the mind to ask questions and explore the answers in complicated cases." -- Mary Morgan, The World in the Model, p. 258

Tuesday, December 30, 2014

Hayek abandoned methodological individualism

"In his work on the evolution of social orders, Hayek thus abandons the individualist methodology he proposed in the wartime writings, thereby rectifying the inconsistency that that precept implied for the system of his thought." -- Andy Dennis, "Methodological Individualism and Society: Hayek's Evolving View," in Austrian Economic Perspectives on Individualism and Society, p. 18

That is correct.

Naturalism

Now, no one has a patent or copyright on the use of the word "naturalism," so anything one says about what it means can be contradicted somewhere in the works of people who call themselves adherents of naturalism. Therefore I am just going to describe a typical view that I have seen out there: "Nothing exists except the sort of things described in the theories of physics." (That exact definition of naturalism is not given in the Wikipedia entry, but I know I have seen it stated: if this were an academic paper, I would go hunt down the exact place I saw it, but this is just a blog post.)

There is a rather obvious incoherence in this idea: One of the things that is very much not described by the theories of physics is.. the theories of physics. (These theories are about quarks and electrons and photons and forces and so on: they never are about theories themselves, or how theories come to exist, or causal relationships between theories, etc.) Therefore, the theories of physics are not real entities in the world. So naturalism, in this version, essentially says, "The only real things are the things in that box over there, which, by the way, does not exist."

This is why when Keshav, for instance, tells me that "But naturalists often believe X," I tell him that this is beside the point: once you have excepted a contradiction at the core of your philosophical thought, all bets are off: you might as well throw in whatever other ideas seem convenient as well, since logic has been tossed out the window.

And I don't for a second think that this is some novel discovery of mine: many, many philosophers have pointed this out previously. I am just doing my small bit to stem the tide of nonsense.

Pygmalion comes alive

I actually had an economist tell me the other day that "utility" is a real "thing" out there in the world, and not just a theoretical construct to help economists understand it! Mary Morgan, in The World in the Model, has some good quotes explaining how this sort of thing happens:

"(The triumph of modelling) has created a perspectival change in the way economist view their field: they began by looking at the economic world through the lens of their models and ended by seeing their models in the world" (379).

"in the process, those small world models of their science became so familiar to economists that now, when economists look at their small mathematical models they see the real world, and when they look at that big real world they see it is a sequence of their small models" (409).

You know how when you spend enough time staring at a white circle on a black page, and then look away, you see an after-image as if it is out there in the real world? Well, that.


Monday, December 29, 2014

If you treat your postulates like hypotheses, you wind up talking nonsense

Physics postulates a world explicable under the category of measurable quantities. Any such quantities it finds will be deemed "physical." The fact that everything physics finds is explicable in terms of the physical is not a hypothesis that physicists are testing, it is an assumption of their science.

As such it is ridiculous to point to the work of physicists as "evidence" for a philosophy which one may refer to as "naturalism." It is not a flaw of physics or physicists to make this assumption. What forms any particular science is the set of postulates which it makes about the world, and through which it proceeds to investigate the world as it is seen under those postulates. But it is a mistake to forget that these are postulates and not discoveries.

Consider an episode like the discovery of the weak nuclear force. Certain measurable phenomena cannot be explained through any of the other known forces. These phenomena have weird characteristics: certain parities that are usually maintained are violated, and quarks change their flavor. So physicists postulated the existence of a force that would produce these phenomena.

Now perhaps what was "really" going on was the God, having nearly finished creation, thought to himself, "I can foresee these people called physicists, who are going to think their theories explain everything. So let me continually cause the universe to behave in such a way that certain parities are regularly violated, and quarks change their flavor. That should shake them up."

So long as God did this in a measurably regular way, what we would see would be no different than if these things are caused by a "weak nuclear force." But physicists proceed by postulating things like heavy bosons and a weak nuclear force. One may protest, "But physicists are able to draw new predictions from their idea of these phenomena arising from a force!" That is great, and it is why physicists should continue to postulate forces. But the end result is not distinguishable from a case in which God was "fiddling" around with things in a regular, predictable way that hinted at further regularities to be detected.

Or consider the partial confirmation of Bell's theorem by Aspect et al. One might view this result and conclude, "Well, God just keeps these spatially separated particles correlated." But what many physicists have decided is that "local realism" is false. Now, local realism was a linchpin of the very idea of a "physical world," which is why Einstein and his colleagues proposed their original thought experiment, intending it as a way of showing that quantum mechanics must be incorrect in some way. But in the face of Bell and Aspect, what most physicists have done is simply to alter their idea of what "physical" reality is like.

Once again, I am not criticizing physicists for proceeding in this fashion: this way of proceeding is the very thing that creates physics as a distinct world of ideas. What I am pointing out is that is no more significant that physicists find everything in the world of physics explicable by physical principles than it is that Swahili speakers find everything in their world adequately described in the Swahili language. Swahili is, I am sure, a fine language, and I bet it describes the world quite well. But it would be a terrible error to leap from that fact to the conclusion that the world is actually built out of Swahili words and phrases.


An Observable, Reproducible Supernatural Phenomenon

I heard this phrase on some show that was touting the reality of the "supernatural." It is a bit of silliness that plagues both skeptics of and believers in the supernatural.

The silliness consists in this: Anything observable and reproducible will be considered natural. When quantum physicists discovered wave-particle duality or non-local effects, things that had never been considered "natural" before, did they declare these things "supernatural"? No, they just said, "Well, nature is stranger than we thought."

I am not trying to comment on the existence of the "supernatural" here: I am just noting that asking for or hoping for scientific evidence of the supernatural is absurd: whether or not any such thing as the supernatural exists, there will never be scientific evidence for it, because every sort of thing for which scientific evidence exists will be incorporated into the "natural."

Saturday, December 27, 2014

Edgeworth Boxed!

Through the most difficult part, I think: the agents trade their goods until they reach an equilibrium. Here is the Python code that does this, formatted by Blogger, which seems to always want to reduce two spaces to one:

"""
edgebox_model.py
An Edgeworth Box model where two agents trade goods.
"""
import logging
import entity
import spatial_agent

TRADE = "trade"

WINE = "wine"
CHEESE = "cheese"

GAIN = 1
LOSE = -1

Accept = True
Refuse = False


def util_func(qty):
    """
    Later, we want to be able to pass in arbitrary util funcs for each good-trader combo.
    """
    return 10 - .5 * qty


class EdgeboxAgent(spatial_agent.SpatialAgent):
    """
    Agents who attempt to trade goods to achieve greater utility.
    We are descending this from SpatialAgent, because later on we want
    traders who can detect local prices but may not know about distant ones
    """

    def __init__(self, name, goal=TRADE):
        super().__init__(name, goal, max_detect=1000.0)
        self.goods = {}
        self.utils = 0


    def act(self):
        """
        Act is called in an interactive loop by code in the base framework
        """

        potential_traders = self.survey_env(TRADE)       
        for t in potential_traders:
            logging.info("Potential trader for "
                    + self.name
                    + " (who has " + " ".join(self.list_goods())
                    + " and utils of " + str(self.utils)
                    + "): " + t.name)
            for g in self.goods:
                if self.goods[g]["endow"] > 0:
                    logging.info(self.name + " is offering " + g + " to " + t.name)
                    t.rec_offer(g, 1, self)


    def endow(self, good, endow):
        if good not in self.goods:
            self.__add_good(good)
        self.goods[good]["endow"] = endow
        for i in range(1, endow):
            self.utils += self.goods[good]["util_func"](i)

        self.pretrade_utils = self.utils


# for the moment all offers are of 1 unit!
    def rec_offer(self, offer_good, amt, counterparty):
        """
        Agent has received an offer of a good, and loops over her goods to
        see if there is a profitable trade. If 'yes,' make a counter-offer.
        """

        util_gain = self.__marginal_util(offer_good, amt, GAIN)
        logging.info(self.name
                + " is looking at a util gain of "
                + str(util_gain)
                + " for good "
                + offer_good)
        for g in self.goods:
            if (g != offer_good) and (self.goods[g]["endow"] > 0):
                util_loss = self.__marginal_util(g, 1, LOSE)
                logging.info(self.name
                     + " is looking at a util loss of "
                     + str(util_loss)
                     + " for good "
                     + g)
                if (util_gain + util_loss) > 0:
                    if(counterparty.rec_reply(
                            offer_good, amt, g, 1, self) is Accept):
                        self.trade(g, counterparty, offer_good)
                        return Accept


    def rec_reply(self, my_good, my_amt, his_good, his_amt, counterparty):
        """
        This is a response to a trade offer this agent has initiated
        """

        util_gain = self.__marginal_util(his_good, his_amt, 1)
        util_loss = self.__marginal_util(my_good, my_amt, -1)
        return (util_gain + util_loss) > 0


    def list_goods(self):
        goods_list = []
        for g in self.goods:
            goods_list.append(g)
        return goods_list


    def trade(self, my_good, counterparty, his_good):
        """
        We actually swap goods, and record the trade in the environment
        """

        logging.info(self.name + " going to trade " + my_good + " for " + his_good)

        self.__gain_lose_good(my_good, LOSE)
        self.__gain_lose_good(his_good, GAIN)
        counterparty.__gain_lose_good(his_good, LOSE)
        counterparty.__gain_lose_good(my_good, GAIN)

        self.env.record_trade(1)


    def util_gain(self):
        return self.utils - self.pretrade_utils


    def __gain_lose_good(self, good, gain_or_lose):
        self.utils += self.__marginal_util(good, 1, gain_or_lose)
        self.goods[good]["endow"] += gain_or_lose


    def __marginal_util(self, good, amt, gain_or_lose):
        g = self.goods[good]
        if gain_or_lose == GAIN:
# we are calling our utility function stored in a dictionary here:
            return g["util_func"](g["endow"] + 1)
        else:
            return -(g["util_func"](g["endow"]))


    def __add_good(self, good):
        self.goods[good] = {"endow": 0, "util_func": util_func}


class EdgeboxEnv(spatial_agent.SpatialEnvironment):
    """
    Contains goods and agents who exchange them.
    """

    def __init__(self, length, height, model_nm=None):
        super().__init__("An Edgeworth Box", length, height, model_nm=model_nm)
        self.do_census = False
        self.trades_this_turn = 0


    def step(self, delay=0):
        super().step(delay=delay)
        self.user.tell("Trades this period: " + str(self.trades_this_turn))
        for a in self.agents:
            print(a.name + " has gained " + str(a.util_gain()))

# any return other than "None" from the step function breaks the interactive loop
        if self.trades_this_turn <= 0:
            return("We've reached equilibrium.")

        self.trades_this_turn = 0

   
    def record_trade(self, amt):
        self.trades_this_turn += amt

Friday, December 26, 2014

Modeling can highlight real-world difficulties

So I'm making a model of agents who might exchange goods. The initial idea is to have utility function for each good they might have or obtain, as well as a present endowment of each good (which may be zero). Now, for an Edgeworth Box, my initial price model, this is easy: we only have two goods, and we know what they are in advance.

But eventually, we would like to have agents discover goods on the market that they know nothing about before encountering a potential seller. So how can they have a utility function for a good before they know it exists? (I have not solved this problem in my model, although I have ideas.)

In fact, this reflects a problem that actual market actors face: how can they know how much they want of, or what price to pay for, a good they have never encountered before? As my mentor Israel Kirzner has noted, markets inherently involve discovery.

Thursday, December 25, 2014

General solutions to coding problems often take little more time than specific solutions

I am now coding up an Edgeworth Box model, in which two agents will trade goods until they reach an equilibrium distribution. Now, in the Edgeworth Box, there are only two agents, and each of them only has one good to start with.

But there is no need to program those latter two facts into the model: it is pretty much every bit as easy to code a model with N agents and G goods, and let this particular model be a special case where it just so happens that N = 2 and G = 2. It will only add a couple of lines coding to this round to make this code more generalized, while saving me a great deal of work in the future.

Tuesday, December 23, 2014

Exploring a model

As Mary Morgan notes in The World in the Model, one of the things we do with models is explore them, and hope that exploration tells us something about the world outside the model as well.

I appreciate this more and more as I experiment with my agent-based models. Look at the following graph of a run of Adam Smith's fashion model:

There are several very interesting things here:

1) Why does the number of followers wearing blue only once drop below the number of trendsetters wearing blue?

2) And why does that drop happen in the second period of the cycle? If I was going to get some one-off behavior from the model, I'd expect it in the first cycle, not the second.

3) And just why is that first cycle so minor compared to the others?

4) And what is going with the trendsetters in that middle stretch where they don't really seem to cycle along with the followers?

Here is a larger point to take from this: Have you ever wondered why testing business cycle theories is difficult, and economists have not all agreed on a single one? Well, the above graph is produced by a very simple model with only a handful of parameters. Real business cycles obviously have essentially an infinite number of "parameters" feeding into what occurs. So that is why!

A Wise Man's Life

"The latter part of a wise man's life is taken up in curing the follies, prejudices, and false opinions he had contracted in the former." -- Jonathan Swift

And the same goes for my life!

Nash equilibrium bleg

Updated with an expanded quote:

"If we expand are small world [of the Edgeworth Box], we meet with considerably more difficulties. This expansion goes as follows. Suppose we had Albert's possession of money taken as a starting point, instead of his possession of cheese. And suppose that, after some bargaining, Beatrice is willing to give up to over bottles of wine in exchange for 100 of Albert's guilders. If Albert agrees, the border has resulted in the price of 50 guilders per bottle. That is the so-called equilibrium price. Other individuals, with the same convex characteristics as those of Albert and Beatrice, can now enter our small world and also bid for Beatrice's wine. We can also continue this process by exchanging money against all other goods. Thus, ultimately, it appears that it can be mathematically proven that, where there is free barter, equilibrium prices can be established for all goods. This is the so-called Nash equilibrium..." -- Arnold Merkies, quoted in Mary Morgan, The World in the Model, p. 102

I have never seen Nash equilibrium connected with general price equilibrium before. Economists, does this make sense?

Setting the start-up state of a program

As my agent-based modeling system develops, I am starting to hit the issue of how to uniformly and simply handle things like passing parameters into a program, reading initialization files, and saving program state.

I decided I had better read up on this and see how others have handled it. Searching brought up this article, but the writers seem like a couple of knuckleheads, and I am having a hard time understanding what they did

Monday, December 22, 2014

Perhaps you will git my humor

I try to put my changes up to my git repository. It says the push failed, and I should try to do a pull first.

So I run the pull command, and I get a message telling me I really ought to explain why the pull is necessary.

I felt like typing, "Well, git dude, perhaps you should tell me, because you just told me I ought to do it!"

Why Python overtook Perl

A decade ago, I used Perl quite a bit. It is a very handy language that makes it possible to do many things quickly and easily.

Python also allows the accomplishment of many tasks with a few lines of code. It has some weird features that continue to annoy me: having to explicitly declare 'self' as a parameter to every class method while never explicitly passing it is close to the top of the list.

Perl had a large head start on Python in terms of users and libraries. And yet Python seems to be passing it by. Why?

My tentative answer: while Perl is very useful, it is clunky and cobbled together.

Python, on the other hand, while it has its flaws, is beautiful.

Human beings are attracted to beauty.

Sunday, December 21, 2014

Updating the Christmas classics

We all love those familiar Christmas songs around this time of year. But let's face it, their themes don't resonate with the modern listener like they did with those of the past.

So here is my first effort to incorporate more modern charcters into these songs:

Rusty the blowman
Kept his twenties in a roll
With a runny nose and a glass crack pipe
And two eyes that never close

Rusty the blowman
Is a fairy tale, they say,
He was made of blow but the crackheads know
How he ran out one day.

But there must have been some powder in
That old dollar bill he found.
For when he placed it up his nose
He began to dance around!

O, Rusty the blowman
Was alive as he could be,
And the crackheads say he could laugh and play
Every morning until 5:30.

Saturday, December 20, 2014

Models

I am currently reviewing Mary Morgan's book, The World in the Model. (An excellent book, by the way, and one that shows the value of the history of economic thought for the practice of economics: economists who read it will, I think, have a much better understanding of what modeling is all about.)

At the same time, I am busy building agent-based models. It is propitious that these two things are happening at the same time: my own modeling makes me appreciate Morgan's insights much better. In particular, she notes that models are away to explore how the world possibly works by exploring how the model works. The nature of models as something to explore has, I think, been underappreciated. I am fascinated, in working with my model of Adam Smith's theory of fashion, to see how much the results coming out of the model change based on tweaking the assumptions going into it. For instance, changing the amount of time that agents will tolerate a fashion scene not to their liking has dramatic effects on the cyclical waves of fashion that emerge from the model.

Anti-police violence

Here.

American police are way too quick to resort to violence. The figures on the number of people killed by police in the US versus the rest of the developed world are startling. We need real reform here.

But demonizing the police as "thugs," "pigs," and so on is no path to reform. It is the path to low-level warfare between the police and those most alienated from our current system. The more hostility towards the police is promoted, the more reason the police will have to fear being killed when dealing with such hostile people, and the more quickly they will resort to violence. And in this struggle, there is no doubt who will come out ahead: The police have resources that those prompted to violence against them simply lack.

Git documentation

Current, in a comment, shared this wonderful parody of git documentation. The unfortunate thing is that the actual git documentation is only a tiny, tiny bit more comprehensible then this spoof.

Also, from this and other comments arises a question: is every single regulat reader of this blog except for Bob Murphy a programmer?

White Privilege

Thoreau has a good post on this topic.

99% of the time I have heard the term used, it is a way for very privileged white people to show how superior they are to less privileged white people. For instance, it is a very good way for tenured professors (an extremely privileged class) to bash working class whites. In the struggle of the elites currently underway in the United States, it serves a very useful purpose: if working class whites can be convinced that they are actually "privileged," then maybe they won't notice how all three of the elite factions in the struggle are screwing them over.

Friday, December 19, 2014

Christmas reading recommendations

I recommend British idealism: A guide for the perplexed at The American Conservative Christmas reading list.

Obscure, I know, but at least I didn't recommend the Python Cookbook!


Somethings I really don't get

I can understand someone robbing a store. Not that I approve, but it is perfectly comprehensible: they want money, and the store has it. I can even comprehend attacking a store employee who gets in your way. but attacking a baby in the store you were robbing?

Was he afraid the baby might testify?

Thursday, December 18, 2014

Programmer bleg and rant: Adrift in the amateurish world of open source

Open source software is nice in that it is free, and there are lots of great tools out there. But I'm not sure if developers, often upset by the fact this free software has not swept the field, are aware of how amateurish the design of the user experience often feels.

I installed Ubuntu Linux on my Chromebook. (The operation of the Ubuntu GUI itself is very buggy, and it has the same "sophisticated" GUI-look of, say, Windows 3.) Then I began using 'git', a source-code control tool, to place my code in an online repository.

The git documentation is pretty terrible: it is written by experts who cannot recall what using git was like when they started out. In other words, if you already know the system well and have forgotten some detail, it is probably excellent, but if you are trying to learn the system, it is incomprehensible.

Worse yet, when a command just failed, I tried to pull up help for the command, and found that this attempted to display a 'man' page... but my Ubuntu installation came without the man command! ('man' is the standard command-line help system for UNIX.)

Ah, but the fellow who wrote the page telling me how to install Ubuntu talked about this! Great, he says to use 'apt-get.' So I try 'apt-get install man' only to find that apt-get only installs "packages." So, Ubuntu has left out one of the most basic UNIX commands, and now I have to go hunting for what "package" it is in. Ah, but there is a search tool for packages. I type 'man' in that... and get dozens and dozens of hits, most of which appear to be games.

So I am now fifteen minutes distant from starting my original task, which was trying to check in my new code, and instead am searching for how to get help on how to get help on how to install the basic UNIX command for getting help!

Open sourcers, this kind of rigmarole is not going to woo the average Windows or Mac user!

My bleg: Can any of you nice programmers out there tell me how to get 'man' onto my Ubuntu system?

Adam Smith's fashion cycle, ABM version


So my agent-based modeling system has succeeded in capturing the dynamics of Adam Smith's fashion cycle. Let's start with Smith's description of how fashion works:
Fashion is different from custom, or rather is a particular species of it. That is not the fashion which every body wears, but which those wear who are of a high rank, or character. The graceful, the easy, and commanding manners of the great, joined to the usual richness and magnificence of their dress, give a grace to the very form which they happen to bestow upon it. As long as they continue to use this form, it is connected in our imaginations with the idea of something that is genteel and magnificent, and though in itself it should be indifferent, it seems, on account of this relation, to have something about it that is genteel and magnificent too. As soon as they drop it, it loses all the grace, which it had appeared to possess before, and being now used only by the inferior ranks of people, seems to have something of their meanness and awkwardness.
We add a slight tweak to the above in our model: the reason that those of "high rank" change their fashion is precisely because the "inferior ranks" are adopting it in great numbers. This appears to us a reflection of reality. Then we have a variation of the predator-prey model, where the "predators" are the fashion followers, and the "prey" the trend-setters. We simplify things by having only two fashions, red and blue. The followers all wear blue to start, and the trend-setters all red. We then set agents wandering at random on the Cartesian plane, and have them look around after every move. If they are a follower, and they see lots of trend-setters in their vicinity wearing a different color than them, they record this fact. If that situation continues for a few turns, they switch to what they take to be the "trendy" color.

The trendsetters behave roughly the same, but evaluate their circumstances in the opposite way: when they see too many followers wearing their color for too many turns, they switch to the other color. (How many is "too many" or "lots" are parameters that have interesting effects.) These simple rules produce the following pattern of "fashion waves":


Sunday, December 14, 2014

A marvel of economics…

Is how little understanding there is of the existence of the firm. The fact that there are at least four rival theories in economics explaining its existence is symptomatic of the darkness prevailing in this area.

When the average person thinks of "the economy," perhaps the first thing they think of is "businesses." But economics cannot yet explain the existence of these businesses.

Saturday, December 13, 2014

The world of physics is an abstract world and not the whole of reality

As Ed Feser notes:

"As I have emphasized many times, what physics gives us is a description of the mathematical structure of physical reality. It abstracts from any aspect of reality which cannot be captured via its exclusively quantitative methods. One reason that this is crucial to keep in mind is that from the fact that something doesn’t show up in the description physics gives us, it doesn’t follow that it isn’t there in the physical world. This is like concluding from the fact that color doesn’t show up in a black and white pen and ink drawing of a banana that bananas must not really be yellow. It both cases the absence is an artifact of the method employed, and has nothing whatsoever to do with the reality the method is being used to represent. The method of representing an object using black ink on white paper will necessarily leave out color even if it is there, and the method of representing physical reality using exclusively mathematical language will necessarily leave out any aspect of physical reality which is not reducible to the quantitative, even if such aspects are there.

"But it’s not just that such aspects might be there. They must be there. The quantitative description physics gives us is essentially a description of mathematical structure. But mathematical structure by itself is a mere abstraction. It cannot be all there is, because structure presupposes something concrete which has the structure. Indeed, physics itself tells us that the abstraction cannot be all there is, since it tells us that some abstract mathematical structures do not fit the actual, concrete material world. For example, Einstein is commonly taken to have shown that our world is not really Euclidean. This could only be true if there is some concrete reality that instantiates a non-Euclidean abstract structure rather than a Euclidean abstract structure. So, physics itself implies that there must be more to the world than the abstract structure it captures in its purely mathematical description, but it does not and cannot tell us exactly what this concrete reality is like."

Come get your agent-based modeling here!

Here.

Indra is an agent-based modeling system written in Python and available for download. I just finished coding Adam Smith's fashion model using it, and one of my students is going through Schelling writing up his models using it. Contact me if you would like to try the system, and I will help you get going.

Friday, December 12, 2014

Programmer bleg

I realized that two of my classes were going to use a function identical in all respects except that one of them would test for amount x being greater than amount y, while the other would test for x being less than y. Right now, I have coded the function to accept a boolean parameter I call "gt" which controls an if statement as to which test the function does. But what I really wanted to do was to pass in the operator to use itself.

However, generally speaking, programming languages do not accept operators as parameters to functions.

Is there a way to do this without the if statement?

The genius of Ken Thompson and Dennis Ritchie

How many pieces of technology developed 45 years ago are now more popular than ever?

I thought about this while running some UNIX shell commands in Linux (based on UNIX), which I am running as a alternate operating system on my Chromebook to ChromeOS (based on UNIX). So I picked up my iPhone running iOS (based on UNIX) to write this post, which I will put on Facebook, which runs on UNIX-based servers. Some of my friends will read my post on their Android phones, which run an operating system based on UNIX. Others will read it on their Macintosh computers, which run an operating system... based on UNIX.

And the really amazing thing here is that the work of Thompson and Ritchie endured several decades of ridicule before becoming the most ubiquitous piece of software in the world. And the reason for its success is intimately connected to their humility: instead of believing that they knew everything a user would want and building it into a monolithic operating system, they built a minimal framework within which it was very easy to add your own tools. They crowd-sourced the development of their operating system well before anyone had invented that term.

Agent-based modelling and the vindication of Mises

I've been reading agent-based modelling (ABM) literature the last week, and I am struck by its vindication of Mises's vision of economics. It turns out that to get phenomena like markets, firms, and market-clearing prices, the modelers only have to build agents that:

1) have a purpose
2) have some idea how to achieve it, even if that idea is sub-optimal
3) interact with other agents; and
4) face scarce resources.

Well, folks, this is nothing less than the basis of Mises's much reviled "praxeology." Mises just lacked the tools to formalize his vision, but they are here now.

Tuesday, December 09, 2014

Why is it difficult to detect bugs in agent-based models?


Rob Axtell, in his 2000 paper "Why agents? On the Varied Motivations for Agent Computing in the Social Sciences," attributes the existence of what he calls "artifacts" (program behavior that is not a part of the model being created, but a byproduct of a coding decision which was intended only to implement the model, but actually did something else as well) "partially" to the fact that, in agent models, a small amount of source code controls a large amount of "execution" code. As an example, he offers a system where millions of agents may be created and which might occupy up to a gigabyte of memory, even though the source code for the program is only hundreds of lines long.

But this explanation cannot be right, because the causal factor he is talking about does not exist. In any reasonable programming language, only the data for each object will be copied as you create multiple instances of a class. The functions in the agent-object are not copied around again and again: they sit in one place where each agent "knows" how to get to them. What causes the huge expansion in memory usage from the program as it sits on disk to the program running in RAM is the large amount of data involved with these millions of agents: each one has to maintain its own state: its goal, its resources, its age: whatever is relevant to the model being executed.

So what we really have is a small amount of code controlling a large amount of data. But that situation exists in all sorts of conventional data-processing applications: A program to email a special promotional offer to everyone in a customer database who has purchased over four items in the last year may control gigabytes of data while consisting of only a few lines of source code. So this fact cannot be the source of any additional frequency of artifacts in agent-based models.

So what is really going on here? (And I have no doubt that something is going on, since Axtell's basic point that we have to take special care to watch for these artifacts in agent-based models is surely correct.) I have done both traditional IT-type coding and agent-based modeling, and here is what I think is the main difference between the two in terms of the production of these artifacts: artifacts in both cases are the result of programming errors, but in the latter case, when you don't know what your output should be, it is very hard to distinguish them from interesting and valid results.

In most traditional data processing, it is easy to say just what the result should be: they are what your user told you they should be. (This "user", of course, may be a multitude of users, or even an imagined multitude of users you hope your new product will appeal to.) If you were asked to write the above program, that will email a special offer to customers who purchased over four items in the last year, it is easy to tell if your program is working: did those customers, and only those customers, receive the promotion, and only the promotion? Although you were writing the program to save going across the million customer database records by hand and generating the emails, you can easily select a small portion of the database and check your program by hand against that portion. If it is working for that portion, and it is a representative sample, you can assume it will work across all records. Or you can automate that process itself with a test suite, which contains a certain number of cases with known correct output, that your program's results can be checked against. (Of course, even this testing does not ensure the absence of bugs: there may be special cases in the full database that we omitted from our test data. Perhaps, for instance, for some customers, multiple orders were rolled into one for shipping purposes. The intention of the marketing department might be to still send them the special offer, but if we missed putting any such customers in our test cases, we may not detect that our code fails in these instances.)

But at least for Axtell's third type of agent-based model, the very reason we are writing the program is that what we don't know what the results of running it ought to be. We are using the program to explore the implications of the model, in a case where we don't know beforehand what those implications will be. This is not fundamentally different from what Ricardo did with his model farm (see Mary Morgan, The World in the Model, on this point), but while Ricardo was limited to using a limited number of simple cases where he could do all the necessary calculations by hand, by using a computer, we can easily test millions of more complicated cases.

We hope our code implements our model, and only our model. But we can easily make a mistake through a seemingly innocuous coding decision: for instance, as Axtell notes, the order in which agents act can be important in many models. If we write a simple loop proceeding from agent 1 agent N, we may give the agents earlier in our list a decided edge in something like grabbing resources for their own use. We might have to randomize the order in which agents act in every "period" of the test run to truly capture the model. If we fail to account properly for this fact, we might mistakenly think that these agents had some superior resource-capturing feature, instead of realizing that they are only "rich" because we (arbitrarily) stuck them early on in a list of agents.

If I am correct about the main source of these artifacts, then what are we to do about the problem? Although I have just begun to think about this problem, I do have one suggestion already: we can do something similar to what is done in more traditional IT programming: examine small test cases. But since we don't know the "correct" output, the procedure to do so will be somewhat different. In our early runs of our system, we can use a very small number of agents, and proceed step-by-step through our run, with lots of debugging information available to us. This allows us to get an intuitive feel for how the agents are interacting, and perhaps spot artifacts of our coding choices early on.

But while this is a help, it falls far short of the kind of systematic checking of our code that we can achieve with test suites for more typical IT problems. Is it possible to create a more automated method of detecting artifacts? Well, at this point, all I can say is that I am thinking about it.

Thoughts on software and hardware

There is no essential difference between software and hardware except the economic difference. The people who put forth metaphors such as "hardware is like the brain and software is like our thoughts" apparently have no understanding of how computers work.

Everything that is done in software can be done in hardware. In fact, the way software works is by reconfiguring the hardware. The introduction of the programmable computer was the invention of a machine that could be endlessly reconfigured without having to actually take tools to it and physically adjust its parts. And various features of computers have at various times moved from hardware to software or the reverse: The original Macintoshes could get by with so little RAM because a lot of the operating system was actually put into the hardware. The real difference between software and hardware is that it is cheap to reconfigure software and expensive to reconfigure hardware.

So software is simply a way to cheaply and continually reconfigure an electronic machine into new states. Those states by themselves have no meaning: any state could represent an attempt to solve a differential equation, a position in a chess game, or a line of music, depending upon what its users intend it to mean. The "analysis" of a chess game by a computer could be hooked up to a synthesizer and treated as a musical composition instead.



The chief impetus of new political movements...

Is a rising elite trying to seize control of power from an existing elite. The ideas they use to gain their followers commitment and enthusiasm are what Pareto called "derivations": secondary phenomena of secondary importance.

Monday, December 08, 2014

Idealism to the rescue!

Both "the right" and "the left" suffer from a one-sided focus on an aspect of poverty at the expense of the full picture. The right focuses on agency, and tends to dump the entire blame for their condition on the poor, failing to keep in mind adages like, "There but for the grace of God go I!"

The left tends to focus exclusively on circumstances, which winds up denying the poor any agency themselves, and portrays them like shelter animals waiting for a good progressive to come along and adopt them.

The reality is that both views are partial truths, each of which needs the other to round out the picture.

Although Hegel was somewhat mad at times, teaching us to look at these supposedly irreconcilable divides like this was surely a great contribution to human thought.


Sunday, December 07, 2014

Not getting the concept

There are ads running now during the football games saying that "every kid has to play, 60 minutes a day."

So "play" is now a duty that has an allotted time scheduled for it in a day full of other duties.

Friday, December 05, 2014

Forgetting Mises When Doing Comparative Political Economy


In the field of Constitutional Political Economy, analysis often starts from the assumption that "political agents act to fulfill their interest just like everyone else."

But then the analysis immediately assumes that the interest of political actors consists solely of seeking monetary gain. Since most of the people I read working in this area (for instance, this post is inspired by a paper I am currently refereeing in this field) are at least passingly familiar with Austrian economics, this is a somewhat surprising assumption.

One of the things Mises was surely correct about is that "pursuing one's interest," if it is to be a priori true of all agents, must be interpreted extremely broadly. In this sense, as Mises taught us, "one's interest" must include anything that might motivate an agent to act: an aescetic's efforts to abjure all worldly goods, a hero's noble sacrifice of his life for his comrades, and a serial killer's attempts to create as much destruction and suffering as possible, are all examples of agents acting in "their own interest" in this broad sense. Mises was entirely dismissive of the idea that acting in one's own interest could only mean pursuing material gain. And yet, I keep encountering papers that seem to equate the two, from people who I would think ought to know better.

When someone presented a paper at NYU equating "a political agent pursuing his interests" with his "maximizing the revenue he can draw from his position," I offered two notable examples of quite different behavior, and could have offered many more if time had permitted.

My first case was Alexander the Great: if he had merely wanted to maximize the wealth he could extract from his realm, after conquering Persia, he would have simply stopped his campaign, and enjoyed the fabulous wealth of the Persian Empire. But Alexander was obsessed with becoming the greatest warrior-king who had ever existed, and so continued eastward well beyond any point of "revenue maximization."

On the other hand, Ashoka, a king in India, converted to Buddhism (or at least began to support it strongly: there is some historical debate here) after being filled with horror at the deaths resulting from his Kalinga War. In any case, he began to promote Buddhism, erect Buddhist monuments, and do things like use his wealth to establish healthcare facilities for his subjects.

Another obvious counter example would be Hitler: once he had acquired the Rhineland, Austria, Bohemia, and half of Poland, he had a whole lot of territory from which to draw revenue. But his racial obsession would not allow him to stop at that point, leaving him to make decisions that, from a revenue-maximizing point of view, were quite insane.

In Misesian terms, all of three of these rulers were "pursuing their own interest." But the interests that political agents can embrace are no less diverse than those of any other agent.

Now, I have no problem with someone creating a model that assumes political agents are "personal (monetary) revenue maximizing," and seeing what results that model yields. But the papers I have read in this field generally do not do that: they seem to simply assume that what political agents pursue must be gains in material wealth. And I do not see any warrant for that assumption.

Thursday, December 04, 2014

"Anonymous" Refereeing

I have been asked to referee, I'd guess, about 15 papers. In almost every case I have figured out who the author is before finishing the paper, sometimes just by glancing at the bibliography. ("There is no way anyone but Jones would cite Jones 15 times!")



By their euphemisms you shall know them

I'm watching the Belgian TV series The Break . Not bad, but... At several points the subject of abortion comes up. The characters say...