{"word_count": 353, "character_count": 2412}
Once again, I (re)discovered last week at the Rmetrics conference that old tools can be extremely interesting to illustrate complex ideas, like uncertainty in fnancial markets, and stock prices. For instance a 99.5% quantile: we look for the scenario that occur with a probability of 1 out of 200. Are there nice ways to illustrate that quantity ?Consider the monthly evolution of the SP500 index over the last 22 years,&#62; library(quantmod) &#62; getSymbols('^GSPC', from='1990-01-01') [1] "GSPC" &#62; GSPC = adjustOHLC(GSPC,+ symbol.name='^GSPC') &#62; MGSPC = to.monthly(GSPC) &#62; CLOSE = MGSPC$GSPC.Close &#62; plot(CLOSE)It is possible to use Jackknife technique to illustrate uncertainty. The idea, in Jackknife, it to remove one of the observations, and to do that for all observations. More formally, from a sample , we define a (sub)sample where observation  as been removed, i.e. . Then, we can study all samples when one observation was removed.Here, in the context of financial time series, over 270 months, we can wonder what might have been the final value of the index if one observation (i.e. one month) had been removed. It is actually the idea of Jackknife,&#62; R=diff(log(CLOSE)); R=R[-1] &#62; n=length(R) &#62; X=rnorm(n,mean(R),sd(R)) &#62; X=R &#62; MX=t(matrix(X,n,n)) &#62; MX=exp(MX) &#62; diag(MX)=1 &#62; SMX=MX &#62; for(k in 2:n){SMX[,k]=SMX[,k-1]*(MX[,k])}We can plot the different trajectories of the index, when we remove one month,&#62; init=as.numeric(CLOSE[1]) &#62; plot(1:n,init*cumprod(exp(X)),type="l", + xlab="",ylab="",col="white") &#62; for(k in 1:n){lines(0:n,init*c(1,SMX[k,]), + col="light blue")} &#62; lines(0:n,init*c(1,cumprod(exp(X))),lwd=2, + col="blue")This can be used to understand sensitivity, or unccertainty, of financial time series,We can then look closer at the final value of the index, over those 270 scenarios,or we also use a Box-Plot,Here we can clearly see the impact: if we remove one good month, the index ends around 1250, while it reaches 1650 if we remove a bad month. The difference is huge. So instead of talking about volatility (which is actually a complex concept), that Jackknife idea of remove observations might be more intuitive, and much easier to get a first understanding of uncertainty. But those ideas of resampling are great. I will post a nice application soon (but first, I will discuss with some colleagues in Lyon).