Johan Fourie's blog

I'd rather be a comma than a fullstop

Posts Tagged ‘research

Can Twitter predict the markets?

with one comment

Twitter-PPC

Ask anyone about the pitfalls of Twitter, and they might point to recent gaffs by a prominent South African politician as evidence that the dangers outweigh its benefits. But such warnings have not stopped many others, most notably the president of the United States, from tweeting on a regular basis: Twitter’s user base creates more than 500 million tweets a day, and it has added about 2 million new users in the last quarter of 2016.

Presumably this wealth of information must have some value. Twitter, sadly for its shareholders, struggles to turn such growth into profit: in the last quarter of 2016, revenue growth was only 1%. But because it captures public sentiment at a very granular level, it has attracted the interest of both scientists and entrepreneurs hoping to turn this information into public or private benefit.

The use of social media for prediction is, of course, not a recent phenomenon. Google Flu Trends, founded in 2008, used Google’s search engine to track the spread of flu in 25 countries. But excitement about the project waned as it struggled to make accurate predictions. A 2014 Nature paper noted the value of social media ‘Big Data’, but warned that ‘we are far from a place where they can supplant more traditional methods or theories’.

Twitter, though, seems to attract increasing attention. A 2014 paper uses Twitter to predict crime. A 2015 paper show how psychological language on Twitter predicts heart disease mortality. Another 2015 paper show how Twitter sentiment predicts enrollment of Obamacare. A 2016 paper show how Twitter could be used to predict the 2015 UK general elections.

But it is, understandably, the financial markets that has attracted the most attention. A 2016 paper by Eli Bartov (NYU Stern School of Business), Lucile Faurel (Arizona State University) and Partha Mohanram (University of Toronto) shows how Twitter can predict firm-level earnings and stock returns. They use a dataset of nearly a million corporate tweets by 3662 firms between 2009 and 2012, all tweeted in the nine-trading-day period leading to firms’ quarterly earnings announcements. The authors find, unsurprisingly, that the tweets successfully predicts the company’s forthcoming quarterly earnings, but find, more surprisingly, that the tweets predict the ‘immediate abnormal stock price reaction to the quarterly earnings announcement’. These findings are more pronounced for firms in weaker information environments, such as ‘smaller firms with lower analyst following and lower institutional ownership’, and are not driven by concurrent information from sources other than Twitter, such as press articles or web portals.

It makes sense that corporate communication provides information, but can public sentiment on Twitter also inform market activity? A 2017 NBER Working Paper, by Vahid Gholampour (Bucknell University) and Eric van Wincoop (University of Virginia), answers this question by looking at the Euro/Dollar exchange rate. They start with all Twitter messages that mention EURUSD in their text and that were posted between October 9, 2013 and March 11, 2016. There were 268 770 of these messages, for an average of 578 per day. What they hope to do, is to identify whether informed opinions about future currency changes can actually predict actual currency changes, so they eliminate all tweets that do not express a sentiment about the future behaviour of the two currencies. This reduces the sample to 43 tweets per day, or 27 557 in total. They then classify each of these tweets as positive, neutral or negative using a detailed financial lexicon that they develop to translate verbal tweets into opinions, and create a Twitter Sentiment index for each day. They also split the sample in two: those opinions expressed by individuals with more than 500 followers, which they call the ‘informed opinion’, and those with fewer than 500 followers, which they call the ‘uninformed opinion’.

So what do they find? It turns out that the 633 days of data they have is too short to calculate the Sharpe ratio, a measure of the risk-adjusted return. The annualized Sharpe ratio based on daily returns is 1.09 for the informed group and -0.19 for the uninformed group. The Sharpe ratio of 1.09 for the informed group is impressive, but it has a large standard error of 0.6. The 95% confidence interval is therefore very wide, ranging from -0.09 to 2.27. They then construct a model with a precise information structure, estimate the parameters and then recalculate the Sharpe ratio to average at 1.68 with a 95% confidence interval between 1.59 and 1.78. Success: ‘the large Sharpe ratios that we have reported’, they conclude, ‘suggest that there are significant gains from trading strategies based on Twitter Sentiment’.

If all this sounds terribly complicated, that is exactly the point. Translating opinions into numbers is not an easy undertaking, and discerning the ‘informed’ opinions from the noise is even less so. But there is no doubt that Twitter does offer some useful, perhaps even lucrative, insights. Whoever can exploit that knowledge first, stand to benefit most.

