woensdag 23 september 2015

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.

zaterdag 19 september 2015

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.

vrijdag 15 mei 2015

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.

zaterdag 14 februari 2015

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.

zaterdag 3 januari 2015

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.

maandag 24 november 2014

Value Function Iteration in R, Python, GAMS

So I've spent a couple of evenings debugging my code, trying it in different languages to see whether it was me or the built-in functions I used (it was me), so I ended up with the same model in R, Python, and GAMS. I figured I might as well post the code on the web.

Yes, I found the problem, and no, I'm not going to tell what it was because I find it too embarrassing.

maandag 27 oktober 2014

"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.