“Markov chain for oil prices”
author: “Alexander Levakov”
date: “December 18, 2014”
Essentially, all models are wrong, but some are useful. George E. P. Box

Oil prices
High oil prices in previous decades seem to vanish as the advances in technology create a cheaper way to get oil out of the ground. But is fracking a crystal ball or wand in the hand of Obama? The truth is that US shale oil doesn’t start to pay back until it achieves a price of at least $50 per barrel. Current production costs vary between that break even point and a price of $80 per barrel. http://oil-price.net/en/articles/falling-oil-price-slows-us-fracking.php
So we have got the problem that can be solved by Markov’s chain. http://en.wikipedia.org/wiki/Markov_chain
Main assumptions
We simplify our problem to the stochastic chain with four finite states: \(S1\) - 80, \(S2\) - 70, \(S3\) - 60, \(S4\) - 50 dollars per barrel.

We assume, standing on the grounds of common sense, that our chain has no absorbing state: high ($80) and low ($50) limits of prices make possible to low and rise prices due to the effect of output costs. So our chain behaves like a mechanical pendulum: left-right or down-up. We got the following transition matrix D for our chain:
library(expm)
## Loading required package: Matrix
##
## Attaching package: 'expm'
##
## The following object is masked from 'package:Matrix':
##
## expm
D<-matrix(c(1/3,2/3,0,0,1/3,1/3,1/3,0,0,1/3,1/3,1/3,0,0,2/3,1/3),nrow=4,ncol=4,byrow=T)
D
## [,1] [,2] [,3] [,4]
## [1,] 0.3333333 0.6666667 0.0000000 0.0000000
## [2,] 0.3333333 0.3333333 0.3333333 0.0000000
## [3,] 0.0000000 0.3333333 0.3333333 0.3333333
## [4,] 0.0000000 0.0000000 0.6666667 0.3333333
Now we need a vector for initial states B to start moving our pendulum:
B<-matrix(c(1,0,0,0),nrow=1)
B
## [,1] [,2] [,3] [,4]
## [1,] 1 0 0 0
Research question
Our goal is to calculate the mean value of oil price C=L*∑Ci for transition matrix D after N attempts to move from initial state vector B:
\[L=B*D^N\]
Example 1
For N=5 and V={1,0,0,0} we got:
L<-B%*%(D%^%5)
L
## [,1] [,2] [,3] [,4]
## [1,] 0.2098765 0.3786008 0.2880658 0.1234568
C<-matrix(c(80,70,60,50),nrow=1)
C
## [,1] [,2] [,3] [,4]
## [1,] 80 70 60 50
sum(L*C)
## [1] 66.74897
So the mean value for oil price C, starting at $80 with 5 attempts to change initial value, is $66.74.Pendulum moves from $80 to $66.74 with spread near $13.26.
Example 2
For N=5 and V={0,1,0,0} we got:
B<-matrix(c(0,1,0,0),nrow=1)
B
## [,1] [,2] [,3] [,4]
## [1,] 0 1 0 0
L<-B%*%(D%^%5)
L
## [,1] [,2] [,3] [,4]
## [1,] 0.1893004 0.3539095 0.3127572 0.1440329
C<-matrix(c(80,70,60,50),nrow=1)
C
## [,1] [,2] [,3] [,4]
## [1,] 80 70 60 50
sum(L*C)
## [1] 65.88477
So the mean value for oil price C, starting at $70 with 5 attempts to change initial value, is $65.88. Pendulum moves from $70 to $65.25 with spread near $4.75.
Example 3
For N=5 and V={0,0,1,0} we got:
B<-matrix(c(0,0,1,0),nrow=1)
B
## [,1] [,2] [,3] [,4]
## [1,] 0 0 1 0
L<-B%*%(D%^%5)
L
## [,1] [,2] [,3] [,4]
## [1,] 0.1440329 0.3127572 0.3539095 0.1893004
C<-matrix(c(80,70,60,50),nrow=1)
C
## [,1] [,2] [,3] [,4]
## [1,] 80 70 60 50
sum(L*C)
## [1] 64.11523
So the mean value for oil price C, starting at $60 with 5 attempts to change initial value, is $64.11. Pendulum goes back from $60 to $64.11 with spread near $4.11.
Example 4
For N=5 and V={0,0,0,1} we got:
B<-matrix(c(0,0,0,1),nrow=1)
B
## [,1] [,2] [,3] [,4]
## [1,] 0 0 0 1
L<-B%*%(D%^%5)
L
## [,1] [,2] [,3] [,4]
## [1,] 0.1234568 0.2880658 0.3786008 0.2098765
C<-matrix(c(80,70,60,50),nrow=1)
C
## [,1] [,2] [,3] [,4]
## [1,] 80 70 60 50
sum(L*C)
## [1] 63.25103
So the mean value for oil price C, starting at $50 with 5 attempts to change initial value, is $63.25. Great! Pendulum goes back from $50 to $63.25 with spread near $13.25.
Conclusion
Although this example of Markov Chain is for demonstration purpose only (for BMD see https://rpubs.com/alex-lev/42458) it can be used for real estimates of oil prices provided we know the true probabilities for transition matrix D and the number of attempts N to move prices. Is it possible? Ask Obama!