*An edited version of this first appeared in Finweek magazine of 20 April.

Written by Johan Fourie

May 16, 2017 at 06:24

What you need to know about South African exporters

leave a comment »

Ngqura-South-Africa

One of the most profound (and often most difficult to teach) insights in economics is the idea that trade is not a zero-sum game. Just as my salary allow me to purchase all the things I cannot (or don’t want to) produce on my own, so do our exports (of the things we are good at) allow us to buy imports (of the things we are not good at). We do not work simply to accumulate a salary; we work because it allows us to buy nice things.

In other words, we are not mercantilists. A mercantilist hopes to export as much as possible and restrict imports. A large, positive trade balance, they believe, will ‘make a nation rich’. Not so. Mercantilism is not why England experienced an Industrial Revolution, and it is not why Africa will grow rich. Having more exports than imports over the long-run simply means that a country’s citizens are not reaping the fruits of their labour. To return to the earlier metaphor: it’s like earning a salary but not being allowed to purchase anything with it.

It’s easy to sell mercantilist ideas, though. Here is Mr Wilmot in the Legislative Council of the Cape Colony in August 1891: ‘Let us be wise in time, and really patriotic, grow our food, encourage our own industries…’. Or Mr Merriman in the same debate: ‘The best form of Protection was for everybody to set to and buy as much as they could in the Colony. (Hear, hear.)’ Or Mr Van den Heever: ‘The question was to keep, through fostering Colonial industries, the money in the Colony’.

You don’t need to go too far to find similar sentiments in contemporary debates. The clothing and textile industry recently held an Imbizo to discuss ways to grow the industry. Some of the comments on news websites reporting this story summarise the sentiment I often find in my classes too: ‘Chinese imports killed the textile industry in South Africa’, ‘You forget the greedy retailers preferring the cheapest suppliers’, ‘All we need is a 90% buy local campaign’, ‘With a bit of good will and assistance in the form of import restrictions we would all benefit. Jobs, better quality and some pride in the achievement would do all of us some good!’.

Again, not true. Aside from the small detail that the industry has received support since the 1930s, long before China was a competitive force, we should rather export what we are good at, and import the cheap goods which we aren’t relatively good at. (Also, Chinese clothes are becoming increasingly expensive as Chinese wages increase. We are increasingly importing clothes from other parts of Asia, and Africa.)

But how do we do this? Two recent UNU-Wider working papers by South Africa’s foremost trade economists help to answer exactly this question. The first, by a team of economists from North-West University and Stellenbosch University, use a new firm-level dataset of South African manufacturers to understand exporting firms better. They report five key findings: 1) Export participation is rare – only 19% of South African firms export. 2) Exporters are systematically different to non-exporting firms – they are larger, more labour productive, pay higher wages, and are more capital and intermediate-input intensive than non-exports. I will lump all these things together and just say they are ‘better’. 3) Firms that export to multiple destinations and across multiple product lines are ‘better’ across all the dimensions listed above. 4) Exporters to countries outside Africa are ‘better’ across the same dimensions than exporters to countries within Africa. 5) Firms that already export are most likely to grow the total value of exports than new entrants.

The second paper, by researchers at the University of Cape Town and the University of Bari in Italy, use similar data to show that the most productive South African firms are the ones that both import and export. Importing from advanced economies especially makes local firms more productive, and more likely to export at greater scale, scope and value. The authors argue that access for domestic firms to a variety of intermediate inputs from abroad can be crucial to raising local employment and gaining access to new technologies.

The takeaway: South Africa’s exporters need imports to be competitive. We can only grow our local exporting firms by giving them access to the cheapest inputs and the best technologies, and these are often found outside South Africa. Much like our 19th-century ancestors, our zest to expand exports will only inflict harm if we adhere to the mercantilist sentiment by restricting imports.

*An edited version of this first appeared in Finweek magazine of 14 July.

Written by Johan Fourie

August 11, 2016 at 09:13

A LEAP into the future

with 2 comments

Photo by Mario

The past is never dead. It is not even past. Photo by Mario Gerth

