<html><body><div>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.</div><div><img src="cid:56f54b24-12b0-4278-844c-22a032b05f55@icloud.com"                                                                                                                                                                                        class="_auto-scale " alt="PastedImage-2.png" title="PastedImage-2.png" style="margin: 10px 10px 10px 0px;" data-inline-image="true" data-mce-style="margin: 10px 10px 10px 0px;" width="732" height="497"></div><div><br data-mce-bogus="1"></div><div>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</div><div><br data-mce-bogus="1"></div><div>Here's an example plotting the cone in ggplot:</div><div>data(edhec)</div><div>vol <- StdDev.annualized(edhec[,2]) / 2 * 1:4 # 4 volatility levels<br>days <- 0:152 #Number of months<br>spot <- 1 ## starting price point<br>drift <- Return.cumulative(edhec[,2]) #total return<br><br>dat <- expand.grid(days, vol) # nice and long<br>names(dat) <- c("days", "vol")<br>dat$upper <- exp(log(spot) + (drift - (dat$vol^2 / 2)) * dat$days / 365 +<br> dat$vol * sqrt(dat$days / 365))<br>dat$lower <- exp(log(spot) + (drift - (dat$vol^2 / 2)) * dat$days / 365 -<br> dat$vol * sqrt(dat$days / 365))<br><br>ggplot(dat, aes(x = days,<br> ymin = lower,<br> ymax = upper,<br> group = factor(vol))) + # we need the group to tell<br> # which ribbons go together<br> geom_ribbon(alpha = 0.2, fill = "dodgerblue2", color = "gray70") <br></div><div><br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div> </div></body></html>