Site icon R-bloggers

Using R to analyse MAN AHL Trend

[This article was first published on Copula, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Let’s use the great PerformanceAnalytics package to get some insights on the risk profile of the MAN AHL Trend Fund. It’s a program with a long track record – I believe in the late 80′. The UCITS Fund NAV Data can be downloaded from the fund webpage as xls file- starting 2009.

First let’s import the data into R. I’m using a small function, to import .csv which returns an .xts object named ahl.

#Monthly NAV MAN AHL
loadahl<-function(){
  a=read.table(“ahl_trend.csv”,sep = “,”,dec = “,”)
  a$date = paste(substr(a$V1,1,2),substr(a$V1,4,5),substr(a$V1,7,10),sep=”-“)
  ahl=a$date
  ahl=cbind(ahl,substr(a$V2,1,5))
  a=as.POSIXct(ahl[,1],format=”%d-%m-%Y”)
  ahl=as.xts(as.numeric(ahl[,2]),order.by=a)
  rm(a)
  return(ahl)
}




next we would like to have the monthly returns

monthlyReturn(x, subset=NULL, type='arithmetic',
           leading=TRUE, ...)
 
 which we store in retahl.

 retahl=monthlyReturn(ahl,type=”log”)

Next, I usually plot the chart.Drawdown to get a visual idea, if the product is designed for my risk appetite.


chart.Drawdown(retahl)



table.AnnualizedReturns(retahl)
 
                          monthly.returns
Annualized Return                  0.0212
Annualized Std Dev                 0.1246
Annualized Sharpe (Rf=0%)          0.1702
 
table.DownsideRisk(retahl)
                             monthly.returns
Semi Deviation                        0.0254
Gain Deviation                        0.0222
Loss Deviation                        0.0222
Downside Deviation (MAR=10%)          0.0289
Downside Deviation (Rf=0%)            0.0241
Downside Deviation (0%)               0.0241
Maximum Drawdown                      0.2478
Historical VaR (95%)                 -0.0521
Historical ES (95%)                  -0.0748
Modified VaR (95%)                   -0.0573
Modified ES (95%)                    -0.0730 
 
 

To leave a comment for the author, please follow the link and comment on their blog: Copula.

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.