This week is conference week. From Monday to Tuesday, STIAS hosts an ERSA Workshop on the ‘Fiscal history of Africa’. With additional funding by the British Academy, we have been able to invite a stellar list of international visitors: Noel Johnson (George Mason), Christian Makgala (Botswana), Leigh Gardner (LSE), and Jutta Bolt (Groningen). And from Wednesday to Friday, another ERSA workshop, this time on ‘Longitudinal data in African history’, will be held at STIAS. Here, too, we have an exciting list of international presenters: Marcella Alsan (Stanford), Bill Collins (Vanderbilt), Jason Long (Wheaton), Ellen Hillbom and Erik Green (Lund), Neil Cummins (LSE) and several PhD-students. More than 30 local participants will be able to share their research and interact with the visitors. Hosting the workshops back-to-back mean that many can stay for both.

The international and local interest in the two workshops shows that African Economic History is in good health. The rise, or renaissance, of African economic history is evident in the popularity of the annual African economic history meetings, rising from a small group of regulars to, as last year in London showed, a wide circle of scholars from diverse disciplines interested in the African past. Word on the street is that this year’s meeting – from 30-31 October in Wageningen, Netherlands – will be the largest yet.

LEAP_logo_US_2It’s this momentum that has been a catalyst for the creation of a new Economic History research unit in the Department of Economics at Stellenbosch University. And so, this Wednesday we will launch the new identity of this research group: LEAP – the Laboratory for the Economics of Africa’s Past. LEAP (see website) is dedicated to the quantitative study of African economic history, bringing together scholars and students interested in understanding and explaining the long-term economic development of Africa’s diverse societies.

The aim of any research institution is, of course, to produce high-quality research output. This, I believe, can only be achieved through 1) access to funding and 2) recruiting high-quality students (from Africa and elsewhere) to exploit those resources. Both require us to nurture deeper networks across Africa, the US and Europe, and build research partnerships through collaborative projects. I am happy to say that this is already happening, as projects on the fiscal history of South Africa (with Leigh Gardner at the LSE), or the impact of railways in Africa (with Alfonso Herranz at Barcelona), or early South African living standards (with Martine Mariotti at Australian National University, Kris Inwood at Guelph University and Alex Moradi at Sussex) demonstrate.

But more can be done. African archives still hold vast quantities of historical records, of which we’ve only scratched the surface, and too few students are exposed to an expanding Economic History literature. It’s now time to take the leap.

Like our Facebook page to stay up-to-date with our research and events.

They say academic papers are boring. They obviously haven’t read these.

with 3 comments

Source: http://xkcd.com/1283/

Source: xkcd

Academic papers in Economics, with few exceptions, have titles that are best described as unappetising: ‘A Heteroskedasticity-Consistent Covariance Matrix Estimator and a Direct Test for Heteroskedasticity‘ zzzzzzzz. So I decided to give some of the most cited papers in Economics a clickbait make-over.* (I chose ten of the 100 most cited papers in Economics.) See if you can guess the paper – the link will take you to their respective Repec pages. And please add more ideas in the comments section.

When Michelle heard what her friends earned in New York, she decided to move there too. She never expected this to happen.

Daniel thought it was a great idea to buy insurance. Then he discovered this.

What is the recipe for economic growth? Finally, we have the answer.

His bank wouldn’t give him a loan. Then Joseph tried this.

My mother said to never trust an economist about the future. But sometimes – like this guy – they get it spectacularly right.

Mosquitoes killed millions of Europeans. This is what happened next.

One more reason to blame the French!

Janet Yellen takes her husband along when she wants to buy a second-hand car. Here’s why.

This guy committed a crime. Here’s why he should not be punished for it.

I laughed so hard when I saw this guy confuse correlation and causation. He should’ve just read this!

Some popular book titles have also been clickbaited. And to those looking for some clickbait inspiration, you can randomly generate your own here.

I doubt that Economics papers will get sexier titles in the near future. But the clickbait movement, whether you like it or not, is here to stay and will perhaps force scholars to sell their papers more overtly. A little bit of clickbaitism might indeed be necessary to attract a larger (non-academic) audience, and help close the gap between the profession and the real world.

*I thank Waldo Krugell for this idea. He introduced a paper on the ‘Spatial persistence of South Africa in the twentieth century’ with a clickbait title – ‘South Africa implemented apartheid. You would never have guessed what happened next’.

Written by Johan Fourie

June 4, 2014 at 10:10