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.