[R-SIG-Finance] Probability / Standard Deviation Cone

Jason Hart j@@onh@rt4 @ending from icloud@com
Sat Sep 29 17:22:41 CEST 2018


I didn't see this in the archives anywhere but I'm curious if anyone has looked at standard deviation cones to assess how an asset or manager is performing relative to expectations based on longer term volatility and returns, i.e. are they performing ahead of expectations or below.  Here's a picture of a standard deviation cone created in excel which is tedious.  Basically there's the expected long term return plotted as a straight line and then additional plots of 1 & 2 standard deviation bands above and below the expected return.


I'd like to be able to do this in R because it is much quicker and easier than in excel.  I'm able to get the cone but the one thing I'm trying to do is plot an overlay of the cumulative returns on top of the cone.  I can't get these two to play well together b/c one data set is timeseries.  I'd to try and overlay something like chart.CumReturns  from the performanceanalytics package.  Any help is much appreciated

Here's an example plotting the cone in ggplot:
data(edhec)
vol <- StdDev.annualized(edhec[,2]) / 2 * 1:4 # 4 volatility levels
days <- 0:152 #Number of months
spot <- 1 ## starting price point
drift <- Return.cumulative(edhec[,2]) #total return

dat <- expand.grid(days, vol) # nice and long
names(dat) <- c("days", "vol")
dat$upper <- exp(log(spot) + (drift - (dat$vol^2 / 2)) * dat$days / 365 +
dat$vol * sqrt(dat$days / 365))
dat$lower <- exp(log(spot) + (drift - (dat$vol^2 / 2)) * dat$days / 365 -
dat$vol * sqrt(dat$days / 365))

ggplot(dat, aes(x = days,
ymin = lower,
ymax = upper,
group = factor(vol))) + # we need the group to tell
# which ribbons go together
geom_ribbon(alpha = 0.2, fill = "dodgerblue2", color = "gray70") 



 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20180929/45f04eed/attachment.html>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PastedImage-2.png
Type: image/png
Size: 57567 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20180929/45f04eed/attachment.png>


More information about the R-SIG-Finance mailing list