R Function for Simulating Gaussian Processes

This semester my studies all involve one key mathematical object: Gaussian processes. I’m taking a course on stochastic processes (which will talk about Wiener processes, a type of Gaussian process and arguably the most common) and mathematical finance, which involves stochastic differential equations (SDEs) used for derivative pricing, including in the Black-Scholes-Merton equation. Then I’m involved in a Gaussian process and stochastic calculus reading group. So these processes will take up a lot of my attention.

Continue reading


Start Getting and Working with Data with “Data Acquisition and Manipulation with Python”

This news is a few weeks late, but better late than never!

Continue reading

Problems In Estimating GARCH Parameters in R

UPDATE (11/2/17 3:00 PM MDT): I got the following e-mail from Brian Peterson, a well-known R finance contributor, over R’s finance mailing list:

I would strongly suggest looking at rugarch or rmgarch. The primary
maintainer of the RMetrics suite of packages, Diethelm Wuertz, was
killed in a car crash in 2016. That code is basically unmaintained.

I will see if this solves the problem. Thanks Brian! I’m leaving this post up though as a warning to others to avoid fGarch in the future. This was news to me, books often refer to fGarch, so this could be a resource for those looking for working with GARCH models in R why not to use fGarch.

UPDATE (11/2/17 11:30 PM MDT): I tried a quick experiment with rugarch and it appears to be plagued by this problem as well. Below is some quick code I ran. I may post a full study as soon as tomorrow.


spec = ugarchspec(variance.model = list(garchOrder = c(1, 1)), mean.model = list(armaOrder = c(0, 0), include.mean = FALSE), fixed.pars = list(alpha1 = 0.2, beta1 = 0.2, omega = 0.2))
ugarchpath(spec = spec, n.sim = 1000, n.start = 1000) -> x
srs = x@path$seriesSim
spec1 = ugarchspec(variance.model = list(garchOrder = c(1, 1)), mean.model = list(armaOrder = c(0, 0), include.mean = FALSE))
ugarchfit(spec = spec1, data = srs)
ugarchfit(spec = spec1, data = srs[1:100])

These days my research focuses on change point detection methods. These are statistical tests and procedures to detect a structural change in a sequence of data. An early example, from quality control, is detecting whether a machine became uncalibrated when producing a widget. There may be some measurement of interest, such as the diameter of a ball bearing, that we observe. The machine produces these widgets in sequence. Under the null hypothesis, the ball bearing’s mean diameter does not change, while under the alternative, at some unkown point in the manufacturing process the machine became uncalibrated and the mean diameter of the ball bearings changed. The test then decides between these two hypotheses.

Continue reading

Getting S&P 500 Stock Data from Quandl/Google with Python

DISCLAIMER: Any losses incurred based on the content of this post are the responsibility of the trader, not me. I, the author, neither take responsibility for the conduct of others nor offer any guarantees. None of this should be considered as financial advice; the content of this article is only for educational/entertainment purposes.

A few months ago I wrote a blog post about getting stock data from either Quandl or Google using R, and provided a command line R script to automate the task. In this post I repeat the task but with Python. If you’re interested in the motivation and logic of the procedure, I suggest reading the post on the R version. The Python version works similarly.

Continue reading

Mad Libs and Python

It’s been a long time since I’ve written a blog post. As I have written previously, I intentionally scaled back on my blogging. I didn’t want to scale back to the point that I have not written a post since July. But my life has been busy lately, a topic that may be the subject of a future post (for those who care about what goes on in my life). Continue reading

Math: Still Not Everywhere

It’s been a while since I shared something on this site (I’ve been studying for the past month for two qualifying exams, and that consumed all my time). Here I share an excellent article that introduced me to the idea of the “mathematical elite” as a real, socially relevant, and powerful (politically and otherwise) group.

While you’re there, check out the work of Cathy O’Neil (mathbabe). I ready Weapons of Math Destruction in a day during the spring and found it eye-opening and enthralling. I think anyone who works in quantitatively intense subjects should read that book.


This is a guest post by Michael J. Barany, a postdoc in History at Dartmouth.

One year ago, I wrote a post for the Scientific American Guest Blog arguing against the widespread truism that mathematics is everywhere. The post laid out the history of mathematics as a special and exclusive kind of knowledge wielded by privileged elites. I claimed that the idea that math is everywhere not only gets the history wrong, but also misrepresents how mathematics matters most in most people’s lives, and may be a misguided premise on which to build a more inclusive and responsible discipline. If we start by recognizing the bias and exclusion that affect who gets to use advanced mathematics to intervene in the world, we might get better at responding to those biases while empowering the vast majority in the mathematical non-elite to hold the mathematical elite accountable for the great power

View original post 3,196 more words

Let’s Create Our Own Cryptocurrency

Today I’m sharing my favorite blog post of the week, written by a blogger with username cranklin.

Have whatever opinion you want about crypto-currencies, Bitcoin, and so on, but many in the business world take blockchain technology very seriously. (I read about it regularly in The Economist, and a new book by David Birch entitled Before Bablyon, Beyond Bitcoin, imagines a new crypto-currency world order with money entering a new evolutionary state, with everything from governments to community churches issuing their own coins; the book is on my reading list.) Perhaps the best (and most-fun) way to lean about the technology is to create your own crypto-currency. Then share it with your friends and family because why not.

Perhaps at some point in the future I will create my own coin and write about it as well. If I do, I will be using this post as a reference.


I’ve been itching to build my own cryptocurrency… and I shall give it an unoriginal & narcissistic name: Cranky Coin.

After giving it a lot of thought, I decided to use Python. GIL thread concurrency is sufficient. Mining might suffer, but can be replaced with a C mining module. Most importantly, code will be easier to read for open source contributors and will be heavily unit tested. Using frozen pip dependencies, virtualenv, and vagrant or docker, we can fire this up fairly easily under any operating system.

I decided to make Cranky coin a VERY simple, but complete cryptocurrency/blockchain/wallet system. This implementation will not include smart contracts, transaction rewards, nor utilize Merkel trees. Its only purpose is to act as a decentralized ledger. It is rudimentary, but I will eventually fork a few experimental blockchains with advanced features from this one.

The Wallet
This currency will only be compatible with…

View original post 1,688 more words