Remember me

Register  |   Lost password?


Stephen Rush's Blog

Timing csv File Reading in R and Python

November 20, 2013 Comments (0)

I am currently working with trade data organized in large csv files. I took this as an opportunity to learn the Pandas package in Python mostly for the HDF5 integration. As a sanity check, I decided to time three methods: read.csv in R base, fread in the data.table package in R, and read.csv in the Pandas package in Python. Let me first say that I am not a programmer. This test is not a definitive benchmark of the three methods. It is a benchmark of the “out-of-the-box”...

Two-way Sorting in R

March 10, 2013 Comments (0)

One of the popular ways to motivate a two dimensional model is to double sort your data based on quantiles. This makes empirical asset pricing models exceedingly easy to understand. If I had already defined the breakpoints of the sort, I could just use a function like “plyr” to apply a function like “mean” to the data subsets. For my application, I want to create five portfolios based on one characteristic and then form five portfolio within each of the first five based...

Managerial Game Theory

November 19, 2011 Comments (0)

One of the first models covered in game theory is the Prisoner’s Dilemma. I’m sure you’ve heard of it or at least recognize it from episodes of Law and Order. Let’s look at the simple model with 2 individual players so we can eliminate mixed strategy equilibria and focus strictly on pure strategies. The two strategies for each player are “productive” and “exploitive”. The payoffs for the two players can be summarized on the usual grid. Employee Productive...

The Decreasing Marginal Utility of Donuts

September 4, 2011 Comments (0)

This morning I ran through the Dunkin Donuts to pick up two donuts for me and two donuts for my wife. Four donuts cost $3.85 while 6 donuts cost a little over $4.00. The cashier tried to convince me that buying 6 donuts would be cheaper. Understandably, the cashier would not know that I was ordering for only two people or that we prefer not to stuff ourselves with more than two donuts each. Still, I feel like the cashier never quite believes that I understand the cost per donut is lower with an...

Benchmark Investing Stock Selection

August 2, 2011 Comments (0)

A particular insurance company’s investment department measures stock performance against the S&P500 index on an annual basis. The portfolio is long only with no derivatives. The portfolio manager eases into new positions and takes smaller positions outside of the index. The department operates on a monthly trading schedule where all trades for the next month are set within the last week of the current month. Regardless of how much the portfolio outperforms its benchmark, full bonuses...

Graphing Fed Data

August 2, 2011 Comments (0)

The quantmod package is great for grabbing various financial data series from online sources like Google, Yahoo, Oanda, and the Federal Reserve. It also has some nifty technical charts that look very nice but are rather difficult to modify. One such problem is charting multiple data series. In quantmod, you could do this: library(quantmod) variables=c(“INDPRO”,”TCU”); names=c(“Industrial Production”,”Capacity Utilization SA”)...

Value Creation

August 2, 2011 Comments (0)

I hear a lot of opinions on how economic value is created. Some of these opinions are supported by secondhand anecdotal evidence and most of them are used to support various political or social positions. Some of the most absurd theories on value creation even come from wealthy and/or successful people so someone without a business education may be forgiven for believing that this is a philosophical question that can only be answered through a belief in some set of principles. I would like to...

Correlation Graph

August 2, 2011 Comments (0)

Earlier this week, I saw a message in my Twitter feed talking about an unusual correlation pattern between the S&P 500 and the Dow. Unfortunately, the graph produced by the Greg Mankiw recommended site AssetCorrelation.com was grossly inaccurate showing periods of zero correlation between the indices. A few lines of code using the Quantmod package in R can easily replicate the functionality of the site and a prudent analyst can simply load a more reliable data source before arriving at any...

The Effects of Venture Capital Strategy

August 2, 2011 Comments (0)

Introduction Highland Capital and Tallwood Venture Capital represent two strategies of venture capital investing. Highland represents the traditional diversified portfolio strategy where many unrelated investments are made and little operational support is provided by the investor. Tallwood represents the focused portfolio strategy where fewer investments are made in a specific industry and investors are able to provide a greater amount of time and operational support to their firms. Neither of...

The Economist: Status Displays

August 2, 2011 Comments (0)

The Economist recently reported on a study conducted by Rob Nelissen and Marijn Meijers from Tilburg University in the Netherlands on how brands change our personal interactions. Through a series of experiments, the researchers showed that a well-known designer brand alone confers a higher perceived status and wealth on the wearer that alters how others interact with him or her. The positive effect from the label allowed a subject to get more people to take a survey, solicit donations, obtain a...