Programming languages compared, and why I’m sticking with Python until Julia grows up

Comparisons of programming languages abound, especially with regard to running speed. This paper in the Journal of Economic Dynamics and Control by Boragan Aruoba of the University of Maryland and Jesús Fernández-Villaverde of the University of Pennsylvania is yet another one, albeit in a peer-reviewed journal and with a procedure (value function iteration) that is common in my field. Main observations:

  • When it comes to speed nothing beats C++ and FORTRAN.
  • Julia performs really well: only 2.37 times the running time of C++.
  • Python and R are slowpokes, at about 45 (Python with the Pypy interpreter) to 491 times (R without its Compiler package) times the running time of C++.
  • Matlab is somewhat inbetween the slowpokes and the frontrunners, with about 9 times the running time of C++.
  • R, Matlab and Python can get a boost from just-in-time-compilers and C compilers (like Rcpp for R; or Numba or Cython for Python) that make their running time comparable to that of Julia (although Rcpp is still a bit disappointing: 5.4 times the C++ running time).
Adding my own considerations:
  • I tried C++ and gave up very quickly. I bloody hate it with a passion.
  • I find R not much better: even though it is a scripted language it is clumsy, illogical, and makes for horrible code. Rcpp worked fine until I found out that it cannot handle matrices with more than 2 dimensions. Speeding up your R code with bigger matrices requires the use of full-blown C++. In other words, two languages that I bloody hate.
  • I value my independence, so I prefer to work on my own laptop with my own licenses. That makes Matlab, with its steep license fee, a no-go.
  • I’ve experimented with Cython and it seems to work quite well. I love the accessibility and clear layout of Python; moreover, my university teaches Python twice a year in an undergrad course. The only real problem with Python is that it is reputedly difficult to parallellize.
  • One day I’ll start using Julia. It’s fast, accessible, and (so they say) easy to parallellize. But not until there is a stable version and a decent IDE.

On interdisciplinarity

Check out the really cool cover of Nature’s special feature on interdisciplinarity!

Of course, as an economist I especially like their inclusion of “Invisible Hand” as the sole superhero representing the social sciences in their scientific team of Avengers. But it is also symbolic for the fact that economists have, in my view, gone the furthest in integrating their discipline with the natural sciences. This holds particularly for environmental and resource economists, who by definition deal with problems of the natural environment like pollution and overfishing. The reason is pretty geeky: most economic research is quantitative, and quite a lot involves the development of mathematical models. And whaddayaknow: so do climate science, population biology, hydrology, and a host of other natural sciences. Give me your equations and I’ll plug them into my CGE model.

It is actually much, much harder to truly integrate qualitative social sciences like sociology or anthropology with quantitative sciences – even with a social science like economics. Models like IMAGE and DICE describe the global climate as well as the economy; the Gordon-Schaefer fisheries model and Colin Clark’s work on renewable resource use, which use basic models from population biology like logistic growth, are part of the standard canon of resource economics since decades; when Daniel Pauly criticizes the limited impact of the “social sciences” on fisheries research, he lumps together economics with biology, not sociology. Meanwhile, it has taken until 2009 that the Nobel committee finally recognized anthropologist Elinor Ostrom for her contributions to the economics of common pool resources, and economists and sociologists share little but contempt for each others’ fields. The Indian economist Jagdish Bhagwati is said to have joked that good economists reincarnate as physicists; wicked economists reincarnate as sociologists. But Ostrom’s Nobel also shows that things are changing, especially in the field of institutional economics. Let’s have more of that in the future.

OMICS Publishing Group clogs my inbox

Just got the third invitation in a month to review a paper on marine microbiology. Looking up the publisher I found this. Little wonder my reply to them was a tad less polite than the previous two:

1. I’m a natural resource economist with no knowledge of biology.
2. This is the third such invitation. You’re wasting your time and, worse, mine.
3. You’re on a list of predatory publishers: http://scholarlyoa.com/2013/01/25/omics-predatory-meetings/

Stop wasting my time. I will now block your e-mails from my account.

Science on marine plastic debris

Science just published an excellent article on the problem of marine plastic debris. Its main conclusion is that

“275 million metric tons (MT) of plastic waste was generated in 192 coastal countries in 2010, with 4.8 to 12.7 million MT entering the ocean.”

