Gold price and fear
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Via @theEconomist, I understood that there might be connections between the price of Gold (which is said to be extremely high nowadays) and the VIX SP500 index (the option volatility index, i.e. the so-called “fear index“, as discussed – in French- a few months ago). This has been discussed also on several blogs, e.g. http://etfdailynews.com/ or http://blogs.marketwatch.com/. Via Yahoo quotes, it is possible to get also easily the SP500 VIX index.
> library(tseries) > X=get.hist.quote("^VIX") > T=time(VIX) > Y=as.POSIXlt(T)$year+1900 > X2011=X[Y==2011,] > VIX=X2011[,4] > VIX100=as.numeric(VIX)/VIX[1]*100 > T2011=T[Y==2011] > plot(T2011,VIX100,lwd=2,col="red",type="l", + xlab="",ylab="",ylim=c(60,290))
And a huge xls file can give us the price of gold (on a daily basis). But we can extract only one series (with the price in USD, which is the series of interest here)
> goldprice=read.table( + "http://freakonometrics.blog.free.fr/ public/data/goldpriceUSD.csv", + header=TRUE,sep=";",dec=",") > T=as.Date(goldprice$Name,"%d/%m/%y") > GP=goldprice$USdollar > Y=as.POSIXlt(T)$year+1896 > GP2011=GP[Y==2011] > GP100=GP2011/GP2011[1]*100 > T2011=T[Y==2011] > lines(T2011-4*365.25,GP100,lwd=2,col="blue")
We can see that scales are quite different on those two series (starting at 100 at the beginning of January 2011),
An alternative might be not to consider the price of gold, but something more psychological, like Internet researches. It is possible to download the csv file for queries on gold price on Google, via google insight.
> google=read.table( + "http://freakonometrics.blog.free.fr/public/data/google.csv", + skip=4,header=TRUE,sep=",",nrows=51) > W=as.Date(substr(as.character(google$Semaine),1,10)) > G=google$gold.price > G100=G/G[1]*100 > lines(W,G100,lwd=2,col="blue")
which gives the following graph (again, starting at 100 at the beginning of January 2011),
Here, we can clearly observe that the two series are related, maybe cointegrated. Nice isn’t it ?
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.