Publications by andrew
Commitments of Traders: Moves in the Last Week
In my previous post I gave some background information on the Commitments of Traders report along with a selection of summary plots. One of the more interesting pieces of information that one can glean from these reports is the shift in trading sentiment from week to week. Below is a plot reflecting the relative change in the number of long and s...
2388 sym R (203 sym/1 pcs) 2 img
Plotting Flows with riverplot
I have been looking for an intuitive way to plot flows or connections between states in a process. An obvious choice is a Sankey Plot, but I could not find a satisfactory implementation in R… until I read the riverplot post by January Weiner. His riverplot package does precisely what I am need. Getting your data into the right format is a sligh...
2812 sym R (1227 sym/5 pcs) 2 img
What does CNN have in common with Carmen Reinhart, Kenneth Rogoff, and Richard Tol: They all made foolish, embarrassing errors that would never have happened had they been using R Markdown
Rachel Cunliffe shares this delight: Had the CNN team used an integrated statistical analysis and display system such as R Markdown, nobody would’ve needed to type in the numbers by hand, and the above embarrassment never would’ve occurred. And CNN should be embarrassed about this: it’s much worse than a simple typo, as it indicates they d...
3859 sym 2 img
Creating More Effective Graphs
A few years ago I ordered a copy of the 2005 edition of Creating More Effective Graphs by Naomi Robbins. Somewhat shamefully I admit that the book got buried beneath a deluge of papers and other books and never received the attention it was due. Having recently discovered the R Graph Catalog, which implements many of the plots from the book using...
1709 sym R (763 sym/1 pcs) 4 img
Zacks Data on Quandl
Data from Zacks Research have just been made available on Quandl. Registered Quandl users have free preview access to these data, which cover the following: Earnings Estimates: forward-looking consensus forecasts; Earnings Surprises: estimated future and actual historical earnings; Earnings Announcements: predictions for earnings announcement...
3368 sym R (2379 sym/5 pcs) 4 img
Simulating Intricate Branching Patterns with DLA
Manfred Schroeder’s book Fractals, Chaos, Power Laws is a fruitful source of interesting topics and projects. He gives a thorough description of Diffusion-Limited Aggregation (DLA) as a technique for simulating physical processes which produce intricate branching structures. Examples, as illustrated below, include Lichtenberg Figures, dielectri...
4236 sym R (6164 sym/5 pcs) 6 img
Downloading Option Chain Data from Google Finance in R: An Update
I recently read an article which showed how to download Option Chain data from Google Finance using R. Interestingly, that article appears to be a close adaption of another article which does the same thing using Python. While playing around with the code from these articles I noticed a couple of things that might benefit from minor tweaks. Befor...
3459 sym R (2467 sym/6 pcs) 4 img
Book Review: R for Business Analytics
The book R for Business Analytics by Ajay Ohri sets out to look at “some of the most common tasks performed by business analysts and helps the user navigate the wealth of information in R and its 4000 packages.” In my opinion it succeeds in covering an extensive range of topics but fails to provide anything of substantial use to its intended ...
2145 sym 2 img
Dealing with a Byte Order Mark (BOM)
I have just been trying to import some data into R. The data were exported from a SQL Server client in tab-separated value (TSV) format. However, reading the data into R the “usual” way produced unexpected results: > data <- read.delim("sample-query.tsv", header = FALSE, stringsAsFactors = FALSE) > head(data) ...
1203 sym R (815 sym/2 pcs) 2 img
The Price of Fuel: How Bad Could It Get?
The cost of fuel in South Africa (and I imagine pretty much everywhere else) is a contentious topic. It varies from month to month and, although it is clearly related to the price of crude oil and the exchange rate, various other forces play an influential role. According to the Department of Energy the majority of South Africa’s fuel is refine...
7421 sym R (2540 sym/3 pcs) 14 img