Quant Mashup - OSM
Quantocracy is now on Bluesky and Threads. See the links in the header. - Mike
Day 22: Error Correction [OSM]
On Day 21, we wrung our hands with frustration over how to proceed. The results of our circular block sampling suggested we shouldn’t expect a whole lot of outperformance in our 12-by-12 model out-of-sample. To deal with this our choices were, back to the drawing board or off to the waterboard to
- 1 day ago, 19 Nov 2024, 04:41pm -
Day 21: Drawing Board [OSM]
On Day 20 we completed our analysis of the 12-by-12 strategy using circular block sampling on the 3 and 7 blocks. We found the strategy did not outperform buy-and-hold on average and its frequency of outperformance was modest – in the 28-31% range – insufficient to warrant actually executing the
- 2 days ago, 18 Nov 2024, 04:41pm -
Day 20: Strategy Sample [OSM]
On Day 19, we introduced circular block sampling and used it to test the likelihood the 200-day SMA strategy would outperform buy-and-hold over a five year period. We found that the 200-day outperformed buy-and-hold a little over 25% of the time across 1,000 simulations. The frequency of the
- 6 days ago, 14 Nov 2024, 06:47pm -
Day 19: Circular Sample [OSM]
On Day 18 we started to discuss simulating returns to quantify the probability of success for a strategy out-of-sample. The reason for this was we were unsure whether or how much to merit the 12-by-12’s performance relative to the 200-Day SMA. We discussed various simulation techniques, but we
- 1 week ago, 13 Nov 2024, 08:40pm -
Day 18: Autocorrelation Again! [OSM]
On Day 17 , we compared the 12-by-12 and 200-day SMA strategies in terms of magnitude and duration of drawdowns, finding in favor of the 200-day. We also noted that most of the contributors to the differences in performance were due to two periods at the beginning and end of the period we were
- 1 week ago, 12 Nov 2024, 10:34pm -
Day 17: Drawdowns [OSM]
On Day 16, we showed the adjusted 12-by-12 strategy with full performance metrics against buy-and-hold, the 60-40 SPY-IEF ETF portfolio, and the 200-day SMA strategy. In all cases, it tended to perform better than the benchmarks. However, against the 200-day SMA that performance came primarily at
- 1 week ago, 12 Nov 2024, 10:34pm -
Day 16: Comps [OSM]
On Day 15 we adjusted our model to use more recent data to forecast the 12-week look forward return. As before, we used that forecast to generate a trading signal that tells us to go long the SPY if the forecast is positive, and exit (or short for the long-short strategy) if otherwise. We saw this
- 1 week ago, 10 Nov 2024, 09:14pm -
Day 15: Backtest II [OSM]
On Day 14 we showed how the trading model we built was snooping and provided one way to correct it. Essentially, we ensure the time in which we actually have the target variable data aligns with when the trading signals are produced. We then used the value of the next time step to input into the
- 1 week ago, 7 Nov 2024, 09:36pm -
Day 14: Snooping [OSM]
Guess what? The model we built in our last post actually suffers from snooping. We did this deliberately to show how easy it is to get mixed up when translating forecasting models into trading signals. Let’s explain. Our momentum model uses a 12-week cumulative return lookback to forecast the next
- 1 week ago, 7 Nov 2024, 09:35pm -
Day 13: Backtest I [OSM]
Unlucky 13! Or contrarian indicator? There’s really nothing so heartwarming as magical thinking. Whatever the case, on Day 12 we iterated through the 320 different model and train step iterations to settle on 10 potential candidates. Today, we look at the best performing candidate and discuss the
- 2 weeks ago, 5 Nov 2024, 10:16pm -
Day 12: Iteration [OSM]
In Day 11, we presented an initial iteration of train/forecast steps to see if one combination performs better than another. Our metric of choice was root mean-squared error (RMSE)1 which is frequently used to compare model performance in machine learning circles. The advantage of RMSE is that it is
- 2 weeks ago, 5 Nov 2024, 10:16pm -
Day 11: Autocorrelation [OSM]
On Day 10, we analyzed the performance of the 12-by-12 model by examining the predicted values and residuals. Our initial takeaway suggested the model did seem not overly biased or misspecified in the -10% to 10% region. But when it gets outside that range, watch out! We suspected that there was
- 2 weeks ago, 3 Nov 2024, 09:38pm -
Day 10: Residuals [OSM]
On Day 9 we conducted a walk-forward analysis on the 12-by-12 week lookback-look forward combination. We then presented the canonical the actual vs. predicted value graph with a 45o line overlay to show what a perfect forecast would look like. Here’s the graph again. As noted previously, we
- 2 weeks ago, 3 Nov 2024, 09:38pm -
Day 9: Forecast [OSM]
Yesterday we finished up our analysis of the regression models we built using different combinations of lookback and look forward momentum values. Today, we see if we can generate good forecasts using that data. If you’re wondering why we still haven’t tested Fibonacci retracements with
- 2 weeks ago, 1 Nov 2024, 12:06am -
Day 8: Baseline effects [OSM]
Yesterday, we discussed the size effects, their statistical significance (e.g., p-values), and some other summary statistics for the various momentum combinations – namely, 3, 6, 9, and 12 week lookback and look forward returns. We found that size effects were small, but a few were significant,
- 3 weeks ago, 30 Oct 2024, 08:07pm -
Day 7: Size effects [OSM]
Welcome to the last day of the first week of 30 days of backtesting! We hope you’re enjoying the ride. If you have any questions or concerns, you can reach us at the contact details listed at the bottom of this post. On Day 6 we defined momentum rather roughly and ran a bunch of tests to identify
- 3 weeks ago, 30 Oct 2024, 08:07pm -
Day 6: Momentum [OSM]
Yesterday we examined the eponymous Fama-French factors to see if we could find something that will help us develop an investment strategy to backtest. It turned out the best performing factor was the market risk premium, which is essentially the return to the market in excess of the risk-free rate.
- 3 weeks ago, 28 Oct 2024, 10:05pm -
Day 5: Trifactor [OSM]
The day has finally arrived! Time to start backtesting! We’ve always wanted to test how Fibonacci retracements with Bollinger Band breakouts filtered by Chaikin Volatility would perform while implementing rolling stop-loss updates based on the ATR scaled by the 7-day minus 5-day implied volatility
- 3 weeks ago, 26 Oct 2024, 08:24pm -
Day 4: First analysis [OSM]
We’re four days in and you’re probably wondering when are we actually going to start backtesting?! The answer is that while it is natural to want to rush to the fun part – the hope and elation of generating outsized returns and Sharpe Ratios greater than 2 – the reality is getting the
- 3 weeks ago, 26 Oct 2024, 08:24pm -
Day 3: Metrics [OSM]
Yesterday we investigated the effect of using the 200-day simple moving average (200SMA) as a proxy for a rules-based investing method. The idea was to approximate what a reasonably rational actor/agent might do in addition to the buy-and-hold approach. When folks talk about research, backtesting,
- 3 weeks ago, 26 Oct 2024, 08:24pm -
Day 2: Hello World [OSM]
On Day 1, we decided on a few benchmarks to use for our backtest. That is, a 60-40 and 50-50 weighting of the SPY and IEF ETFs. What we want to add in now is the Hello World version of trading strategies – the 200-DAY MOVING AVERAGE! Why are we adding this to our analysis? As we pointed out
- 4 weeks ago, 23 Oct 2024, 09:56pm -
Day 1: Benchmarks [OSM]
Yesterday we set out our plan to backtest a strategy using the SPY ETF, which tracks the S&P 500. Before we commence, we obviously need to establish a baseline. What metrics will we use to assess the strategy? How will we define success? What benchmarks will we use? Typically, for a single asset
- 4 weeks ago, 22 Oct 2024, 08:26pm -
Closing the loop [OSM]
Summer has a way of getting away from you. That is as much relevant for blog writing as it is for life. Nonetheless, before summer ends we wanted to dust off our series on regime prediction and close the loop on the remaining techniques we had yet to investigate. That is, in our last post we
- 2 months ago, 29 Aug 2024, 09:30pm -
Rolling regime [OSM]
Our last post finished up examining the three different methods used to predict market regimes in the Gold Miners ETF, GDX – namely, clustering, Gaussian Mixture Methods (GMMs), and Hidden Markov Models (HMMs). We found GMMs performed the best in terms of proof-of-concept. But there was a lot of
- 4 months ago, 26 Jun 2024, 10:36pm -
Hidden miners [OSM]
We conclude our discussion of market regime detection by examining Hidden Markov Models (HMMs). Recall this series was inspired by a post from PyQuant News that highlighted a longer article from the London Stock Exchange Group (LSEG). Those who took the CFA exams probably forgot using HMMs in the
- 5 months ago, 30 May 2024, 04:34am -
Gaussian gold [OSM]
Our previous post, used hierarchical clustering to identify market regimes in the gold miners ETF, GDX. This was inspired by a post from PyQuant News that highlighted a longer article from the London Stock Exchange Group (LSEG). In this post, we’ll continue looking at identifying market regimes
- 5 months ago, 21 May 2024, 09:18pm -
Golden clusters [OSM]
We recently saw a post from PyQuant News that piqued our interest, compelling us to dust off the old blog files and get back into the saddle. The post highlights a longer article from the London Stock Exchange Group (LSEG) on how to use different machine learning models to identify and forecast
- 6 months ago, 17 May 2024, 06:21pm -
One-N against the world! [OSM]
We’re taking a short break from neural networks to return to portfolio optimization. Our last posts in the portfolio series discussed risk-constrained optimization. Before that we examined satisificing vs. mean-variance optimization (MVO). In our last post on that topic, we simulated 1,000
- 3 years ago, 3 Nov 2021, 10:52am -
Netting income [OSM]
For fundamental equity investors, the financial statement is the launchpad for the search for value. True, quants use financial statements too. But they spend less time on what the numbers mean, than on what they are. To produce a financial statement that adequately captures the economic (not GAAP
- 3 years ago, 15 Sep 2021, 10:03pm -
Trees and networks [OSM]
It’s been over a month since our last post and for that we must apologize. We endeavor to be more prolific, but sometimes work and life get in the way. On the work front, let’s just say we won’t have to spend as much time selling encyclopedias door-to-door, which should free up more time to
- 3 years ago, 21 May 2021, 10:51pm -
Not so soft softmax [OSM]
Our last post examined the correspondence between a logistic regression and a simple neural network using a sigmoid activation function. The downside with such models is that they only produce binary outcomes. While we argued (not very forcefully) that if investing is about assessing the probability
- 3 years ago, 2 Apr 2021, 10:07pm -
Activate sigmoid! [OSM]
In our last post, we introduced neural networks and formulated some of the questions we want to explore over this series. We explained the underlying architecture, the basics of the algorithm, and showed how a simple neural network could approximate the results and parameters of a linear regression.
- 3 years ago, 12 Mar 2021, 08:49pm -
Nothing but (neural) net [OSM]
We start a new series on neural networks and deep learning. Neural networks and their use in finance are not new. But are still only a fraction of the research output. A recent Google scholar search found only 6% of the articles on stock price price forecasting discussed neural networks.1 Artificial
- 3 years ago, 26 Feb 2021, 09:19pm -
Risk-constrained optimization [OSM]
Our last post parsed portfolio optimization outputs and examined some of the nuances around the efficient frontier. We noted that when you start building portfolios with a large number of assets, brute force simulation can miss the optimal weighting scheme for a given return or risk profile. While
- 3 years ago, 8 Feb 2021, 08:32am -
Parsing portfolio optimization [OSM]
Our last few posts on risk factor models haven’t discussed how we might use such a model in the portfolio optimization process. Indeed, although we’ve touched on mean-variance optimization, efficient frontiers, and maximum Sharpe ratios in this portfolio series, we haven’t discussed portfolio
- 3 years ago, 31 Jan 2021, 08:05pm -
More factors, more variance...explained [OSM]
Risk factor models are at the core of quantitative investing. We’ve been exploring their application within our portfolio series to see if we could create such a model to quantify risk better than using a simplistic volatility measure. That is, given our four portfolios (Satisfactory, Naive, Max
- 3 years ago, 16 Jan 2021, 10:15am -
Macro variance [OSM]
In our last post, we looked at using a risk factor model to identify potential sources of variance for our 30,000 portfolio simulations. We introduced the process with a view ultimately to construct a model that could help to quantify, and thus mitigate, sources of risk beyond a simplistic
- 3 years ago, 31 Dec 2020, 11:08pm -
Explaining variance [OSM]
We’re returning to our portfolio discussion after detours into topics on the put-write index and non-linear correlations. We’ll be investigating alternative methods to analyze, quantify, and mitigate risk, including risk-constrained optimization, a topic that figures large in factor research.
- 3 years ago, 15 Dec 2020, 07:53pm -
Round about the kernel [OSM]
In our last post, we took our analysis of rolling average pairwise correlations on the constituents of the XLI ETF one step further by applying kernel regressions to the data and comparing those results with linear regressions. Using a cross-validation approach to analyze prediction error and
- 4 years ago, 12 Nov 2020, 06:58pm -
Kernel of error [OSM]
In our last post, we looked at a rolling average of pairwise correlations for the constituents of XLI, an ETF that tracks the industrials sector of the S&P 500. We found that spikes in the three-month average coincided with declines in the underlying index. There was some graphical evidence of a
- 4 years ago, 26 Oct 2020, 11:40pm -
Corr-correlation [OSM]
We recently read two blog posts from Robot Wealth and FOSS Trading on calculating rolling pairwise correlations for the constituents of an S&P 500 sector index. Both posts were very interesting and offered informative ways to solve the problem using different packages in R: tidyverse or xts.
- 4 years ago, 9 Oct 2020, 11:13pm -
Writing conundrums [OSM]
We’re taking a break from our portfolio series and million sample simulations to return to a subject that we haven’t discussed of late despite its featured spot in this blog’s name—options. In this post, we’ll look at the buy-write (BXM) and put-write (PUT) indices on the S&P 500, as
- 4 years ago, 25 Sep 2020, 08:13pm -
Sequential satisficing [OSM]
In our last post, we ran simulations on our 1,000 randomly generated return scenarios to compare the average and risk-adjusted return for satisfactory, naive, and mean-variance optimized (MVO) maximum return and maximum Sharpe ratio portfolios.1 We found that you can shoot for high returns or high
- 4 years ago, 18 Sep 2020, 09:58pm -
Satisficing and optimizing [OSM]
In our last post, we explored mean-variance optimization (MVO) and finally reached the efficient frontier. In the process, we found that different return estimates yielded different frontiers both retrospectively and prospectively. We also introduced the concept of satsificing, originally developed
- 4 years ago, 26 Aug 2020, 09:38pm -
I like to MVO it! [OSM]
In our last post, we ran through a bunch of weighting scenarios using our returns simulation. This resulted in three million portfolios comprised in part, or total, of four assets: stocks, bonds, gold, and real estate. These simulations relaxed the allocation constraints to allow us to exclude
- 4 years ago, 31 Jul 2020, 11:59pm -
Weighting on a friend [OSM]
Our last few posts on portfolio construction have simulated various weighting schemes to create a range of possible portfolios. We’ve then chosen portfolios whose average weights yield the type of risk and return we’d like to achieve. However, we’ve noted there is more to portfolio
- 4 years ago, 24 Jul 2020, 11:48pm -
Testing expectations [OSM]
In our last post, we analyzed the performance of our portfolio, built using the historical average method to set return expectations. We calculated return and risk contributions and examined changes in allocation weights due to asset performance. We briefly considered whether such changes warranted
- 4 years ago, 10 Jul 2020, 12:41pm -
Performance anxiety [OSM]
In our last post, we took a quick look at building a portfolio based on the historical averages method for setting return expectations. Beginning in 1987, we used the first five years of monthly return data to simulate a thousand possible portfolio weights, found the average weights that met our
- 4 years ago, 26 Jun 2020, 04:57am -
Portfolio simulations [OSM]
In our last post, we compared the three most common methods used to set return expectations prior to building a portfolio. Of the three—historical averages, discounted cash flow models, and risk premia models—no single method dominated the others on average annual returns over one, three, and
- 4 years ago, 13 Jun 2020, 12:20pm -
Mad methods [OSM]
Over the past few weeks, we’ve examined the three major methods used to set return expectations as part of the portfolio allocation process. Those methods were historical averages, discounted cash flow models, and risk premia models. Today, we’ll bring all these models together to compare and
- 4 years ago, 29 May 2020, 09:03pm -