Lukas Püttmann    About    Blog

Getting it all together

The young are inundated with a barrage of information and facts so overwhelming that the world has come to seem an utter bedlam, which has them spinning in a frenzy, looking for what man has always looked for from the beginning of time, a way of life that has some meaning or sense. A way of life means a certain degree of order where things have some relationship and can be pieced together into a system that at least provides some clues to what life is about. […] This is what is behind the common cliché, “getting it all together” —despite the realization that all values and factors are relative, fluid, and changing, and that it will be possible to “get it all together” only relatively. The elements will shift and move together just like the changing pattern in a turning kaleidoscope.

That is Saul Alinsky in “Rules for Radicals” from 1971.

Matlab struct to R dataframe

I just found the cool R package R.matlab which lets you easily transfer data saved in a Matlab struct to an R dataframe.

First run in Matlab:

% Create some data saved in a struct
data.first = rand(500, 1);
data.second = repmat({'abc'}, 500, 1);
save('./data.mat', 'data')

And then in R (see here):

library(R.matlab)
matlabFile  <- readMat('data.mat')
varNames    <- names(matlabFile$data[,,1])
datList     <- matlabFile$data
datList     <- lapply(datList, unlist, use.names=FALSE)
data        <- as.data.frame(datList)
names(data) <- varNames

Collected links

  1. Francis Diebold:

    [Machine learning] emphasizes approximating non-linear conditional-mean functions in highly-flexible non-parametric fashion. That turns out to be doubly unnecessary in econometric [time series]: There’s just not much conditional-mean non-linearity to worry about, and when there occasionally is, it’s typically of a highly-specialized nature best approximated in highly-specialized (tightly-parametric) fashion.

  2. John Myles White, “What is an Interaction Effect?”:

    The absence of interactions has nothing to do with linearity: it’s driven instead by a form of additivity.

  3. Michael Stepner:

    After working with git, Dropbox stresses me out.

  4. This Book Left Me in Tears”, by Bill Gates

Code snippet of the day

In Matlab, use an exclamation mark ! to pass commands to the terminal. Use !pwd to check your working directory or !ls to check which files are in the current folder. I came across this first here.

My favorite is !open . (on a mac) and !explorer . (on a PC) which opens the current folder location.

"Rules for Radicals", by Saul Alinsky

Saul Alinsky was a commuting organizer and wrote the book “Rules for Radicals: A Pragmatic Primer for Realistic Radicals”, which I came across at this good short post.

Alinsky starts:

The Prince was written by Machiavelli for the Haves on how to hold power. Rules for Radicals is written for the Have-Nots on how to take it away.

And he aims high:

Remember we are talking about revolution, not revelation; you can miss the target by shooting too high as well as too low.

A “revolution” for him means turning over existing power structures. He stresses that it’s not the same as promoting communism:

Today revolution has become synonymous with communism while capitalism is synonymous with status quo. […] We have permitted a suicidal situation to unfold wherein revolution and communism have become one. These pages are committed to splitting this political atom, separating this exclusive identification of communism with revolution.

And he thinks political change won’t come without a conflict:

All of life is partisan. There is no dispassionate objectivity. […] This raises the question: what, if any, is my ideology? What kind of ideology, if any, can an organizer have who is working in and for a free society? The prerequisite for an ideology is possession of a basic truth.

(See also Jan-Werner Müller’s criticism of meritocratic technocracy.)

However, finding one’s ideology isn’t easy:

An organizer working in and for an open society is in an ideological dilemma. To begin with, he does not have a fixed truth—truth to him is relative and changing; everything to him is relative and changing. […] In the end he has one conviction—a belief that if people have the power to act, in the long run they will, most of the time, reach the right decisions. The alternative to this would be rule by the elite— either a dictatorship or some form of a political aristocracy.

And:

It is the schizophrenia of a free society that we outwardly espouse faith in the people but inwardly have strong doubts whether the people can be trusted.

He argues against passive pessimism, withdrawing from and accepting the world as it is and makes an optimistic case that change is possible. He then offers much advice on how to get it done.

I liked this bit:

It is a world not of angels but of angles, where men speak of moral principles but act on power principles; a world where we are always moral and our enemies always immoral; a world where “reconciliation” means that when one side gets the power and the other side gets reconciled to it, then we have reconciliation; […].

And he stresses that despite all revolutionary rhetoric, one should realize that:

I can attack my government, try to organize to change it. That’s more than I can do in Moscow, Peking, or Havana. […] Let’s keep some perspective.

And he talks a lot about the lower middle class:

If we fail to communicate with them, if we don’t encourage them to form alliances with us, they will move to the right. Maybe they will anyway, but let’s not let it happen by default.

