Friday, 13 March 2015

Oil Prices at $20 a Barrel?

I recently read an interesting article by Anatole Kaletsky on $50 a barrel representing a new ceiling for oil prices. In the article, he describes the tradeoff between competition and monopoly power as prime drivers of oil prices. Over the past 40 years real (inflation adjusted) oil prices have traded in two regimes: 1) a high price regime associated with monopoly power, and 2) a low price regime associated with competitive market power. The dividing line between the two regimes is an oil price of approximately $50 a barrel. Consider the following chart of real oil prices with 2014 as the base year. Oil priced at $50 a barrel does seem to represent a dividing line between high priced monopoly regimes and low priced competitive regimes.



From 1974 to 1985 the oil market operated in a monopoly pricing regime as OPEC exerted its monopoly power.  Between 1986 and 2004 oil prices were determined by competitive pricing. During this time period, new oil from the North Sea and Alaska helped to restore more competition in the world oil market. More recently, from 2005 until the summer of 2014, oil  prices were again determined by monopoly pricing power as oil demand increased faster than supply. If $50 is the divideing line between the competitive and monopolistic regimes, it also looks like $20 is the floor for oil prices in the competitive regime. It is thus possible that if oil prices have switched into a competitive regime, then we could see prices bottom out at $20.

In a competitive market, the price of oil is determined by the marginal cost of production. According to Kaletsky, the marginal cost of production for conventional oil is around $20 per barrel, while the marginal cost of production from US fracking is around $50 per barrel. If we have entered a new competitive pricing regime, then US frackers are the new "swing producers".

This led me to think about a way to empirically determine the threshold price for oil. In response, I estimated a self exciting threshold autoregressive (SETAR) model for real oil prices. SETAR models are designed to model data that changes its pattern depending upon what regime it is in. The SETAR approach chose $57.42 as the threshold value. This is slightly higher than $50 but consistent with what the marginal cost of US fracking could be. Here is what the regime switching plot looks like.


According to the plot, oil prices are still in a high price regime. Remember, one sudden drop in prices does not indicate a regime switch. If, however, oil prices do continue to stay below $57 a barrel signifying a switch into a low price regime, then $20 looks like a price floor.


The R code is posted below. The monthly oil price and CPI data comes from FRED. Notice, that the oil price series needs to be constructed by splicing the old FRED oil price series (OILPRICE) with the more recent one (MCOILWTICO). The resulting SETAR model fits well and the residuals show no discernible pattern.


#########################################################
#  Economic forecasting and analysis
#  Perry Sadorsky
#  March 2015
#  SETAR model of oil prices
##########################################################


# load libraries
library(fpp)
library(tsDyn)


##########################################################
## read in data and prepare data
##########################################################


# import data on monthly oil prices
cpi_oil <- read.csv("C:/oil prices/cpi_oil.csv")
View(cpi_oil)


# tell R that data set is a time series
cpi_oil = ts(cpi_oil, start=1947, frequency=12)
cpi_oil


oil = cpi_oil[,"OILPRICE"]
cpi = cpi_oil[,"CPIAUCSL"]


oil =window(oil,start=1973)
cpi =window(cpi,start=1973)


# rebase cpi
tail(cpi,14)
cpi2014 = mean(  cpi[(816-11):816]  )
cpi_2014 = cpi/cpi2014 * 100


## http://www.project-syndicate.org/commentary/oil-prices-ceiling-and-floor-by-anatole-kaletsky-2015-01
rop = oil/cpi_2014 *100
plot(rop,main="Real oil prices ($/bbl)",xlab="",ylab="",xaxt="n",lwd=4)
axis(1,at=c(seq(from=1974,to=2014,by=2)), las=2)
abline(h=50)
abline(h=20)


rop.ret = 100* diff(log(rop))
plot(rop.ret)
tsdisplay(rop.ret)



#### SETAR model
# select model
selectSETAR(rop, m=6, d=2, nthresh=1)


# estimate model
mod.setar <- setar(rop, m=6, thDelay=0, th= 57.42232 , mL=6, mH=3)
mod.setar
summary(mod.setar)
plot(mod.setar)
par(mfrow=c(1,1))



Tuesday, 3 March 2015

A Wavelet Analysis of Oil Prices and the Canadian Dollar

In a previous post, I investigated the time series relationship between oil prices, the Canadian dollar, and Canadian stock prices (measured using the TSX composite index). A rolling analysis was used to show how the relationship between these variables changes across time.

In this post, I use a wavelet analysis to further explore relationships between oil prices, the Canadian dollar, and Canadian stock prices. Wavelet analysis is a frequency – time domain approach with origins stemming from Fourier analysis and spectral density analysis. Fourier analysis and spectral filtering methods impose strong restrictions on the data structure and in doing so lose information about the time dimension. By comparison, wavelets combine information from the time dimension and frequency dimension. Wavelets do not make strong assumptions about the data generating process. Gencay et al. (2002) and Ramsey (2002) are excellent references on the application of wavelets to economic and financial data.

