Introduction
![]() |
Figure 1, Oil Futures vs. Oil |
First, I wanted a high level view of what I wanted to accomplish. I wanted to compare OPEC prices against Oil Futures. By comparing oil futures against oil prices from 2004 to 2016, I was able to gain some back-of-the-envelope insights (Figure 1). The blue represents the expectation that future oil prices will equal the current price.
- At low prices (<$80), the expectation was that the prices will increase.
- At high prices (>$80), the expectation had greater degree of uncertainty. For the most part, the expectation was that the price would drop.
![]() |
Figure 2, Experimenting with Moving Averages |
I ran into some difficulty trying to grasp the concept of moving average. Simply put, for a certain time point, moving averages would take a segment of values around it and average them. Then, it would move onto the next point. Increasing the ‘width’ of the segment can minimize outliers, reduce the impact of short-term panic and remove random noise that are not relevant to the underlying trend. Increasing ‘width’ can erase useful information too. It is a balancing game.
I experimented with different widths in Figure 2. At 5 points, short-term fluctuations are not smoothed out. At 500 points, long-term trends are erased. 100 points would be the optimal width.
plot(rollapply(ccret[,1],5,mean),col=’red’,xlab = “Year”,ylab=”Continuously Compounded Returns”,main = “Returns from OPEC Basket Price with Moving Average”)
legend(‘top’, c(“5 Points”,”50 Points”,”100 Points”,”500 Points”), lty=1, col=c(‘red’,’black’, ‘blue’, ‘green’,’ brown’), bty=’n’, cex=.9)
lines(rollapply(ccret[,1],50,mean),col=’black’)
lines(rollapply(ccret[,1],100,mean),col=’blue’)
lines(rollapply(ccret[,1],500,mean),col=’green’)
![]() |
Figure 3, Comparison between Oil and Oil Futures |
The next step was to compare the actual crude oil price and its future – with the moving average applied to remove any noise. Figure 3 shows that returns from both datasets are pretty much equal: when the future’s quote increase, the current oil’s quote increases proportionally. There is actually a way to quantify the correlation between both datasets.
plot(movingavg[,1], xlab=”Time”, ylab=”Continuously Compounded Returns”,main=”Comparison between Crude Oil Current Prices and Futures”)
lines(movingavg[,2],col=”red”)
legend(‘topleft’, c(“OPEC Crude Oil Basket Price”,”Crude Oil Futures”), lty=1, col=c(‘black’,’red’), bty=’n’, cex=.9)
![]() |
Figure 4, Correlation between Oil and Oil Futures |
Figure 4 illustrates the correlation between Oil and Oil Futures. I can determine that that there is an overall moderate positive correlation between the two datasets. Additionally, I can see that the weakest relationship were during the 2007-2008 financial crisis and 2014-2015 oil glut. A weak relationship means that values are more spread around the expected value.
Simply put, a weak positive relationship means that the investors are uncertain that the oil market will continue in its current trajectory. I can also determine that the 2007 recession took the investing public by surprise (judging by the steep fall) but confidence was decreasing well before the 2014-2015 oil glut
Also, the correlation has been growing stronger since 2015. This means that the belief that the price of oil will stay in its current trajectory has been growing steadily stronger. Unfortunately, the current trajectory for the price of oil is decreasing.
correlate_oil= function(x) cor(x)[1, 2]
oil_cor= rollapply(ccret, width=100, FUN=correlate_oil, by.column=FALSE, align=”right”)
plot(oil_cor,ylab=”Correlation”,xlab=”Time”,main=”Correlation between Continuously Compounded Returns of Oil and Oil Futures”)
I was pleasantly surprised about my conclusions. I learned that during major economic crisis, the public will lose confidence that the oil price will increase. I also learned that the 2014-2015 oil glut could have been predicted as confidence started to dip around 2013. This is surprising as major oil companies should have prepared for this by reducing production instead of later laying off employees. In July 2016, Calgary, a major city dependent on the petroleum industry, had an unemployment rate close to 9% because of the layoffs.
Next steps into my research will be to look at commodities to forecast oil prices – such as gold, copper and even rice.
Resources