The authors break this number down by country, and show that four Asian countries (China, Indonesia, Philippines, Vietnam) contribute almost half the plastic waste going into the oceans. The US is 20th in rank, contributing 0.9%; the authors also explain that the EU would be 18th in rank if it were counted as one country, which implies that the EU also contributes about 1% to the total amount of plastic waste going into the oceans. A few more observations:

  • The list is dominated by middle-income countries. The only low-income countries are Bangladesh, Burma, and North Korea. Is this the environmental Kuznets at work?
  • There is a striking correlation between income and the quality of waste management. The countries with the highest percentage of mismanaged waste are low-income countries or lower-middle-income countries. Even upper-middle-income countries have rates between 50% and 80%.
  • Brazil and Turkey are intriguing exceptions: despite being upper-middle-income countries their mismanagement rates are 11% and 18%, respectively. What are these countries doing differently than the rest?
  • The US has a comparatively low mismanagement rate (2%), but compensates its effort by the sheer amount of plastics produced per capita: 2.58 kg, where most other countries range between 0.5 and 1.5 kg. EU figures are not given but I suspect the EU does worse on waste treatment than the US.
  • A notable exception to that observation is Sri Lanka with a whopping 5.1 kg plastic waste produced per capita. What do they need all that plastic for?
Overall I can’t help but thinking that the energy invested by well-meaning westerners to reduce their use of plastics is but a drop in the ocean as long as the emerging world does not clean up its act.

Associate professor

I just realised that I never announced on this blog that I presented my (new and improved) research vision to the assessment committee for a second time – and that the assessment committee agreed that I should be appointed associate professor as of 1 November 2014.

So there you go: as of 1 November 2014 I am in the position of associate professor.
(Fireworks, music, ticker tape.)

 

I would have liked to say that my trip to Australia inspired the main research focus I put into my research vision: to develop computational models of coastal and marine resource use, drawing on experiences from other economics subdisciplines such as macroeconomics. But honestly, it’s the other way around: I went there to learn more about computational models because I believe they can be useful. But it was good to talk to my peers in the field and realise that it’s actually not so bad an idea. You can find the vision document here, and the presentation here.

I still feel more or less the same about the tenure track system as I did last time: it’s a good concept although its application in Wageningen University has its teething problems.

As for any advice I can give other people on the tenure track, I’m not sure whether my advice is worth anything but I can at least give you my opinion:

  • Expose your ideas to your peers. We don’t have a mentor system in Wageningen (we should!!), neither do we have many staff who have been through the tenure track themselves. So the next best thing is to go out, talk to other academic researchers, and try to learn from them as much as you can. Have a beer with them at a conference. Try to arrange a sabbatical at their university. Try to get them to your own university for a seminar or a PhD defence. Send them your written research vision and ask them what they think.
  • Set your own goals. Yes I know you have 18 criteria to meet (I kid you not), but first and foremost you must decide which direction you want to go – and then go there within whatever limits are set by the official criteria.
For what it’s worth.

"I want a MOOC"

How many university boards are like this guy when you replace “iPad app” by “MOOC“?

Client: “I want an iPad app.”
Designer: “For what purpose?”
Client: “I don’t know, I just want an iPad app.”
Source: Clients From Hell

Don’t get me wrong here. Some MOOCs are great. I recently discovered two great online courses on Real Analysis, and I’m currently going through Tom Sargent‘s and John Stachurski‘s online course on Quantitative Economics in Python. But the question why you want a MOOC, for whom it should be made, and to what purpose, should always be asked.

Why are Dutch fish mongers so terrible?

For a country that controls a chunk of sea one and a half times its land mass, the Dutch are pathetic eaters of seafood. OK, granted – we’re rightly proud of our slightly-cured herring (which is mostly caught by the Norwegians) and our kibbeling, fried chunks of cod (although many Dutch consumers think kibbeling is a fish species). But for the rest we export most of our mussels, sole, and oysters to people who know properly how to appreciate them, like the French and the Belgians. Instead, we import a tasteless excuse for a fish like tilapia.

But the fish mongers aren’t helping either. Two weeks ago I was buying a tuna steak at the open market in Wageningen. (After my trip to The Philippines I had but one thing on my mind: I want to make that delicious ceviche with fresh ginger and coriander myself!) A youngish bloke for whom this must have been his way of earning his Saturday night drinks served me, and I asked him whether the tuna steak I was buying had been frozen. Silly question, I know – there is no way you can get tuna from its fishing grounds to a Wageningen market stall without freezing it somewhere along the way. “No, it’s all fresh,” he said. So where did it come from? That turned out to be a difficult question. “I don’t know,” he stumbled, looking at me as if I had just asked him about the sound of one hand clapping. “I should ask my boss.” “Pacific ocean,” said a colleague. OK, thanks. “Indian ocean,” said another colleague who looked like she was in charge. “Is that OK with you?” Sure, I was only curious – I wasn’t going to report you to Sea Shepherd or anything.

