Wednesday, 9 August 2006
Joaoaoaoa Pessoaoaoa
Vejo o trabalhador
hoje como companheiro
Ombro a ombro caminhames
Seguindo nosso roteiro
Caminhamos sempre juntos
Olhando para horizonte
Contemplando a Utopia
De um dia sermos iguias
Com as nossas diferencas
not bad for five minutes eh? Marcos, fui muito legal de conhecer-te e seus amigos. Espero que nos nos encontramos de novo... 'ta bem... Dave o capitalist "Chicago Boy".
Monday, 7 August 2006
in Salvador bus station
Since leaving my friends in Sao Paulo I seem to have been sucked into the "traveller" circuit a bit. Lots of nice people but the culture pisses me off slightly. Joe Tourist has two weeks holiday and decides how much to spend on it. These young people have X amount of money and try to make it last as long as possible, which inevitably means they end up haggling bitterly over, like, 25 pence. And they smoke dope. Meh. I dunno, am probably just a crusty old man but occasionally I feel they need a HOLIDAY IN CAMBODIA...
Monday, 31 July 2006
in Brazil
Brazil is awesome. The food is delicious, people are friendly, my Portuguese is terrible. Being a political obsessive I am asking everybody about Lula. The outside world is pretty favourable to him, seeing him as one of the "good Left" as opposed to the old Chavez-style populists. Everyone here, by contrast, seems very disappointed. The corruption scandals were really serious - vote buying, links to crime etc. On the other hand, there are no very inspiring alternatives and I have not yet heard any really cogent arguments against the PT's policies. The problem if anything is what they are not doing (fixing the police and education). People believe Lula will win again and it's hard to disagree.
On Saturday morning, Norman Gall from the Fernand Braudel Institute in Sao Paulo invited me to one of their reading circles. A dozen teenagers from state schools were reading Adam Smith in Portuguese. It was inspiring to see so much talent, dedication and enthusiasm. People here become very gloomy when you ask them about politics or society. I see a lot of positives. There's tremendous energy in Sao Paulo. Little charismatic churches have popped up all over the place, scandalizing educated humanists with their unsophisticated approach (anyone can become a priest without even having studied theology!) When you stop at traffic lights, a kid will jump out in front of your car and juggle tennis balls, more or less expertly. English schools are everywhere.
BTW, for a good read on Brazil today check out Norman's paper Lula and Mephistopheles. Starts from the corruption scandals and broadens out to diagnose the whole society.
Wednesday, 5 July 2006
Essex vaut un blog
I've been at two universities in my life, and have had an incredibly happy time at both of them.
Among the great things this place has are psycho ducks and rabbits, Wivenhoe (aka Wiv, The Hoe, Thundercatshoe to various deranged residents), the Wivenhoe trail, and the main building , which is cunningly designed as an ornamental maze. Then there's the amazingly international student body: a sample of young, determined and smart people from all over the world.
The best thing though is the academic community, which is closeknit, friendly, unpretentious and professional. People here are incredibly generous with their time and knowledge. The seminars are great - informal but tough. The PhD students are a very varied and interesting bunch. And Essex is imbued with the spirit of the 60s, from the not-beautiful-but-just-about-lovable architecture to the democratic optimism.
Things I won't miss? The food. Not that it's bad.... I just feel that I have eaten enough Cafe Vert paninis for one lifetime.
See y'all in a year. I'm off to Chicago!
"Are you ready for the city? Is the city ready for you?"
Futureheads The City is Here for You to Use
interpolating data in R
[,1] [,2] [,3] [,4] [,5] [,6] [,7]
[1,] NA 1 NA NA 6 NA NA
[2,] NA 8 NA NA 5 NA NA
[3,] NA 1 NA NA 4 NA NA
[4,] NA 7 NA NA 7 NA NA
[5,] NA 9 NA NA 1 NA NA
it will be turned into
[,1] [,2] [,3] [,4] [,5] [,6] [,7]
[1,] 1 1 2.666667 4.333333 6 6 6
[2,] 8 8 7.000000 6.000000 5 5 5
[3,] 1 1 2.000000 3.000000 4 4 4
[4,] 7 7 7.000000 7.000000 7 7 7
[5,] 9 9 6.333333 3.666667 1 1 1
Columns 1, 6 and 7 have just been copied from columns 2 and 5 - i.e. this doesn't do extrapolation. Columns 3 and 4 have been interpolated linearly.
The columns of the input matrix must be either all valid, or all NA. Otherwise it will get confused. Fixes welcome.
do.interpolate <- function (m) {
if (any(is.na(m[,1]))) m[] <- rep(m[,ncol(m)], ncol(m))
else if (any(is.na(m[,ncol(m)]))) m[] <- rep(m[,1], ncol(m))
else {
p <- ncol(m)-1
m <- as.matrix(m[,c(1, ncol(m))]) %*% matrix(c(p:0/p, 0:p/p), nrow=2,
byrow=T)
}
return (m)
}
# m is a matrix with missing data
mass.interpolate <- function (m) {
for (c in 1:ncol(m))
if (any(is.na(m[,c])) & ! all(is.na(m[,c])))
stop("column ", colnames(m)[c], " of matrix m is incomplete")
valid <- c(1, which(apply(m, 2, function (x) ! any(is.na(x)))))
rvalid <- c(valid[-1], ncol(m))
for (i in 1:length(valid)) {
if (valid[i] == rvalid[i]) next # if left or rightmost cols are valid
m[ ,valid[i]:rvalid[i] ] <- do.interpolate(m[ ,valid[i]:rvalid[i],
drop=F])
}
return(m)
}
Usage: mass.interpolate(my.matrix)
Wednesday, 28 June 2006
‘Big Brother’ eyes make us act more honestly
‘Big Brother’ eyes make us act more honestlyFrom the article:
"We all know the scene: the departmental coffee room, with the price list for tea and coffee on the wall and the “honesty box” where you pay for your drinks – or not, because no one is watching.
"In a finding that will have office managers everywhere scurrying for the photocopier, researchers have discovered that merely a picture of watching eyes nearly trebled the amount of money put in the box....
"... In previous experiments, people consistently appeared to behave more generously than they needed to for their own self-interest, even when told their actions were anonymous. This has led an influential school of economists to argue that altruism in humans is innate, rather than being based on cynical self-interest.
"But if just a photocopied pair of eyes can treble honesty, the Newcastle team suspects that these previous experiments may somehow have been spoiled by subliminal cues that made people feel they were being watched. "
Sunday, 25 June 2006
One more juicy R tip
mydata[complex.row.condition, complex.column.condition] <- mydata[complex.row.condition, complex.column.condition]+1
or similar. One solution is:
crc <- complex.row.condition
ccc <- complex.column.condition
mydata[crc,ccc]<-mydata[crc,ccc]+1
rm(ccc,crc)
which saves writing out the complex conditions more than once. But it also makes it very cluttered to read and unclear what you are doing.
My alternative solution is to place this function definition in your Rprofile.site file:
inplace <- function (f, arg=1) eval.parent(call("<-",substitute(f)[[arg+1]], f),2)
Now instead of writing, e.g.
foo[bar,baz] <- foo[bar,baz]*2
you can just write
inplace(foo[bar,baz] *2)
or instead of
foo[bar,baz] <- paste(foo[bar,baz], 1:10)
do
inplace(paste(foo[bar,baz], 1:10))
The second argument of the inplace function allows you to use it when your target for assignment is not the first argument of your inner function. For example:
inplace(sub("old", "new", foo[bar,baz]), 3)
is the same as
foo[bar,baz] <- sub("old", "new", foo[bar,baz])What remains valid in Marxist economics?
- His focus on explaining institutions rather than just assuming them. This is still key to modern political economy.
- His class-based framework for understanding politics. This is quite a simple schema: the bourgeoisie can ally with the aristocracy or the proletariat. It's still enormously productive. Modern political science, since Olson, has been much less happy with the assumption that classes, which are groups, can automatically solve their collective action problem and come together to defend their interests. But humans seem to be better at this than theory would predict: in particular, they're willing to punish each other to maintain group norms, even at cost to themselves.
- Ideology. To find out why an idea is popular it is always worth asking: whose interest is it in?
Tuesday, 20 June 2006
Friday, 16 June 2006
Thursday, 15 June 2006
Tuesday, 13 June 2006
copied and pasted from the UCEA website
Anyway, this is just nicked from a UCEA (employers') press release, so if you disagree, feel free to say why. My italics.
At Essex, the Trots or someone have posted up posters representing the lecturers as Oliver Twist and the Vice-Chancellor as a ruthless workhouse manager: "MORE PAY! I promised you more, but now I say NO!!"
11. During the 1980s and 1990s, declining university funding did not allow for real terms
improvements in academic pay. However, since 2000/01, the sector’s finances have
started to improve. New pay negotiating machinery was introduced at the same time
and average earnings for academic staff have increased by 20.3% since 2001. Over
the same period, the unit of funding per student (representing the income universities
and colleges of higher education get per student they teach) has increased by just
under 16%.
12. In real terms (deflated by the RPI), since 2001 the pay of higher education teaching
professionals has increased by 8.7% compared with 3.9% for all employees, and 6.2%
for all professional occupations.
13. According to the Office of National Statistics (ONS), the average annual earnings of
full-time ‘higher education teaching professionals’ were £40,657 in 2005, placing
academics in the top 20% of earners in the UK. That compares with national average
earnings of £28,210 for all full-time employees, and £36,894 for all professional
occupations.
...
Employers also contribute additional sums – equivalent to 14% of salaries – to
generous final salary pension schemes.
I though point 13 in particular might provide a little context.
Having said that, the US rhetoric about an "act of war", driven by a half-conscious analogy with suicide-bombing, is disingenuous. You might as well call Jan Palach a terrorist. Perhaps the three deaths were planned as a protest against the Guantanamo regime. If so, as holding people indefinitely without trial is indeed unjust, cruel and totalitarian, it is hard not to sympathize with their point.
Monday, 12 June 2006
R tips
1. On Windows, get tinn-R. You don't want to be working with the basic R editor. On Linux, use emacs or vi as you prefer - emacs is supposedly pretty good.
2. Record everything you do - don't rely on saving the history for this, as it will be indecipherably messy. The ideal is that anyone should be able to replicate your results, from publicly available data, just by running your file of commands. It also helps a lot when you lose data and have to go back and redo it.
3. You will probably end up with a lot of temporary variables. To know which variables you can safely delete, give temporary variables a dot at the end of their name, like:
for (yr. in dataset$years)
4. Save shortened versions of often-used commands in your Rprofile file (on Windows, this will be in c:\program files\R\R-\etc\Rprofile.site).
For example, I like to type hs instead of help.search. If I just put
hs <- help.search
in Rprofile.site, I will get an error on startup. This is because help.search is in the utils package which is not loaded until after the Rprofile has been executed. So you have to be a little sneaky:
setHook(packageEvent("utils", "onLoad"), function (...) {
hs <<- utils::help.search
})
This means that when utils gets loaded, the function help.search gets assigned to hs. The double-headed arrow, by the way, is for global assignment. Otherwise, the assignment would only happen in the body of our function, which would be useless.
5. You can create new operators. For example, I like to be able to type
1:5 %-% 3and get c(1, 2, 4, 5), i.e. the numbers from 1 to 5 with 3 removed. Another line in my Rprofile.site:
"%-%" <<- setdiffThe setdiff function does what I want, but with %-% it's quicker and more intuitive to read. Similarly
"%like%" <<- function(x,y) grep(y,x, perl=T)means I can type state[state$name %like% "Al.*",] and get data for Alabama and Alaska.
6. Statisticians tend to want to put everything in one huge table. So for example, if they have 50000 Eurobarometer respondents and they want to use respondent's nation's GDP as an independent variable, they'll create a big table with 50000 rows:
name | nation | GDP | ... other national variablesThis is fine until you want to take the log of GDP and it takes the computer five minutes to create 50000 new variables, most of which are duplicates. Take a hint from database administration: keep national variables in a separate data frame, with one row for each nation. Then merge them once you have created all your independent variables, before you start running regressions.
(If you want to know more about how to create good databases, here's a good guide.)
7. Tired of typing brackets all the time to run simple commands? Here's a neat hack:
print.command <- function (x) {
default.args <- attr(x, "default.args")
if (! length(default.args)) default.args <- list()
print(do.call(x, default.args, envir=parent.frame()))
}
class(ls) <- c("command", class(ls))
class(search) <- c("command", class(search))
Now you can type ls or search at the command line without brackets. The magic here is that the end result of any command line is printed, i.e. the print method is called on the object. If we give ls a class of "command", the function print.command gets called when we evaluate ls. This then runs the function in the command line environment. To set up default arguments, do, e.g.:
attr(ls, "default.args") <- list(all=T)
It would be nice to be able to type fix foo instead of fix(foo), but I don't think it's possible. Correct me if you know better.
NEW 8. You don't have to save everything in one workspace. This is the easiest way to go at first, but when your data becomes large and takes minutes to load, you can separate it into different workspaces and load only the bits you need. To do this, instead of save.image, use
save(foo1, file="foo1.RData")
save(foo2, file="foo2.RData")
et cetera. You then load these in the normal way.
That's your lot! For more, check out http://wiki.r-project.org or R tips. And of course, the occasionally grumpy but always enlightening R-help mailing list.
Friday, 9 June 2006
R graph gallery
Friday, 26 May 2006
Iraq cartoons
Monday, 22 May 2006
Monday, 15 May 2006
My entry for the Pimlott Prize
You can’t have your cake and eat it
A Lithuanian acquaintance, a graphic designer turned
The Left has decided that, after decades of peeling paint and lost custom, British identity needs a makeover – and a new, non-racist ownership. The renewed interest started with David Goodhart's essay in Prospect magazine, “Too Diverse?”, which claimed that too much cultural diversity could undermine solidarity, and that shared values might depend on a shared history. As radical Islam hit the headlines, the argument had legs. Trevor Phillips of the Commission for Racial Equality attacked Goodhart as a “liberal Powellite”, but also broke with multiculturalism. Gordon Brown has weighed in with a speech on British identity. The debate has been lively and open-minded. Cultural relativism, the once-common view that value judgments could not cross cultural boundaries, is rarely heard. Neither are there calls for a return to bland ethnic uniformity. Instead, participants struggle to define Britishness as the core minimum that everyone in our society can and must accept. Do we need shared values? Attachment to institutions? Or a broader sense of history and heritage?
To see why this question has hit the agenda, take the family friend who arrived recently from
How will redefining Britishness work in practice? You don't have to be a Marxist to think that a sense of identity can't just be developed by policy wonks, then handed out to the wider community. Before anything else, after all, national identity is about loyalty to a particular group: about whose side you are on. The English language, the common law, chicken tikka masaala, and other components of our national identity – warm beer and old maids on bicycles, as John Major put it, or liberty, fairness and civic pride if you prefer Gordon Brown's version – all ultimately rest on this foundation. At bottom a nation is just a group of people who are prepared to work together for their common good, what the philosopher John Rawls, in a slightly different context, called a “cooperative venture for mutual advantage”. So perhaps our first question should be, is there still a British nation at all?
Historically, British identity was like other nationalisms, bound up with war. National identity was needed because those that had it would defeat those who didn't. The
However, the past was not an age of unambiguous national solidarity. The ruling classes could be passionately patriotic, but their attachment was to a particular idea of
The conditions for this partnership no longer exist. The threat of war in
A liberal optimist would welcome the fact that the old nationalism is redundant.
This perspective has undoubted appeal. It is uncompromisingly cosmopolitan and impartial: the welfare of a Chinese textile worker counts as much as that of a Scottish one, so why favour either over the other? And economic freedom, the creation of integrated world markets in goods and maybe one day in labour, genuinely does make the world richer.
The problem is that globalization, economic integration and freedom of movement affect different parts of countries differently and unequally. Divide the world into three parts: already rich, getting rich and getting poorer.
But not everywhere is like this. Some areas are getting poorer – not absolutely, but relatively. They lack the skills and the infrastructure to compete with the rich areas, but have higher labour costs than the developing world. Consider
If the people in these areas only cared about absolute wealth, the gains from globalisation would outweigh the no doubt temporary pains of adjustment to a fairer and more open world. Alas, humans aren't like that. Adam Smith suggested that it was better to be an English peasant than a king in
The logic of globalization is that
Not everybody has yet understood the lost basis of traditional British identity. Perhaps it is least understood by those who have most to lose. The danger is that when they do, and when they see themselves falling increasingly behind the richer areas of the country, they will seek different repositories for their allegiance. These new groups will not represent
This has happened already elsewhere. The debate over British identity was fuelled by the visibility of militant Islam, but in the long run a more important context may be the emergence of the radical nationalist Right across
This worry explains New Labour's sudden interest in defining Britishness, and in particular the focus on what can bind Britons of different races together. The intention is creditable. But if it is going to be more than a public relations exercise, it will require progressive opinion in this country to make choices for which it is rather unprepared, but which follow inevitably from the view that national identity is at bottom about loyalty to people rather than ideas.
The first of these is that you cannot lecture people on national pride until you have some yourself. The British Social Attitudes survey shows that people with a college degree are about half as likely to say they are “very proud” of being British than people without a qualification. Fair enough: nationalism lost popularity with educated people because of changing economic conditions, but also because it was correctly believed to be the root of many 20th century evils. We are now rediscovering the positive side, though, and would like a new patriotism for the 21st century. Doing that calls less for creative, multicultural redefinitions – we have plenty of those already – than for a new commitment to
Secondly, this commitment must be reflected in policy. Both major parties have rejected economic protectionism in favour of free trade and openness. Retreating into protectionism and populism would indeed be a terrible mistake. The best way to avoid it is to give greater priority, in social policy, to protecting British communities whose status is endangered by globalization. This requires a hard choice between competing values. Take a simple example. A new publication by the Young Foundation, The New
Which leads unavoidably to an issue most Left-wingers won’t like. Bluntly, if you define Britishness without ethnicity, then you need some other way of defining national membership, and that implies a tough line on immigration. The logic of talking about British identity is to tell people in economically deprived and dislocated areas, “we are on your side, we are part of one nation, you can rely on us to help you through the pains of globalization”. That promise means nothing if the group you point at as the focus of your loyalty can be expanded at will to suit the demands of the market. It’s not a racial issue: opinion polls in 2003 showed that majorities of blacks and Asians, like their white compatriots, saw immigration as out of control. This is unsurprising. Pakistanis in
Specifically, nobody yet knows whether openness to migration, in an age of cheap travel, can be combined with a generous welfare state, including universal free education and healthcare. On the face of it, it seems extremely improbable. More likely is the
The Left, and the British political system in general, faces a choice of values: internationalism or nationalism? The power and appeal of internationalism, a proud Left tradition, was shown in widespread support for the Make Poverty History campaign against European trade barriers which harm the developing world's peasant farmers. There is nothing wrong with wanting to treat Chinese and Scottish textile workers the same. But you cannot do that and simultaneously call for a renewed sense of national identity.
The Plaistow pub will probably still stand empty for a long while. Who would ever want to go back there? We could build something more modern, a warm, welcoming place for people of all races. But to do this, we need to rebuild from the foundations, rather than merely changing the décor. In other words, we need not just a different way of expressing national identity, but a new nation which citizens of all races and classes are part of. Alternatively, we can embrace the global market, stay on an economically liberal path (with a few prudent concessions to the misguided majority), let the world benefit, and let outmoded loyalties die in peace.



