© Copyright JASSS

  JASSS logo ----

Michael Agar (2003)

My Kingdom for a Function: Modeling Misadventures of the Innumerate

Journal of Artificial Societies and Social Simulation vol. 6, no. 3

To cite articles published in the Journal of Artificial Societies and Social Simulation, please reference the above information and include paragraph numbers if necessary

Received: 1-Jun-2003      Published: 30-Jun-2003

* Abstract

In this tongue-in-cheek commentary the author takes a serious look at the problem of translating ethnographic conclusions into simple functions as a means to the end of building an agent-based simulation in the Netlogo language. Specifically, the goal is to take the simple fact that stories about illicit drugs have a lot to do with whether or not they will be used and see if an agent-based model can produce an epidemic incidence curve under the appropriate conditions. This commentary has less to do with the model and more to do with figuring out what kinds of numbers make sense. Based on the principle that mathematical ignorance is bliss, the author concludes that the most important thing is that number construction reflects the differences that make a difference in the ethnographic work, where the discovery of what the significant differences in fact were was a major result of the research. Support by NIH/NIDA grant DA 10736 is gratefully acknowledged.

Agent-based Models; Drug Use; Epidemiology; Ethnography; Netlogo

* Introduction

The world of agent-based modeling is ethnographically seductive. Epistemological compatibility between real world research process and abstract language is better than statistics and systems models. As usual though, God, the devil and several other troublemakers are in the details. As one goes from ethnographic understanding to model architecture, how does one translate from an explanation that rests on layers of tacit and fuzzy knowledge to a coded rule, variable, or even, God forbid, a number?

This is a more interesting version of the so-called "quantitative/qualitative" debate, or at least I think it is. Usually the debate recapitulates some version of Newton vs. Hegel. The version presented here isn't really a debate about epistemological incompatibility. Instead, it is more a translation problem that, like most difficult examples of the genre, can result in a poor solution that distorts rather than enhances communication. This is the problem I'd like to explore here.

The translation problem is about a mapping from natural language explanation to a computer-language version. It is about making numbers out of words. Translated into computer language, it is the search for functions, ways to have numbers influence each other just like humans are influenced by interactions among their thoughts and feelings, whether conscious or not, and then by interactions with each other.

For the unwashed mathematician, like this author, it's like translating from English into Mandarin when your second language is German. There is, as most JASSS readers know, a well developed language of functions. I started to learn it in a calculus course in college, but it was the 1960s. Science was a lackey of the running dogs, so I went into anthropology instead. In anthropology if you numbered your pages the professor would call you a reductionist. And imagine the irony when anthropology, in the 1980s, decided that it too was a lackey of the running dogs because of its associations with colonialism. But that's another story.

So I know I could do this job better had I had a proper math education. But the issues I want to tackle here are for the most part more basic than that. They're at the level of proto-math.

Here is the background. For several years now Heather Reisinger and I have been working courtesy of an NIH/NIDA grant on the nature of illicit drug epidemics (Agar & Reisinger 2001). One thing we learned, from living breathing people, was how important is the "buzz" around a particular drug (Agar & Reisinger 2000). What one heard--in stories, in gossip, in the media--played a major role in whether or not an illicit drug would diffuse. This may sound like Homer Simpson social science, but consider that it's seldom part of drug epidemiology, except perhaps by inference in descriptions of how important "peers" are in one way or another.

So, why not build an agent based model fuelled by buzz and see if it could produce the kind of incidence curves characteristic of real epidemics?

Courtesy of a visit to the Santa Fe Institute, I learned about the Swarm programming language. All you need to do before you learn Swarm is learn Java. I once learned how to program, in the language that was at the time the be-all and end-all of languages, Algol. The thought of learning a new language so that I could learn a new language drove me to seek clinical help.

Fortunately, I found Starlogo and experimented with a model with training wheels (Agar 2001). Then I found Dwight Wilson, a Swarm programmer, among other things, at Johns Hopkins University in Baltimore. Like anyone who lives in Baltimore, Dwight knew something about drugs.