Alinsky argues that words like “power” or “self-interest” should not be watered down, but used just like that. It’s interesting to hear Barack Obama speak and use just these words very deliberately. (And, incidentally, Alinsky was also the subject of Hillary Clinton’s undergraduate thesis.)

The role of a community organizer as the author describes it, sounds like that of a management consultant. He’s an outsider who enters a local community and wins their trust. He questions existing power structures, the ways of rationalizing how things are and the ways things are run. And he can be blamed if things don’t work out.

He stresses the need for a realistic assessment of the situation:

As an organizer I start from where the world is, as it is, not as I would like it to be.

But:

Most of us view the world not as it is but as we would like it to be.

He promotes a flexible, messy approach and for embracing uncertainty, but one’s language should be firm:

A leader may struggle toward a decision and weigh the merits and demerits of a situation which is 52 per cent positive and 48 per cent negative, but once the decision is reached he must assume that his cause is 100 per cent positive and the opposition 100 per cent negative.

Alinsky writes that much of this is just reacting to external events. Only in hindsight do people assign deep reasons for why one has acted in a way:

The lesson here is that a major job of the organizer is to instantly develop the rationale for actions which have taken place by accident or impulsive anger.

The danger is that people don’t like being told that they’ve been wrong. If you now tell people to do things different, then they must have done things the wrong way before. So the organizer will seem aloof and people think he considers them dumb. And he emphasizes that you have stay within people’s experience to communicate with them:

People only understand things in terms of their experience, which means that you must get within their experience. […] I know that I have communicated with the other party when his eyes light up and he responds, “I know exactly what you mean. I had something just like that happen to me once. Let me tell you about it!”

This argument is flipped around when he talks about how to treat one’s enemies, which should be “frozen and personalized” and be made uncomfortable by going out of their experience. This reminded me of Tim Harford’s treatment of how Donald Trump hijacked his opponents OODA loop.

To avert a clash with the community, an organizer should start gently, with easy wins which he calls “cinch fights”. And – seemingly straight from Dale Carnegie – then let people figure out the important stuff themselves, so that they feel like they came up with it.

However, it’s hard to keep up the momentum:

Among the reasons is the simple fact that human beings can sustain an interest in a particular subject only over a limited period of time.

From the moment the tactician engages in conflict, his enemy is time. This should be kept in mind when one is considering boycotts.

He writes that one of the best things that can happen to a revolutionary is to be put in prison for a short while. It makes the organizer a martyr and focuses the movement. And Alinsky, who spend short sentences in jail himself, thinks that it’s a good place to get work done. The guards are dull and it strips away any distractions. But if you stay too long, new problems will arise and you will get out of touch. He suggests one to three months.

Overall, I recommend the book. It’s well written and compact. And it’s not as controversial as its title would have you believe. In fact,

The use of the adjective “controversial” to qualify the word “issue” is a meaningless redundancy. There can be no such thing as a “non-controversial” issue. When there is agreement there is no issue; issues only arise when there is disagreement or controversy.

Bundeskunsthalle: "A Brief History of Humankind"

If you’re in Bonn, you should go to the Bundeskunsthalle’s “A Brief History of Humankind”. This is the corresponding exhibition to “Sapiens: A Brief History of Humankind” by Yuval Noah Harari, a book about which I’ve heard good things.

It exhibits artefacts such as 1.4 million year old human tools, a Gutenberg Bible and Einstein’s manuscript of E = mc² (looking a bit like handwritten Latex), all next to contemporary art. What I liked most was a little room filled with ancient figurines of gods from many civilizations.

It only runs until March 26.

Collected links

  1. Interesting perspective on preferring structural (“generative”) over reduced-form (“discriminative”) models:

    The mindset for many in the “data science” scene, especially in finance, is “how can I use machine learning tools to discover structure in my data?” I’d caution against this approach, advocating instead a mindset of “what structure might give rise to the data that I observe?”

    And related to this by Scott Alexander on automation and artificial intelligence:

    One theme that kept coming up was that most modern machine learning algorithms aren’t “transparent” – they can’t give reasons for their choices, and it’s difficult for humans to read them off of the connection weights that form their “brains”. This becomes especially awkward if you’re using the AI for something important. Imagine a future inmate asking why he was denied parole, and the answer being “nobody knows and it’s impossible to find out even in principle”.

  2. Was a mortality rate of 3 percent per month for German fighter pilots in WW2 a lot? This is from Ferguson’s Kissinger biography (emphasis added):

    By the end, the war had cost the lives of at least 5.2 million German servicemen—nearly three in every ten men mobilized—and more than 2.4 million German civilians. Total mortality approached 10 percent of Germany’s prewar population. To a remarkable extent, these casualties were inflicted in the final year of the war. More German soldiers lost their lives in the last twelve months of fighting than in the whole of the rest of the war.

  3. And this:

    Given this extreme malleability of the R runtime it is a legitimate question: “why R hasn’t fractured into a million incompatible domain specific languages and died?”

  4. From Timothy Taylor’s recommendations in the new issue of the JEP, “Seven Facts on Noncognitive Skills from Education to the Labor Market”.

  5. The “British Newspaper Archive Blog”:

    My Grandma died when I was young, but in later years my Grandad told me that her parents, my great-grandparents, had gone to Canada and had promised to call for their daughters when they were settled. They never did.

  6. afinetheorem (Kevin Bryan) breaks 7 years of “economic research only”

