This should be part of the PerformanceAnalytics package and big data constructs 
in R sharp ratio, Jensen's alpha and others would also be readily avl in R and 
MATLAB and bit/git for r and python

————————————
Amit Mittal
PhD in Finance and Accounting (tbd)
IIM Lucknow
http://ssrn.com/author=2665511
*Top 10%, downloaded author since July 2017
————————————
Sent from my Outlook for Android
https://aka.ms/ghei36

________________________________
From: R-SIG-Finance <[email protected]> on behalf of Jason 
Hart via R-SIG-Finance <[email protected]>
Sent: Saturday, September 29, 2018 8:52:41 PM
To: [email protected]
Subject: [R-SIG-Finance] Probability / Standard Deviation Cone

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.
[PastedImage-2.png]

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")




_______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should 
go.

Reply via email to