Starting with my earlier Starlogo model, we put together a Swarm model, described in an article in Complexity (Agar & Wilson 2002). The details relevant for this article will be lifted out shortly. The basic idea is that a world of agents starts out with the same orientation to illicit drug use, more or less open to it, a variable called "attitude." Attitude changes depending on experience and on what an agent "hears" from other agents as it moves around the world.

Each agent also has a variable called "risk." Those values are set with a random-normal distribution, following the robust findings from many studies in diffusion of innovation (Rogers 1995).

The basic idea is simple: If an agent runs across some heroin, it compares its risk and its attitude. The latter, remember, is always changing with experience and with what it hears. If risk outweighs attitude, the agent uses heroin.

There is much more to tell about the model than just this, but for the moment I want to focus on what haunts me here-the problem of assigning numbers to things so that the model can run at all. I do so in the newer context of shifting the model to the Netlogo language, the most accessible modeling language currently available (Wilensky 1999). I am currently revising the model in that language.

* One Step Over the Line

Let's start with something simple. How many times must an agent use an illicit drug before it can be called "dependent" on that drug? Why does this matter? It matters because for biography and history both, seeing first- hand the way dependent people look and act is a major deterrent for most other people who are not dependent. At least this is true for drugs like heroin and crack cocaine and methamphetamine.

So the model represents this negative influence in a number of ways. For example, if a dependent agent shows up on a nearby patch, and the agent who notices isn't dependent, the encounter has a strong influence on the noticing agent's attitude. As another example, all agents have a network of other agents. If an agent becomes dependent, this immediately influences all of its network members and makes their attitudes more strongly anti-drug.

How should an agent know that it's gone over the line? No one knows for humans, except to say that it can vary a lot. Consider this passage, quoted from Elizabeth Wurtzel's book. Ironically enough, she is also the author of Prozac Nation:
So just try to think about the weather. The first day of winter is December 21. That's what the stargazers and meteorologists have told us since the beginning of the solar calendar. But what does that really mean to you? The first cold day was probably some time in October, and it was already consistently below freezing temperature since sometime after Thanksgiving, so what good is the date really? The solstice and the equinox show up reliably when they are supposed to, year in and year out, but the temperature does its own thing: There is an early spring or an Indian summer or autumn barely seems to happen at all. And it's like that with drugs: Even if you keep a record in your Filofax and you know the first time you did this or that, and then the second and the third and the ninth and the ninetieth, it is still difficult-no, impossible-to say when it went from casual use to a bad habit to a problem to abuse to addiction (2002:19).

The quote suggests a non-linear dynamic system for each agent, a model within a model, which would take the problem I'm worried about and push it down a level, so that's no solution here. It does suggest some genetic algorithms, though.

There is simply no way to translate, realistically, "crossing the line" from use to dependence into the model, at least not in a way that is generally true. But even though translation is impossible, I know that crossing that line makes for very different life, and so I want the line to make a difference in the model as well.

So what do I do? I make up a number of times that a drug is used and say that if an agent gets to that number it has crossed the line. It has gone from user to dependent. And what is that number? It depends on the drug. People say, for instance, that crack cocaine is hard to do just once in awhile. In a brief period of time, one either chases it all the time or gives it up. Heroin, on the other hand, people say one can use for a good while before physical dependence sets in and the serious problems begin. Different illicit drugs, different "addiction liabilities," as the biomedical types say in their jargon. Of course that's true for licit drugs as well-fewer people are dependent on aspirin when compared to benzodiazapines. Fewer people are dependent on chocolate than on alcohol. Actually I'm not sure about those last two sentences. We don't have much data on aspirin or chocolate.

And yet the line matters a lot. The shift from use to dependence is the shift from biography to biochemistry. When a person is dependent on something like heroin or crack cocaine, the chemical runs his/her life rather than the other way around. It is at this point that social and economic strategies reorient to chemical need. It is at this point that dependent persons visibly depart the local social world. First-hand observation of dependence, or stories about dependence from trusted peers, will almost always have a negative effect. Conversely, observations that dependence does not occur and that use is compatible with control over most of one's life might have a positive effect.