Below, I apply a wavelet coherence approach to monthly returns on oil prices ($US/barrel) and the $US/$C exchange rate which I denote as FX.



The stronger the relationship (coherence) between the two variables, the more red the colour. Both period and time are measured in months. The cone of influence is indicated by the dashed white line beyond which the estimates are unreliable. It is also, in some cases, possible to assign directionality to the relationship. This is done through the use of phase arrows. The phase arrows are interpreted as follows, where X is FX and Y is oil.

  • right: in-phase
  • left: anti-phase
  • down: X leading Y by 90°
  • up: Y leading X by 90°

The strongest coherence occurs on the time scale between months 250 (October 2006) and 300 (December 2012). Around 11 months on the period scale, the phase arrows are mostly pointing up. This indicates that oil is leading FX. Around month 23 on the period scale, however, the phase arrows are pointing down, indicating that FX is leading oil. The wavelet analysis shows the strongest relationship between FX and oil occurred relative recently with the directionality depending upon the month.




The wavelet coherence between oil prices and the TSX show several pockets of high coherence (around 50 months on the time scale (February 1990), 200 months (August 2002), and 250 - 300 months). All three regions show strong coherence between 8 and 11 periods (months). In the first two regions, the phase arrows are mostly down indicating that the TSX is leading oil. In the 250 to 300 month time period the phase arrows are up between period 8 and 11 indicating that oil leads the TSX.


This analysis presents further results that the relationship between FX and oil prices is complicated and that when using standard time series approaches one should not be surprised to fail to find strong linear relationships between these two variables.



References

Ramsey JB. Wavelets in economics and finance: past and future. Studies in Nonlinear Dynamics & Econometrics 2002;6(3):1–27.

Gencay R, Selcuk F, Whitcher B. An introduction to wavelets and other filtering methods in finance and economics. San Diego,London and Tokyo: Academic Press; 2002.


Here is the R script.

#########################################################
#  Economic forecasting and analysis
#  Perry Sadorsky
#  February 2015
#  wavelets between FXcan and oil prices
##########################################################


# load libraries
library(fpp)
library(quantmod)
library(biwavelet)


##########################################################
## read in data and prepare data
##########################################################

# load data from Yahoo
symbols <- c( "^GSPTSE" )
getSymbols(symbols, from="1986-01-01", src='yahoo')
tsx = GSPTSE[, "GSPTSE.Adjusted", drop=F]
nrow(tsx)


# load data from FRED into new environment
symbol.vec = c("DCOILWTICO" , "DEXCAUS")
data <- new.env()
getSymbols(symbol.vec, src="FRED", env = data)


# fix up FRED data
na.locf(data$DCOILWTICO["1986-01-01::"])-> oil
1/na.locf(data$DEXCAUS["1986-01-01::"])-> fx


fred.merged = merge(oil,fx,join = "inner")
View(fred.merged)
nrow(fred.merged)


series.merged <- merge(fred.merged,tsx,join = "inner")
tail(series.merged)
tail(tsx)
tail(fx)
colnames(series.merged) <- c("oil", "fx", "TSX")


##########################################################
## now convert to monthly data
##########################################################

series.merged.monthly <- series.merged[ endpoints(series.merged, on="months", k=1), ]
View(series.merged.monthly)
y.m = series.merged.monthly


# plot monthly data
par(mfrow=c(3,1))
plot(y.m[,1],main="Oil prices ($/bbl)")
plot(y.m[,2],main="$US/$C")
plot(y.m[,3],main="TSX")
par(mfrow=c(1,1))


##########################################################
# wavelet analysis
##########################################################
# wtc works better with numeric data


oil = as.numeric(y.m[,1])
fx  = as.numeric(y.m[,2])
tsx = as.numeric(y.m[,3])


# compute returns
fx.ret = diff(log(fx)) * 100
oil.ret = diff(log(oil)) * 100
tsx.ret = diff(log(tsx)) * 100
lh = length(oil.ret)


tsdisplay(fx.ret)
tsdisplay(oil.ret)
tsdisplay(tsx.ret)
par(mfrow=c(1,1))


# bind in time dimension
x1 = cbind(1:lh,fx.ret)
x2 = cbind(1:lh,oil.ret)
x3 = cbind(1:lh,tsx.ret)


# wavelet coherence
wtc.fxoil = wtc(x1,x2, nrands=1000)
par(oma=c(0, 0, 0, 1), mar=c(5, 4, 4, 5) + 0.1)
plot(wtc.fxoil, plot.cb=TRUE,plot.phase=TRUE,arrow.size.head=0.15,ylim=c(4,32),main="Wavelet coherence of FX and oil")


wtc.tsxoil = wtc(x3,x2, nrands=1000)
par(oma=c(0, 0, 0, 1), mar=c(5, 4, 4, 5) + 0.1)
plot(wtc.tsxoil, plot.cb=TRUE,plot.phase=TRUE,arrow.size.head=0.15,ylim=c(4,32),main="Wavelet coherence of TSX and oil")