How can these people not know where their wares come from? I decided against asking the species, because I did not want to prolong their agony. I’m quite sure it was yellowfin anyway. But the limited information they had available was shocking. Even more shocking is the fact that they get away with it, because Dutch consumers just don’t give a rodent’s backside for quality when it comes to fish – let alone how it was caught, whether any other species had been caught in the process, and so on.

Last week I made this picture at the open market in Ede (just North of Wageningen):

This is what tong, or sole (solea solea) looks like; this is what schol, or plaice (pleuronectes platessa) looks like. You’d expect the orange spots should be a bit of a giveaway.

I guess every country gets the fish mongers it deserves.

Bumfights transactions

In 2002 a Las Vegas film maker came up with a hideous business model: pay homeless people a few dollars or a six pack of beer to conduct dangerous stunts, or to engage in fistfights with other homeless people, and film them. The movies, marketed under the insensitive brand name Bumfights, caused a storm of criticism, especially from advocacy organisations for homeless people, who argued the movies legitimized violence against homeless people, and were demeaning and dehumanizing to the people who participated.

The film makers responded that all homeless featured in the movies participated voluntarily. Surely they can make their own decisions? To which a professor responded

“Even if the homeless aren’t forced to perform, it’s inaccurate to describe people without adequate shelter, food or clothing as having choices.”

I hear the same argument in debates on international trade, Payments for Environmental Services, and other transactions between highly unequal parties: once an African lady reacted angrily to the concept of REDD+, arguing “it’s not a free choice!” I believe it points towards a moral flaw in economic theory that many of my colleagues either do not see, do not want to see, or just don’t care about. I call these transactions Bumfights transactions, after the movie series.

Forgive me for getting a bit theoretical here. Consider Rufus, the homeless man who featured prominently in Bumfights. Back then, Rufus had no home, no job, and he lived by what little he could earn by collecting empty cans. Let’s call the situation he lived in A. Say the film maker offered Rufus $5 if he would ride a shopping cart down a flight of steps. In other words, the film maker offered Rufus a new situation B, which you could define as A + $5 + S, where S is the humiliation and risk of serious injury that goes with the stunt. If Rufus preferred B to A (AB in mathematical notation), he would participate in the movie; if AB he would not. Obviously the film maker preferred AB: for only $5 he would have a lot of fun filming Rufus putting his life at risk, and he would make a big buck selling the video. So they could move from A (no transaction) to B (after the transaction), which they both preferred to A. What’s not to like? In economic terms this is called a Pareto improvement: a change that makes at least one person better off, and none worse off.

The objection to this logic is that Rufus “had no choice”, but an economist would point out that he did: he could choose to refuse participation and stick with collecting cans for a living. No matter how bad this situation was (I surely don’t envy him), obviously participating in Bumfights was better than not participating: after all, he participated, right? Not offering the choice would have left him in A, which is worse than B. The problem is not the transaction; the problem is poverty.

The flaw in this logic is that this may work in the sterile, utilitarian world of microeconomics, but in the real world the film maker also had a choice. He could have paid Rufus $100; he could have offered orange juice instead of alcohol (offering alcohol to somebody with a drinking problem is particularly nasty); he could have refrained from the transaction altogether and donate his $5 to the Salvation Army.

Another issue is that this line of reasoning only works if you care only about the consequences of an act: in other words, it follows a consequentialist ethic, where one could also follow a deontological ethic, or a virtues ethic. Many people consider making money in this way unethical, regardless of the consequences, just for its abusive nature.

Collecting up to 80 kg of sulphur in
a cloud of toxic volcanic fumes and
carrying it down the slope of
Mount Ijen, East Java: hey, it beats
starving to death!

Nevertheless, the line between an “equitable” transaction and a Bumfights transaction is blurry. To take the example of REDD+ again, many developing countries have come round to this idea, after initial opposition; it seems Costa Rica and Indonesia are quite keen on it. And how many people have jobs that are dangerous, or just mind-numbingly boring, just because the only alternative is starvation?