Given all these issues, the model has to contain some numbers to represent them. So, the Netlogo model has a slider, a variable that can be set before the program runs, called "uses-to-habit." It can be set to any value between 1 and 20. In the development work I am engaged in now, I usually set it to 5. Each agent keeps track of how many times it uses, and when that number gets to 5 that agent changes color-from red to blue-and turns into a dependent user. And now that blue agent has a major negative influence on other agents in its network and on other agents it runs across as they all move around in their world.

And how much influence does the blue agent have? Again, a number is called for. Attitude runs from 0 to 100. The lower the attitude, the more open an agent is to illicit drug use. A quick check on each tick of the program makes sure that no agent's attitude goes below 0 or above 100. You can love drugs or hate drugs at the extremes, but even fanatics have their limits.

Recall that one way a blue agent can influence another agent is by coming within range. How close is close enough? The program says roughly within a two patch range. I write "roughly" because an agent can be anywhere on a patch, and depending on where it is "two patches" might actually be three in one direction and one in the other.

So if an agent, who isn't yet blue, looks around and sees any blue agent, it revises its attitude upwards in shock at what the drug can do to you if you become dependent on it. An agent of course "sees" nothing and feels no "shock," but the language people use to describe their models anthropormophizes all the time. The best antidote is probably to be obvious about it rather than pretending it's not there, because it always is. The model is, after all, about "anthros," as in "anthropology."

I set the amount of attitude change at plus 40. Plus 40 is a lot in a 100 point range, but it "feels" like the change should be "a lot" because of stories I've heard over the years. Why not 50? I don't know. Half the range seems like too much. Besides, 40 is twice the amount that can happen with positive experience, and the same that can happen with negative experience, about which more in a moment.

So I'm left with numbers that signal a change from use to dependence, and numbers that represent influence on attitude. I can't really justify them in any absolute sense at all. But they do show that there's a difference between being either abstinent or a user and being dependent on a drug. That's true. And they do show that a personal encounter with a dependent person in your own world usually has a strong negative effect on your own attitude towards use of that particular illicit drug. Those things are true. So maybe I should just run the model millions of times with slow variations on the different numbers until it reliably does only what I want. Is it an agent based model if the agents are part of a programmer imposed screenplay?

Actually, the question anticipates an exploration of the phase space. Before tackling this question, let me show you one more function.

* Was It Good For You?

If an agent tries the drug, it evaluates the experience. If the agent is blue, it doesn't bother, because at that point it has no choice. It must continue to use. That's what "dependence" is all about, you keep doing it no matter what. At some point in the future the model should let dependent agents kick the habit, but right now I've got enough problems to worry about.

How does it evaluate the experience?

It depends on the drug. The model has two sliders where numbers are assigned to the drug before the program runs. One slider is called "Goodstuff?", and the other is called "Badstuff?". The sliders can be set to any value between 0 and 100.

Those numbers have the same problems as the numbers discussed in the previous section, namely, that in and of themselves they don't mean anything. But they do mean to be kind of a comparative quality rating, a product evaluation if you will. A high Goodstuff rating means that, for whatever combined reasons of nature and nurture, this drug is a highly attractive product in this world at this time. A high Badstuff rating means the opposite.

Notice how many different aspects of a drug are hidden under this number. In a full case analysis, we look at the historical conditions around a population and how they are changing. For some epidemics, the effects of the drug address psychological states brought about by those conditions. But for other epidemics, the drug itself is more alluring independent of history--the stimulants that provide a powerful and direct hit of dopamine to the pleasure centre are a case in point. And for some drugs at some times, they represent not only an effect, but also an opportunity in the underground economy.

So the number selected for Goodstuff and Badstuff collapses several things onto the same slider variable--physiological effects, psychic situation, economic circumstances, historical conditions. It's a loaded number, to say the least.

But the difference in the number does signal something that users talk about. In casual conversations about marijuana use, for example, stories will be told of good and bad experiences, but a lot of them will be good. Now change the scene to stories about PCP use, and the balance will shift. There is a difference in the good/bad evaluation of those two drugs, when compared with each other. And, of course, as many JASSS readers know--I'm not pointing any fingers here--a single drug experience can be both good and bad.

