[Returnanalytics-commits] r2166 - pkg/PortfolioAnalytics/sandbox/attribution/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jul 16 13:32:02 CEST 2012


Author: ababii
Date: 2012-07-16 13:32:01 +0200 (Mon, 16 Jul 2012)
New Revision: 2166

Modified:
   pkg/PortfolioAnalytics/sandbox/attribution/R/Modigliani.R
Log:
- examples update

Modified: pkg/PortfolioAnalytics/sandbox/attribution/R/Modigliani.R
===================================================================
--- pkg/PortfolioAnalytics/sandbox/attribution/R/Modigliani.R	2012-07-16 11:30:54 UTC (rev 2165)
+++ pkg/PortfolioAnalytics/sandbox/attribution/R/Modigliani.R	2012-07-16 11:32:01 UTC (rev 2166)
@@ -4,6 +4,10 @@
 #' adjusted upward or downward to match the benchmark's standard 
 #' deviation.  This puts the portfolio return and the benchmark
 #' return on 'equal footing' from a standard deviation perspective.
+#' \deqn{MM_{p}=\frac{E[R_{p} - R_{f}]}{\sigma_{p}}=SR_{p} * \sigma_{b} + 
+#' E[R_{f}]}{MMp = SRp * sigmab + E[Rf]}
+#' where \eqn{SR_{p}}{SRp} - Sharpe ratio, \eqn{sigma_{b}}{sigmab} - benchmark
+#' standard deviation
 #' 
 #' This is also analogous to some approaches to 'risk parity' 
 #' portfolios, which use (presumably costless) leverage
@@ -15,18 +19,22 @@
 #' @param Rf risk free rate, in same period as your returns
 #' @param \dots any other passthrough parameters 
 #' @author Andrii Babii, Brian G. Peterson
-#' @references  J. Christopherson, D. Carino, W. Ferson. 
-#' Portfolio Performance Measurement and Benchmarking. 2009. McGraw-Hill, 97-99.
+#' @references  J. Christopherson, D. Carino, W. Ferson. \emph{Portfolio 
+#' Performance Measurement and Benchmarking}. 2009. McGraw-Hill, p. 97-99. \cr
+#' Franco Modigliani and Leah Modigliani, "Risk-Adjusted Performance: How to 
+#' Measure It and Why," \emph{Journal of Portfolio Management}, vol.23, no., 
+#' Winter 1997, pp.45-54 \cr
 #' @seealso \code{\link{SharpeRatio}}, \code{\link{TreynorRatio}}
 #' @examples
 #' 
 #' data(managers)
-#' round(Modigliani(managers[,1,drop=FALSE], managers[,8,drop=FALSE], Rf=.035/12),4)
-#' round(Modigliani(managers[,1:6], managers[,8,drop=FALSE], Rf=.035/12),4)
+#' Modigliani(managers[,1,drop=FALSE], managers[,8,drop=FALSE], Rf=.035/12)
+#' Modigliani(managers[,1:6], managers[,8,drop=FALSE], managers[,8,drop=FALSE])
+#' Modigliani(managers[,1:6], managers[,8:7], managers[,8,drop=FALSE])
 #' 
 #' @export
-Modigliani<-function (Ra, Rb, Rf=0, ...)
-{
+Modigliani <- function (Ra, Rb, Rf=0, ...)
+{ # @author Andrii Babii, Brian G. Peterson
     Ra = checkData(Ra)
     Rb = checkData(Rb)
     if (!is.null(dim(Rf))) 
@@ -34,9 +42,9 @@
     Ra.ncols = NCOL(Ra)
     Rb.ncols = NCOL(Rb)
     pairs = expand.grid(1:Ra.ncols, 1:Rb.ncols)
-    mm<-function(Ra, Rb, Rf){
+    mm <- function(Ra, Rb, Rf){
         shr = SharpeRatio(Ra, Rf, FUN = "StdDev")
-        MM = shr*StdDev(Rb)+Rf
+        MM = shr * StdDev(Rb) + mean(Rf)
         return(MM)
     }
     result = apply(pairs, 1, FUN = function(n, Ra, Rb, Rf) mm(Ra[, 



More information about the Returnanalytics-commits mailing list