Workshop “Stata meets Python”

At this year’s German Stata Conference (June 15-16, Humboldt University, Berlin) I will be teaching a workshop titled “Stata meets Python”.

What is it about?

Attendants will learn how to use the Python integration facilities that Stata has made available in order to embed Python code in Stata (since version 16) or Stata code in Python (since version 17). Stata calls this integration collectively PyStata. It includes among other ingredients a pystata python package written by Stata (which enables embedding of Stata code in Python) as well as the sfi module – Stata Function Interface (SFI) which can be used to access Stata’s current dataset, frames, macros, scalars, matrices, value lables, global Mata matrices etc.

Why should you attend?

Both languages have large lively communities which create user written programs with little overlap. The integration doubles the amount of ammunition you can throw at data problems.

The Program can be found on Stata’s own website as well as on the official conference page.


Flattening the COVID-19 curve: What works

“…policies preventing close contacts in large groups, such as public events, private gatherings, and schools are the most effective in reducing new infections… mediated by changes in population mobility patterns, which are consistent with time-use and epidemiological factors…

From our column at voxeu.org on our paper (joint with K. Tatsiramos and B. Verheyden)

On google scholar (all sources).

An internet picture of labor under COVID-19

COVID-19 pandemic

A week’s worth of hourly Google searches across the Globe on the topic of “coronavirus” now (blue) and four weeks ago.

Unemployment

A week’s worth of hourly Google searches across the Globe on the topic of “unemployment benefits” now (blue) and four weeks ago.

Videconferencing

A week’s worth of hourly Google searches across the Globe on the topic of “Zoom videoconferencing” now (blue) and four weeks ago.
A week’s worth of hourly Google searches across the Globe on the topic of “Cisco Webex videoconferencing” now (blue) and four weeks ago.
A week’s worth of hourly Google searches across the Globe on the topic of “GoToMeeting videoconferencing” now (blue) and four weeks ago.
A week’s worth of hourly Google searches across the Globe on the topic of “Skype videoconferencing” now (blue) and four weeks ago.

Working in teams online, collaborating

A week’s worth of hourly Google searches across the Globe on the topic of “Slack” now (blue) and four weeks ago.
A week’s worth of hourly Google searches across the Globe on the topic of “Microsoft Teams” now (blue) and four weeks ago.
A week’s worth of hourly Google searches across the Globe on the topic of “G Suite” now (blue) and four weeks ago.

Traffic congestions moves from the road to the internet

A week’s worth of hourly Google searches across the Globe on the topic of “Traffic Congestion” now (blue) and four weeks ago.
A week’s worth of hourly Google searches across the Globe on the topic of “Speedtest.net” now (blue) and four weeks ago.

#BREXIT: Vox Populi

Why the parliament expresses the “will of the people” better than any of its MPs including its PM and better than the brexit referendum

In 1907 Francis Galton published a paper in Nature titled Vox Populi. In it he discusses how the collective judgement of the crowd is better than that of the average individual (a fact which goes back to a simple mathematical identity, also known as diversity prediction theorem, which states that the squared error of the average of all predictions is smaller than or equal to the average squared error of all prediction because from the latter we need to subtract the diversity of the individual predictions to get the former). In what we would, today, call policy recommendations of his paper, Galton states:

The result is, I think, more creditable to the trustworthiness of a democratic judgement than might have been expected.

On the other hand, consider as Marquis de Condorset might have done in the 18th century, three voters Peter, Paul and Mary ordering three different alternatives, let’s say: Remain, Deal Brexit and No Deal Brexit. Here is how their preferences might be:

Peter: Remain, Deal Brexit, No Deal Brexit

Paul: Deal Brexit, No Deal Brexit, Remain

Mary: No Deal Brexit, Remain, Deal Brexit

All three are opinionated “patriots” who want “the best” for the UK. Peter wants to remain but if not feasible he wants an amicable divorce. Paul wants a divorce but if possible an amicable one and Mary wants no compromises: either leave “proud” or don’t try it at all.

It is irrelevant who is “right” or “wrong” but we can assume whatever contributes to the opinion of each individual does so consistently. In other words they might change their minds but each time you ask them they have an ordering which puts the three options in order. Their personality, gender, hormonal levels, socioeconomic status, childhood etc all might play a role. Now let’s examine which option has majority. Remain is preferred over Deal Brexit by a 2/3 majority (Peter and Mary), Deal Brexit is preferred over No Deal Brexit by a 2/3 majority (Peter and Paul), No Deal Brexit is preferred over Remain by a 2/3 majority (Paul and Mary). So the “democratic process” picks Remain over Deal, Deal over No Deal (hence Remain is better than No Deal) but it also prefers No Deal over Remain. So it prefers Remain over No Deal and No Deal over Remain!

So what gives? The mess the UK is in has some simple mathematics which if paid attention to could help bring emotions down and make some very simple thoughts which might lead to some very reasonable decisions. A referendum is too crude a tool to use to make important decisions especially with a turnout of 72% and a Leave to Remain outcome of 51.89% to 48.11%. Marquis de Condorcet will tell you that when the Leavers say that the referendum is “the will of the people” they are just bullshitting the public opinion. If you posed seemingly equivalent formualtions of the same question you could very well get contradictory outcomes such as leaving is better than remaining and remaining is better than leaving. On the other hand Galton will tell you that the parliament as a collective has a better chance at figuring things out than any MP (or citizen) including the PM.