Ramanujan's nested radicals

In the biography of S. Ramanujan “The Man Who Knew Infinity: A Life of the Genius Ramanujan” (excellent, by the way), the author Robert Kanigel describes how Ramanujan’s first published work was a little problem he posed for other mathematicians. In it, Ramanujan asks for the value this series takes:

Nobody found a solution for six months, so he supplied a more general solution himself (see here and here) and the answer is 3.

Ramanujan filled his notebooks with numerical computations and some of his statements he did not prove, but were intuitions gained from his computational experiments. So, if we didn’t know the solution, could we simulate this series to get an idea of what it’s up to?

I think this naturally lend itself to recursion, so a function that calls itself. In Matlab (repo):

function val = iter_sqrt(x, n)

if n == 0
    val = 0;
else
    val = sqrt(1 + x*iter_sqrt(x + 1, n - 1));
end

And call it with:

N = 30; % number of series elements
x = 2; 

keep_val = zeros(N, 1);

for i = 1:N
    keep_val(i) = iter_sqrt(x, i);
end

This converges fast:

Ramanujan's nested radicals

For every square root, we call iter_sqrt once. So the runtime is linear in , .

After writing this I saw that John D. Cook had written a similar post. And I found a flaw in my thinking. Because the cost for computing every element of the series is linear, but computing every consecutive element is more costly. The first element takes one calculation step, the second two and so on, so . Which means the full computation takes . Cook writes:

I don’t see how to write a different algorithm that would let you compute f(n+1) taking advantage of having computed f(n). Do you? Can you think of a way to evaluate f(1), f(2), f(3), … f(N) in less than O(N) time?

I can think of two approaches to make this faster, but both fail. First, we cannot use f(1) to calculate f(2), f(3), …, because the true value of f(1) depends on what comes after. Instead f(1) is a crude approximation to f().

Second, I thought, maybe we can flip this around. If we cannot find an algorithm which uses f(n) to calculate f(n+1), then maybe we can find an algorithm that just finds f(n) brute force and then infers what the previous values were. It is indeed possible to get the value of all the nested radicals from calculating f(n). But calculating f(1), f(2), …, f(n-1) from this still takes the same number of steps as before, so nothing is gained.


SIR-model

In a new working paper, Robert Shiller writes about the importance of narratives. He argues that economists should try to understand what the stories are that people tell each other and how they influence their decisions.

For a model of how such stories might spread, he refers to the Kermack and McKendrick SIR-model of disease infection. In the model, there is a fixed number of people and every person is in one of three states: susceptiple (), infected () or recovered (). These evolve as follows:

Initially, almost everybody is susceptible. Then more and more people become infected as susceptibles become affected when they meet an infective with a fixed probability (). However, a fixed share () of the infected recover every period and cannot become ill again.

In Julia, we could simulate the model as follows:

# Parameters
N = 100         # population size
c = 0.005       # probability of infection
r = 0.05        # probability of recovery
T = 180         # periods

# Initialize vectors
I = Float64[1]  # initially infected
R = Float64[0]  # initially recovered
S = Float64[99] # initially susceptible

# Simulate model
for t = 2:T
    # Next period's values
    Rnew = R[t-1] + r * I[t-1]
    Inew = I[t-1] + c * S[t-1] * I[t-1] - r * I[t-1]
    Snew = N - Inew - Rnew

    # Save new value in vector
    push!(I, Inew)
    push!(R, Rnew)
    push!(S, Snew)   
end

Which gives:

SIR-model

The share of infected people peaks when there is a large number of infected people around, but also a large enough share of people who have not yet had the disease. After that, slowly everybody gets infected, then recovers and the disease dies out.

I like this from Shiller’s paper:

Bartholomew (1982) argued that when variations of the Kermack-McKendrick model are applied to the spread of ideas, we should not assume that ceasing to infect others and forgetting are the same thing. Human behavior might be influenced by an old idea not talked about much but still remembered. This has been called “behavioral residue” (Berger, 2013).