One story to illustrate, one that shows how complicated this number is: An ex-addict colleague said he and a partner were sitting on the edge of a bed. My colleague told us how he slipped the business end of the needle into a vein and squeezed in some heroin. As he fell sideways, the needle still in his arm, he said, just before he passed out, "This stuff ain't shit." We, the audience to his story, all laughed hysterically.

The stuff was very good indeed, way up there on the Goodstuff scale. It was also very bad, pushing my colleague into an overdose. And his comment was dope fiend panache of an earlier era, irony raised to the nth power--This stuff might be good enough to fly me into an overdose, but I'm not impressed. And the point of the story, in the conversation about research that defined its context, was to criticize any study of use based on self-reports.

How am I supposed to get all that into a number that means something? To quote my New Jersey colleague who told the story, "fuhgeddaboutit."

What I can do is try and make sure that the numbers plausibly reflect real differences in real drug effects. True, some people will use anything. Decades ago when I lived as a patient in an addiction treatment facility, a guy actually figured out a way to smoke a ping-pong ball.

And the numbers need to be tuned for different populations at different times. LSD was big among teens in suburban Washington in the early 1990s, but mostly among white suburban kids. Street kids I talked with said using LSD was crazy, because you lost control. Amphetamine in the 1970s was called "the poor man's cocaine." Middle and upper-middle class connoisseurs of powder cocaine looked down their noses at it, you should excuse the expression.

But even still, Goodstuff and Badstuff do show differences in quality of the experience that a particular drug is likely to produce when compared to others. So how does this work? Each time an agent uses the drug, it checks the experience. If it has a good experience, its attitude value drops. It becomes more likely that the agent has a risk value that is higher, and so it is more likely to use. If it has a bad experience, its attitude goes up, so it is less likely that an agent will have an attitude less than its risk, and therefore less likely that it will use. And of course, both things can happen at the same time.

The way this is done is simple. Each time an agent uses it generates two random numbers between 0 and 100. Then it checks to see if the numbers are less than Goodstuff, on the one hand, and Badstuff, on the other. So the higher the values of Goodstuff and Badstuff, the more likely good or bad will be true. And one more time--notice that both things can happen. Or that neither can happen. How can neither happen? Stories of first experiences with marijuana are legion. Nothing happened. Howard Becker wrote a famous article about it (Becker 1963).

So say it was good or bad or both. Now what? The experience should have an effect on attitude. What effect? If it's good, attitude should decrease. If it's bad, attitude should increase. Yes, if its' very very good attitude should decrease very very much, but the function doesn't handle that.

If it's good, attitude decreases by 20. Recall that attitude varies within a range of 0 to 100. Why 20? Let's not go there again. I will say that a change of 20 was the maximum value Wilson and I used in the earlier Swarm program, and it worked well. This is the highly sophisticated theorem known as, if it ain't broke don't fix it.

But the function is tweaked two ways. In the first way, the effect of a bad experience is twice as much as a good one. Another well-documented assumption in the model is that people are in fact risk-averse, as shown in the stream of work that grew out of prospect theory (Tversky, Kahneman, & Slovic 1982). The assumption corresponds with many stories told about early experimentation with drugs that went sour and resulted in a decision not to use any more.

So be it. If it's good, attitude goes down 20; if it's bad, it goes up 40.

That's the first time. Folk wisdom holds that first impressions are strongest. The effect of the evaluation declines with experience. The first time, positive attitude changes by 20 multiplied by 1 over the total number of positive experiences, which is 1, so the result is still 20. The second time, attitude changes by 20 times 1 over the number of positive experiences, which is now 2, so it changes by 10. And so on, with declining influence as time goes one. The same thing happens with negative experiences. Finally, if the agent turns blue, that is if it becomes dependent, evaluation doesn't matter any more. It has to have it.

This story could go on and on. There are other functions with strange numbers. For example, the agent influences the other agents in its network, and offers the drug to them, and checks the buzz around it, and so on and so forth. All of these critical parts of the model could fuel more shaggy number stories of the sort I've told here already.

* Enumerology

