An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20090518/6e6f6a09/attachment.pl>
Calculating SharpeRatio for several managers with PerformanceAnalytics
4 messages · Jeff Ryan, Peter Carl, Wind
Hi Wind, Try: apply(managers[,c(1,3)],2, SharpeRatio) HAM1 HAM3 0.4481450 0.3289917 HTH Jeff
On Mon, May 18, 2009 at 5:47 AM, Wind <windspeedo99 at gmail.com> wrote:
I wonder whether there is any better method calculating ratios such as SharpRatio, SortinoRatio and so on, for several managers.
library(PerformanceAnalytics) data(managers)
It is ok if we just calculate SharpeRatio for one manager.
SharpeRatio(managers[,1,drop=FALSE])
? ?HAM1 0.448145 But it seems that we could not calculate SharpeRatio for several managers at once.
SharpeRatio(managers[,c(1,3),drop=FALSE])
? ? HAM1 ? ? ?HAM3 0.4670831 0.3161724 The answer for HAM1 is different now.
SharpeRatio(managers[,c(1,2,3),drop=FALSE])
HAM1 HAM2 HAM3 ?NA ? NA ? NA ?I guess maybe I have not use the function properly. If I change the mean function in SharpeRatio or SortinoRatio to colMeans function, it seems ok. Because PerformanceAnalytics provides many useful ratios I wonder whether there are some better methods so one could utilize the ratio calculating for several managers directly. Any suggestion would be appreciated. ? ? ? ?[[alternative HTML version deleted]]
_______________________________________________ R-SIG-Finance at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. -- If you want to post, subscribe first.
Jeffrey Ryan jeffrey.ryan at insightalgo.com ia: insight algorithmics www.insightalgo.com
SharpeRatio was originally written to use on a single column, but because of the behavior of sd, which provides multi-column support, the error isn't obvious. Thanks very much for bringing this to our attention, we'll provide multi-column support for this function in the next release. To ensure column-by-column results in the meantime, you might use: sapply(managers[,c(1,3)], FUN=SharpeRatio)
sapply(managers[,c(1,3)], FUN=SharpeRatio)
HAM1.Column HAM3.Column 0.4481450 0.3289917
SharpeRatio(managers[,1,drop=F])
HAM1 0.448145 Sorry for the inconvenience, and thanks again for pointing this out. pcc
Peter Carl http://www.braverock.com/~peter > I wonder whether there is any better method calculating ratios such as > SharpRatio, SortinoRatio and so on, for several managers. > >>library(PerformanceAnalytics) >>data(managers) > > It is ok if we just calculate SharpeRatio for one manager. >> SharpeRatio(managers[,1,drop=FALSE]) > HAM1 > 0.448145 > > But it seems that we could not calculate SharpeRatio for several managers > at > once. >> SharpeRatio(managers[,c(1,3),drop=FALSE]) > HAM1 HAM3 > 0.4670831 0.3161724 > > The answer for HAM1 is different now. > >> SharpeRatio(managers[,c(1,2,3),drop=FALSE]) > HAM1 HAM2 HAM3 > NA NA NA > > I guess maybe I have not use the function properly. > > If I change the mean function in SharpeRatio or SortinoRatio to colMeans > function, it seems ok. > Because PerformanceAnalytics provides many useful ratios I wonder whether > there are some better methods so one could utilize the ratio calculating > for > several managers directly. > > Any suggestion would be appreciated. > > [[alternative HTML version deleted]] > > _______________________________________________ > R-SIG-Finance at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-sig-finance > -- Subscriber-posting only. > -- If you want to post, subscribe first. >
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20090518/1d995cb4/attachment.pl>