Oil Market Analysis as of March 14, 2017

The following chart displays the historical oil prices and the prices of oil declined by 10% recently.

Rplot04

The late drop in the oil price was little too much and it is believed to rebound soon.

Rplot01

However, the forecasting model projects that the oil prices will increase gradually for next 12 month.

 

Rplot07

The following chart displays the historical oil import by U.S. and the import has been increasing again.

Rplot02

The following chart shows the oil export by U.S. and it has been significantly increasing lately.

Rplot03

 

The following chart displays the net export (Export -Import) of petroleum for U.S. the next export was decreasing, but it begins to increase again due to improvement in U.S. economy.

Rplot05

The following R codes produces the charts above:
library(Quandl)
library(ggplot2)
library(forecast)
library(‘quantmod’)

mydata1=Quandl(“EIA/PET_MCRIMUS1_M”)
mydata2=Quandl(“EIA/PET_MCREXUS1_M”)

oil_price=Quandl(“OPEC/ORB”)

oil=Quandl(“OPEC/ORB”, api_key=”ucUWoKV_gnNZAgY8AQvL”, type=’xts’)

# Quantmod for oil
chartSeries(oil, subset=’last 12 months’)
addMACD()
addBBands()
addCCI()
names(mydata1)[2]<-“Import”
names(mydata2)[2]<-“Export”
names(oil_price)[2]<-“oil_price”

Mergedata<-merge(mydata1, mydata2)

summary(Mergedata)
head(Mergedata)
tail(Mergedata)

Mergedata$netexport<-Mergedata$Export-Mergedata$Import

head(Mergedata)

ggplot(Mergedata,aes(x=Date))+geom_line(aes(y=Import, Color=”Import”))+
geom_line(aes(y=Export, color=”Export”))

ggplot(Mergedata,aes(x=Date))+geom_line(aes(y=Import, Color=”blue”))
ggplot(Mergedata,aes(x=Date))+geom_line(aes(y=Export, Color=”blue”))
ggplot(oil_price,aes(x=Date))+geom_line(aes(y=oil_price, Color=”blue”))
ggplot(Mergedata,aes(x=Date))+geom_line(aes(y=netexport, Color=”blue”))
fit <- arima(oil_price, order=c(2, 0, 1))

fit

summary(oil_price)

Diff365
# predictive accuracy
library(forecast)
accuracy(fit)

# predict next 5 observations
library(forecast)

forecast(fit, 365)

plot(forecast(fit,365))

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s