What might a mathematically unwashed person like me learn from this exercise in existential quantification? To borrow Bogdan's (Bogdan & Taylor 1975) old term, what has been contributed to "enumerology," the study of where numbers come from?

First of all, I suspect that any agent-based model of social life is rich in numerical narratives of the sort I've told here. And the narrative structure is often similar--a complication, an elaborate development often based on questionable assumptions about how the social world works, and then a deus ex machina resolution to get out of the damn story and on with the program.

But then, when the model is used--at the conference, in the publication, for the client--all these stories turn invisible, buried in the code, a powerful behind-the-scenes chorus who control the performance.

This makes me nervous. It makes me wonder about other models. At least with Netlogo I can look at them, in principle, and evaluate the assumptions they've made. If you're programmer dependent, though, you can't do that. Uri Wilensky and his crew are agent-based Martin Luthers. They translated the Sun-God Java Testament into Netlogo.

I say I can look at them "in principle" in the paragraph above. I can't in reality. I know, for instance, that I should review and run and rerun and study the details of a host of available Netlogo programs that deal with diffusion, peer networks, and disease transmission, just for starters. I have enough problems keeping up with review articles that cover some part of each of those fields, never mind the models just in Netlogo alone.

Besides, many of the models would be aggravating in the extreme. I'm among the mathematically and computationally unwashed in this transdisciplinary field. I'm sure there are better ways to do what I attempted in this article, for example. In fact, I'd be grateful for an email from anyone who could aim me in a better direction. But you should see some of the artificial society models hallucinated by the engineers. They don't even know the social science clichés, never mind the, say, three or four findings that the field has actually produced.

Discouraging conclusion so far, no? Let me now try and fight the tendencies of age and dig around for some optimism.

First of all, who cares if the numbers don't mean anything, up to a point anyway? All that matters is "more or less" validity. All that is required is an ordinal scale, not interval or ratio.

Based on experience and research, it's reasonable to say that once one is dependent on a drug, life is different than when one just uses once in awhile. And it is reasonable to say that once you see how dependence alters the life course of another person so that it centres only on a chemical, it will very likely give you, the non-dependent person, pause for thought.

Based on experience and dozens of studies, it's reasonable to say that different drugs differ in how good and how bad they are, evaluated from the point of view of a population of consumers. Most users won't continue to use a really bad drug once they've tried it once or twice. PCP and Basuco (cocaine paste) typically don't take off like other drugs have. They're bad products, if you listen to the words of most user-evaluators.

Most of the model functions resemble these words. They are valid because they are based on features of drugs and drug use that make a difference to users and that vary across different drugs. Now and then along comes a function that actually has strong support, like the random-normal assignment of risk values, based on diffusion of innovation, or the tendency to minimize regrets, based on prospect theory. But even without such backing, a function grounded in differences that make a difference, drawn from experience and user accounts, is probably in the right area of validity.

So from this angle of vision, the right question isn't, does the number mean anything? The right question is, does the number correspond to a difference that makes a difference in the kind of world being modelled? And if that claim is made, then the next question is, who is the modeller to make that claim? Does he/she know anything about the world being modelled? If he/she doesn't, God knows what kinds of personal psychic disturbances he/she has projected onto the world, unconstrained as he/she is by any experience or data.

This is a great unexamined question of agent-based modelling. My numbers don't do so badly on that one.

Then the question is, does the number represent an ordinal scale and not make outrageous claims to interval or ratio status? But then if an ordinal scale is all we need, why the false precision of a zero to one hundred scale? Why zero to one hundred?

I have no answer for that particular range. There probably is an answer that I don't know about, or an answer that suggests a different kind of range, like zero to one, the "normalized" value that my colleague Dwight Wilson prefers. As an ethnographer, I make a living out of making mistakes in public. But I do know I want enough of a range so there's some numerical space out there for the model to explore.

That's the key. Once a model is built, the next step is to explore its space of possible outcomes, it's "phase space" in the Trekkie language of the experts. One explores the space by running the thing hundreds of times, with the parameters fixed to show the variety of outcomes under particular conditions, or with parameters varying to show possible outcomes under a variety of conditions.