So next time you buy your clothes in a cheap clothes store, ask yourself: am I helping a poor Bangladeshi earn an income or am I taking advantage of his poverty? The question is more difficult than you might think.

Trash fishing in Pangandaran, Java

I visited the fishing village of Pangandaran, Java, during my holiday in Indonesia. It’s a beautiful place, delicious fresh grilled fish (ikan bakar), and you can watch the local fishing traditions.

I was shocked, however, by the sheer amount of litter in the sea, especially plastics. The problem is, apparently, that a nearby river discharges a lot of litter from upriver villages and towns, and the shape of the coast makes it a natural garbage collector. The result is heartbreaking:

Memories of Holland, and Indonesia

It was Saturday and I felt a craving for nasi goreng, perhaps with some tempeh goreng or beef rendang. Luckily, Saturday is market day in Wageningen, and I had noticed earlier a small stall selling Indonesian food at the open market on the church square. I decided to check it out. There is something strange with Indonesian food in The Netherlands: the Dutch eat a lot of it (nasi goreng, babi panggang, krupuk, sambal, acam campur), but because the trade is dominated by Chinese restaurants selling their own poor imitation of it, a lot of people think they are eating Chinese food.

A Dutch man so tall he barely fitted in the small cramped minivan took my order. I thought he looked a bit silly in his traditional Indonesian batik shirt, but when I learned his wife was from Indonesia I could forgive him. I asked who his costumers usually were. Do many Indonesian students buy his food? Or perhaps residents of the home for Dutch-Indonesian elderly people, here in Wageningen? Yes, every now and again, but not many, he said.

The elderly home is called Rumah Kita: Indonesian for “our house.” There is a small catch here, because in Indonesian the word for “us”, “we”, or “our” can be inclusive or exclusive. Kita is the inclusive form: it includes the person spoken to. The exclusive form is kami. If it were called “Rumah Kami” it would have sounded a bit like “You! Cheeseheads! Sod off, this is our house.” But the name Rumah Kita sends a welcoming message to all elderly members of the Dutch-Indonesian community: come and join us, we have nasi campur on the menu today.

These are the people who were born in places that at the time were called Batavia, Buitenzorg, Weltevreden, Bandoeng, or Soerabaja. Their father might have been a Dutch clerk for the colonial government, who started a family with a Javanese woman and decided to stay in The Emerald Belt. Or perhaps their grandfather was a planter who went to the Dutch Indies to put his study at the Landbouwhogeschool Wageningen to practice on a plantation near Malabar or Kalibaru. Overwhelmed by the Japanese invasion in the Second World War, they would have gone through unspeakable hardships in Japanese concentration camps. After the war they would have sought refuge in those same camps during the Indonesian uprising, when many Dutch, Dutch-Indonesians and ethnic Chinese were killed by the insurgents. Eventually they would have migrated with their parents to The Netherlands, most of them after Indonesia became independent. A lifetime in a cold country they only knew from their schoolbooks awaited.

As a folk musician and traveller, I have been searching for songs in the Dutch musical tradition about homesickness. The only songs I found so far are written in the 1950s, by Dutch-Indonesian artists, about their homesickness for the Indies. I admit I have mixed emotions about these songs. We were never supposed to be there. The Dutch have been terrible overlords to the Indonesians: when the Brits handed back the Indies to the Dutch after Napoleon was defeated, the Javanese revolted because they would rather live under British rule than under the Dutch. But the emotions expressed in these songs are genuine, and intense. Whatever you think of the geopolitics, you can’t deny their longing for the place that features in their earliest memories.

A small, fragile elderly lady with a walking stick came up to the stall with a long list of orders. Rendang, ketopak, some pisang goreng, and did you still have that delicious chicken curry with sereh? Yes, all frozen please, it’s for the week. For now I would just like one lemper please. When she sat down next to me with her snack I noticed a slight trace of Asia in her features. I asked whether she was from the Indies. Yes, she said, born and raised in Surabaya. We munched away on our food and chatted a little with the batik-clad man’s Indonesian wife. I watched as a group of Dutch students walked past on brightly painted wooden shoes – an initiation tradition of one of the local student societies. A group of Chinese students stared at them, giggling and taking pictures.

“I always get tears in my eyes when I eat this,” the elderly lady said. The Indonesian woman replied by asking “Are those tears of joy or sorrow?” The elderly lady looked at her with a thoughtful smile and said “I think it’s because of the tastiness.”