4

I need an advice/ best method on how to rigorously test the influence of categorical predictors (states), or their duration (duration of war/peace in this case) on time series.

How to prove that the increase in prices of oil is caused by war? I would like to get some p-value.

# Example - influence of war on prices of oil
# (completely speculative of course ;D)
price <- c(13,13.5,13,13.5,13,15,15.5,15.5,15,12.5,12,12,12,12.5,14,15,
           14,13.5,12.5,13,13,14,15,13.5,12,12,12,12.5,12,12)
year <- seq(from = 1960, length = 30)
era <- rep(c("peace","war","peace","war","peace","war","peace"),
             times = c(5,4,5,2,3,4,7))
my.data <- data.frame(price = price, year = year, era = era)

# plot
plot(my.data$year, my.data$price, xlab = "year", ylab = "price of oil",
     pch = 20, ylim = c(11,17), cex = 2.2)
lines(my.data$year, my.data$price, col = "blue", lty = 2, lwd = 2)

Can anybody help me? Thank you for any guidance in advance! At least the name of appropriate technique will be helpful.


enter image description here

Ladislav Naďo
  • 2,202
  • 4
  • 21
  • 45
  • Let me start by stating I consider the question a very interesting one, and I would love to see it answered even in its more general form(http://stats.stackexchange.com/questions/99582/find-correlated-regions-from-time-series). I think there are two ways of looking at it. The first is that prices during war are higher, the second is that the onset of a war leads to a price jump. If the second option is what you would like to prove (which I find more interesting but more complicated), should one consider some kind of saturation mechanism associated to the price increment? – pedrofigueira May 24 '14 at 14:27
  • Thank you for your attention @pedrofigueira. You are right, I am not looking for some simple ANOVA solution (comparison of prices between war and peace time), but rather some time series analysis technique. – Ladislav Naďo May 24 '14 at 14:34
  • 1
    Isn't it actually the case that sudden jumps in prices of essential commodities *cause* wars? :-) In fact, I believe you will find that the price of oil increases *before* the onset of many wars. – whuber May 24 '14 at 18:30

2 Answers2

2

The data suggests a possibly useful model enter image description here. TH Actaul and Fitted values are graphed hereenter image description here. Th residual plot does not indicate non-randomness enter image description here . The equation incorporates memory an an identified level shift at period 10 while suggesting a significant effect of the ear variable to be +1.4392 . The full reporting of the statistical model is enter image description here and enter image description here . The P value for the war indicator is close to 0.0 . The method used here was to form a regression model between y and x and then identify the need for the level shift indicator reflecting an unspecified event. Additionally the error structure suggested non-randomness necessitating augmenting the model with an arima process of order (2,0,0)(0,0,0) . In this way the resultant error process is rendered Gaussian and the tests of significance become meaningfulenter image description here.

IrishStat
  • 27,906
  • 5
  • 29
  • 55
  • 1
    remarkably comprehensive answer. If I understood it correctly, it is based on the existance of a regression model on variables $X_1$ and $X_2$. How did you construct that model? – pedrofigueira May 24 '14 at 17:01
  • 1
    The data are fake. Oil prices did not behave as shown. Therefore it is important to focus one's answer on *assumptions, principles, and methods* rather than results. – whuber May 24 '14 at 18:30
  • It is true that my data are FAKE. @whuber could you provide a name for this procedure? How would you call it? (possibly name or package in R) – Ladislav Naďo May 24 '14 at 22:30
  • Thank you @IrishStat for your answer, could you provide a method used for constructing that model? (first plot in your answer - green line and points) – Ladislav Naďo May 25 '14 at 09:51
  • 3
    @Ladislav The method is called Transfer Function or Dynamic Regression. It incorporates Intervention Detection http://www.unc.edu/~jbhill/tsay.pdf procedures which have been extended to cover cases where there are known possible predictors (x=war). – IrishStat May 25 '14 at 12:57
  • 1
    Whether data is real or simulated is not important. What is important is the approach that is taken and understanding the assumptions that are in place AND if and when these assumptions are validated as was the case in my analysis. – IrishStat May 25 '14 at 13:07
1

strucchange package in R (Zeileis et al. 2003) - with this you can identify changes or significant breaks in your time series and study and possibly relate significant break points to war events. Denisiar

denisiar
  • 11
  • 1
  • 1
    You might want to look at my response to http://stats.stackexchange.com/questions/16953/how-to-detect-structural-change-in-a-timeseries . It is VERY important to consider time trend changes. – IrishStat Jun 04 '14 at 12:34