If the main goal is the phase space, then the range isn't so important, as long as it's large enough to give the model some room to roam. The reason it's not important is, we're not looking for what happens if the slider moves from exactly 40 to exactly 50. We're looking for interesting features of the space in general as the slider moves across its entire range.

The phase space shows us the emergent properties of the system and their limits. Showing how emergent properties can be explained by agent interactions is the point of it all. Does the space turn out to be a simple linear thing with a tipping point, or an inverse power law, or a bifurcating attractor, or what? That's the question we want to answer. So-I think-any range with a little room to roam will work, so why not zero to one hundred?

Netlogo, by the way, needs some work in this area. Their "Behavior Space" tool lights up with a beta version warning, and it can't handle too much in the way of variation yet. My colleague Dwight Wilson argues that between the Behavior Space limits and Netlogo's relatively slower speed, we'll need to translate the model back into Swarm to get any serious experimental work done. In fairness to Netlogo, though, I haven't explored the Behavior Space tool adequately to properly evaluate it yet.

* Conclusion

Frankly, I don't know if I'm out of trouble now or in more trouble than when I started. I've deconstructed some numbers and then concluded that the deconstruction doesn't matter much. It's reminding me of articles I read in the Washington Post that quote politicians.

I think agent-based models are promising, in the thought experiment sense, not the sense of virtual reality. Let me explain that. Models can't represent an ethnographic account in a virtual reality. Such efforts would represent a Hegel/Newton parody. What models can do is clarify an idea, one that a researcher has concluded is central and key in understanding a particular phenomenon, an idea that is "post-ethnographic." An agent-based model can't do the ethnography. It can't represent it, either. What it can do is test a critical piece of the structure/agency puzzle after you're done.

Given that goal, the main moral of the story is this: The most important thing to translate when going from research to model are the human concepts that make the biggest difference in explaining what happens in the population. Then make sure the computer versions of the concepts interact like the human concepts did in the ethnographic explanation. Then give the concepts a numerical range that opens a large enough space so the model can roam. Then run it hundreds of times.

Not very profound, I guess, except for the fact that those first two steps, as near as I can tell, are not always described by modellers. It's predictable that a person trained in ethnography would say that. And I'm guessing that mathematically sophisticated readers have broken out in a rash at the "room to roam" constraint, but I'm willing to learn. Still, it's the right thing to say, in the end. Without grounding in the real human world, what are the agents supposed to represent? Slime mould and birds, fine, but not artificial societies.

* References

AGAR, M. (2001). Another Complex Step: A Model of Heroin Experimentation. Field Methods, 13(4), 353-369.

AGAR, M., & WILSON, D. (2002). Drugmart: Heroin Epidemics as Complex Adaptive Systems. Complexity,7(5), 44-52.

AGAR, M. H., & REISINGER, H. S. (2000). Explaining Drug Use Trends: Suburban Heroin Use in Baltimore County. In A. Springer & A. Uhl (Eds.), Illicit Drugs: Patterns of Use -- Patterns of Response (pp. 143-165). Innsbruck: STUDIENVerlag.

AGAR, M. H., & REISINGER, H. S. (2001). Trend Theory: Explaining Heroin Use Trends. Journal of Psychoactive Drugs, 33(3), 203-212.

BECKER, H. S. (1963). Outsiders: Studies in the Sociology of Deviance. New York: The Free Press.

BOGDAN, R., & TAYLOR, S. J. (1975). An Introduction to Qualitative Research Methods. New York: John Wiley.

ROGERS, E. M. (1995). Diffusion of innovations (fourth ed.). New York: The Free Press.

TVERSKY, A., KAHNEMAN, D., & SLOVIC, P. (1982). Judgment Under Uncertainty: Heuristics and Biases.Cambridge: Cambridge University Press.

WILENSKY, U. (1999). NetLogo. Evanston IL: Center for Connected Learning and Computer Based Modeling Northwestern University.

WURTZEL, E. (2002). More, Now, Again: A Memoir of Addiction. New York: Simon and Schuster.


ButtonReturn to Contents of this issue

© Copyright Journal of Artificial Societies and Social Simulation, [2003]