Welcome and Introduction to Fractional Differencing (FD Part 1)

So somehow you've wandered into this hazy corner of the internet and found my blog. Not sure how...or why you're exactly here but I hope you'll stay.

Let me introduce myself,

I'm just your run of the mill budding algorithmic trader. I studied Mathematical Economics and Computer Science at the University of Richmond and was looking for an outlet to apply these tools to finance. I grew up in Indonesia (which is where I currently reside) and am actively looking for jobs to leverage these skills (I have been interviewing for a fair number of quant trading companies so don't hesitate to reach out if you need interview tips!).

Unlike most of the quants on the blogosphere, I don't have a phD nor am I considering getting one in the near term future. Nevertheless, I did take every possible statistics course my school offered and I have experience applying many of these concepts (think stationarity, non-parametric sampling, forecasting, boosting) to an algorithmic trading framework.

If you're still early in the process (as we all once were, and as I currently am), some of the things I discuss may be a bit difficult to follow at first. I try my best to put a lot of effort into each and every blog post, ironing out the details wherever I deem necessary so as long as you're statistically inclined (and you don't mind googling the odd proof or two every once in a while) you should be alright :)

Now, for those of you who are experienced, I hope my analysis provides another lens through which you can look at an already familiar technical concept. Your feedback is and always will be much appreciated. In case my posts aren't up to your standards of rigor however, I am keenly awaiting your scathing comments below.

NOW! LET'S GET STARTED 

The main topic I'll be exploring in the next three posts is an idea called fractional differencing. Before I start talking nerd, I do need to outline a few statistical concepts and ideas for you guys.

(WARNING: If you have studied or tinkered with the topics below, feel free to skip this post. My next two will be much more interesting for the math guys out here.)

The format of this post will be the following:
  1. Time-Series Analysis for dummies: What is it and why should I care?
  2. Stationarity: Intuition & Visual Aids
  3. Memory: Intuition 
  4. How does all this relate to fractional Differencing?
As I've mentioned above, I do intend for my posts to be readable by anyone with a keen interest in statistics and applications to finance. Having completed a few college-level math classes will definitely make the journey easier but if you haven't, don't fret, I got you :)

1. Time Series Analysis for Dummies

BOOM. That right there is what you call a time-series. A collection of data points, in this case, adjusted daily close prices of Tesla stock, each given an ordered date/time index. 

There are 2 important characteristics that are found in most financial time series. :
  1. Trends: A trend is a sort of directional bias in the movement of a time series. In our case, Tesla stock does seem to be jumping up and down quite a bit, but for the most part, we see that it trends upwards. These trends are often found in financial series, especially commodity prices. As a matter of fact, one pretty large subset of asset managers called CTAs (commodity trading advisors) use some very sophisticated trend following models. If you are curious, I highly recommend the book Way of the Turtle by Curtis faith.
  2. Serial Dependence: Observations that tend to be close to each other in time are correlated with each other, in other words, dependent on each other. Since Tesla prices do not move a whole lot day-to-day, we can see why this makes sense. 
As researchers in finance, we use time-series to identify trends, signals or anything else that can help us figure out where the prices may be moving in the future. 

2. Stationarity

Let's move on to something a tad more technical, the idea of stationarity in time series. A stationarity time series is one where the mean (average value) and variance (spread of values) is constant over time.

Population Mean and Variance respectively
Stationarity is super important mainly because it's an important assumption for many statistical models we use as researchers like linear regression. It makes the math easy and our lives easier. Unfortunately for us though, the pervasiveness of trends in financial series indicates that means are usually non-constant over time especially when looking at the example above. So, what can we do?

The easiest way to rectify this issue is to take first differences and normalize the values i.e. take the stock price returns instead of raw stock prices. This doesn't necessarily guarantee that our series will turn stationary but it is a pretty good place to start. I do this below for Tesla stock prices. 

Visually, it seems like we're pretty close if not at stationarity. The mean seems to be centered around zero and the variance constant (barring a few blips early-2012 and late-2013). There are of course much more sophisticated ways to test for stationarity like the ADF test, but they each come with their own particular flaws and would probably require a completely separate post to explain!

3. Memory

Time series remember the past. The memory of a particular time series refers to the strength of the past values influencing future values. Strong memory means that past values have a lot of information regarding the future values of a time series and weak memory the converse. But can we quantify memory?

I'm glad you asked! Yes. We can actually, using a lot of different metrics depending on what we define memory to be exactly. I won't be talking much about it here but for those of you interested in its history, I provide a reference at the end of the post. 

4. Fractional Differencing

Alright, so we talked about time series models, how we can make them stationary through first differencing (i.e. extracting returns) and what memory is intuitively. But what the hell do all of these things have to do with fractional differencing?

What do you think happens to memory when I take first differences of my original time series to get returns? Well, since they get closer to mean and variance constant, we can almost think of the returns as independent from each other (keep in mind that, technically, they aren't exactly...). We end up removing a lot of memory from our time series and hence information we could have used to predict the future. But what choice did we have? I did say that we needed to get a stationary series, didn't I? This is a dilemma that has plagued forecasters for a long time now, the stationarity-memory tradeoff. 

Once we take first differences and wipe out all memory, researchers have to resort to using complex techniques to extract the remaining information or signal left in the time series which often leads to false discoveries. But what if I told you there was a middle ground? A place where we don't have to wipe all the memory away from a time series but still have the neat property of it being stationary. This is where fractional differencing comes in to play.

We attempt to answer the question, what is the minimum amount of differentiation that makes a price series stationary while preserving as much memory as possible? Is there a way to fractionally-differentiate a time series? What does that even mean? I know I definitely asked all these questions when I first heard about this idea but considering how powerful it can be, I would ignore it at your own risk. 

That's all for today! My next post will be a quickie going through a formal definition and proof of deriving the formula for fractionally differenced series and the one after will work through an example of how you can do this from the comfort of your own bed. 

Thanks for reading!

P.S. After some thought, I decided that I would include links to the blogs that I used as references for those of you interested in the more technical side:

https://www.quantstart.com/articles/Beginners-Guide-to-Time-Series-Analysis
https://www.quantstart.com/articles/Serial-Correlation-in-Time-Series-Analysis

Inspiration for this post taken from:
Advances in Financial Machine Learning (2018) Marcos Lopez de Prado
https://www.mdpi.com/1099-4300/19/9/437




Comments

  1. Great post and good initiative. Is there any way to message you in private? I have a few questions on the quant trading interviews you might have knowledge of.

    ReplyDelete
    Replies
    1. Sure, just shoot me an email at dhirubhai1996@gmail.com

      Sorry for not getting back to you sooner, need to fix my comment notifications on here!

      Delete

Post a Comment

Popular posts from this blog

Fractional Differencing Implementation (FD Part 3)

Fractional Differencing Derivation Walkthrough (FD Part 2)