[Returnanalytics-commits] r2212 - in pkg/PerformanceAnalytics: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jul 27 18:01:01 CEST 2012


Author: matthieu_lestel
Date: 2012-07-27 18:01:01 +0200 (Fri, 27 Jul 2012)
New Revision: 2212

Added:
   pkg/PerformanceAnalytics/R/FamaBeta.R
   pkg/PerformanceAnalytics/R/Selectivity.R
   pkg/PerformanceAnalytics/man/FamaBeta.Rd
   pkg/PerformanceAnalytics/man/Selectivity.Rd
Modified:
   pkg/PerformanceAnalytics/NAMESPACE
   pkg/PerformanceAnalytics/R/AppraisalRatio.R
   pkg/PerformanceAnalytics/R/ProspectRatio.R
   pkg/PerformanceAnalytics/man/AppraisalRatio.Rd
   pkg/PerformanceAnalytics/man/DownsideDeviation.Rd
   pkg/PerformanceAnalytics/man/ProspectRatio.Rd
Log:
modified jensen's alpha, alternative modified jensen's alpha, selectivity and fama beta with examples and documentation

Modified: pkg/PerformanceAnalytics/NAMESPACE
===================================================================
--- pkg/PerformanceAnalytics/NAMESPACE	2012-07-27 15:24:37 UTC (rev 2211)
+++ pkg/PerformanceAnalytics/NAMESPACE	2012-07-27 16:01:01 UTC (rev 2212)
@@ -83,6 +83,7 @@
     Return.relative,
     sd.annualized,
     sd.multiperiod,
+    Selectivity,
     SemiDeviation,
     SemiVariance,
     SharpeRatio,

Modified: pkg/PerformanceAnalytics/R/AppraisalRatio.R
===================================================================
--- pkg/PerformanceAnalytics/R/AppraisalRatio.R	2012-07-27 15:24:37 UTC (rev 2211)
+++ pkg/PerformanceAnalytics/R/AppraisalRatio.R	2012-07-27 16:01:01 UTC (rev 2212)
@@ -1,28 +1,41 @@
 #' Appraisal ratio of the return distribution
 #'
-#' Appraisal ratio is the Jensen's alpha adjusted for systemeatic risk. The numerator
+#' Appraisal ratio is the Jensen's alpha adjusted for specific risk. The numerator
 #' is divided by specific risk instead of total risk.
 #'
-#' \deqn{Appraisal ratio = \frac{alpha}{\sigma_{\epsilon}}}{Appraisal ratio = Jensen's alpha / specific risk}
+#' Modified Jensen's alpha is Jensen's alpha divided by beta.
 #'
-#' where \eqn{alpha} is the Jensen's alpha and \eqn{\sigma_{epsilon}} is the specific risk.
+#' Alternative Jensen's alpha is Jensen's alpha divided by systematic risk.
 #'
+#' \deqn{Appraisal ratio = \frac{\alpha}{\sigma_{\epsilon}}}{Appraisal ratio = Jensen's alpha / specific risk}
+#'
+#' \deqn{Modified Jensen's alpha = \frac{\alpha}{\beta}}{Modified Jensen's alpha = Jensen's alpha / beta}
+#'
+#' \deqn{Alternative Jensen's alpha = \frac{\alpha}{\sigma_S}}{Alternative Jensen's alpha = Jensen's alpha / systematic risk}
+#'
+#' where \eqn{alpha} is the Jensen's alpha, \eqn{\sigma_{epsilon}} is the specific risk,
+#' \eqn{\sigma_S} is the systematic risk.
+#'
 #' @aliases AppraisalRatio
 #' @param Ra an xts, vector, matrix, data frame, timeSeries or zoo object of
 #' asset returns
 #' @param Rb return vector of the benchmark asset
 #' @param Rf risk free rate, in same period as your returns
-#' @param period number of periods in a year monthly scale = 12, quarterly = 4)
+#' @param method is one of "appraisal" to calculate appraisal ratio, "modified" to
+#' calculate modified Jensen's alpha or "alternative" to calculate alternative
+#' Jensen's alpha.
 #' @param \dots any other passthru parameters
 #' @author Matthieu Lestel
 #' @references Carl Bacon, \emph{Practical portfolio performance measurement 
-#' and attribution}, second edition 2008 p.72
+#' and attribution}, second edition 2008 p.77
 #' 
 #' @keywords ts multivariate distribution models
 #' @examples
 #'
 #' data(portfolio_bacon)
-#' print(AppraisalRatio(portfolio_bacon[,1], portfolio_bacon[,2])) #expected -0.0952
+#' print(AppraisalRatio(portfolio_bacon[,1], portfolio_bacon[,2], method="appraisal")) #expected -0.375
+#' print(AppraisalRatio(portfolio_bacon[,1], portfolio_bacon[,2], method="modified")) 
+#' print(AppraisalRatio(portfolio_bacon[,1], portfolio_bacon[,2], method="alternative"))
 #'
 #' data(managers)
 #' print(AppraisalRatio(managers['1996',1], managers['1996',8]))
@@ -31,8 +44,10 @@
 #' @export 
 
 AppraisalRatio <-
-function (Ra, Rb, Rf = 0, period = 12, ...)
+function (Ra, Rb, Rf = 0, method = c("appraisal", "modified", "alternative"), ...)
 {
+    method = method[1]
+
     Ra = checkData(Ra, method="matrix")
     Rb = checkData(Rb, method="matrix")
 
@@ -46,7 +61,15 @@
 
      if (calcul) {
         Period = Frequency(Ra)
-        result = CAPM.jensenAlpha(Ra,Rb,Rf,Period)/SystematicRisk(Ra,Rb,Rf,Period)
+        switch(method,
+            appraisal   = {
+	    		epsilon = Ra - Rb * CAPM.beta(Ra,Rb,Rf) - CAPM.alpha(Ra,Rb,Rf)
+        		specifikRisk = sqrt(sum((epsilon - mean(epsilon))^2)/length(epsilon))*sqrt(Period)
+        		result = CAPM.jensenAlpha(Ra,Rb,Rf,Period)/specifikRisk
+	    },
+            modified = {result = CAPM.jensenAlpha(Ra,Rb,Rf,Period)/CAPM.beta(Ra,Rb,Rf)},
+	    alternative = {result = CAPM.jensenAlpha(Ra,Rb,Rf,Period)/SystematicRisk(Ra,Rb,Rf, Period)}
+        ) # end switch
      }    
      else {
         result = NA
@@ -55,10 +78,14 @@
     }
     else {
         Ra = checkData(Ra)
-        result = apply(Ra, MARGIN = 2, AppraisalRatio, Rb = Rb, Rf = Rf, ...)
+        result = apply(Ra, MARGIN = 2, AppraisalRatio, Rb = Rb, Rf = Rf, method = method,...)
         result<-t(result)
         colnames(result) = colnames(Ra)
-        rownames(result) = paste("Appraisal ratio (Risk free = ",Rf,")", sep="")
+        switch(method,
+            appraisal   = {rownames(result) = paste("Appraisal ratio (Risk free = ",Rf,")", sep="")},
+            modified = {rownames(result) = paste("Modified Jensen's alpha (Risk free = ",Rf,")", sep="")},
+	    alternative = {rownames(result) = paste("Alternative Jensen's alpha (Risk free = ",Rf,")", sep="")}
+        ) # end switch
         return(result)
     }
 }

Added: pkg/PerformanceAnalytics/R/FamaBeta.R
===================================================================
--- pkg/PerformanceAnalytics/R/FamaBeta.R	                        (rev 0)
+++ pkg/PerformanceAnalytics/R/FamaBeta.R	2012-07-27 16:01:01 UTC (rev 2212)
@@ -0,0 +1,65 @@
+#' Fama beta of the return distribution
+#'
+#' Fama beta is a beta used to calculate the loss of diversification. It is made so
+#' so that the systematic risk is equivalent to the total portfolio risk.
+#'
+#' \deqn{\beta_F = \frac{\sigma_P}{\sigma_M}}{Fama beta = portfolio standard deviation / benchmark standard deviation}
+#'
+#' where \eqn{\sigma_P} is the portfolio standard deviation and \eqn{\sigma_M} is the
+#' market risk
+#'
+#' @aliases FamaBeta
+#' @param Ra an xts, vector, matrix, data frame, timeSeries or zoo object of
+#' asset returns
+#' @param Rb return vector of the benchmark asset 
+#' @param \dots any other passthru parameters
+#' @author Matthieu Lestel
+#' @references Carl Bacon, \emph{Practical portfolio performance measurement 
+#' and attribution}, second edition 2008 p.78
+#' 
+#' @keywords ts multivariate distribution models
+#' @examples
+#'
+#' data(portfolio_bacon)
+#' print(FamaBeta(portfolio_bacon[,1], portfolio_bacon[,2])) #expected 1.03
+#'
+#' data(managers)
+#' print(FamaBeta(managers['1996',1], managers['1996',8]))
+#' print(FamaBeta(managers['1996',1:5], managers['1996',8]))
+#'
+#' @export 
+FamaBeta <-
+function (Ra, Rb, ...)
+{
+    Ra = checkData(Ra, method="matrix")
+    Rb = checkData(Rb, method="matrix")
+
+    if (ncol(Ra)==1 || is.null(Ra) || is.vector(Ra)) {
+     calcul = FALSE   
+     for (i in (1:length(Ra))) {
+     	 if (!is.na(Ra[i])) {
+     	    calcul = TRUE
+	 }
+      }
+
+     if (calcul) {
+     	n1 = length(Ra)
+	n2 = length(Rb)
+        Period1 = Frequency(Ra)
+	Period2 = Frequency(Rb)
+        result = sqrt(var(Ra)*(n1-1)/(n1))*sqrt(Period1) / (sqrt(var(Rb)*(n2-1)/n2)*sqrt(Period2))
+     }    
+     else {
+        result = NA
+     }
+      return(result)
+    }
+    else {
+        Ra = checkData(Ra)
+        result = apply(Ra, MARGIN = 2, FamaBeta, Rb = Rb, ...)
+        result<-t(result)
+        colnames(result) = colnames(Ra)
+        rownames(result) = paste("Fama Beta ", sep="")
+        return(result)
+    }
+}

Modified: pkg/PerformanceAnalytics/R/ProspectRatio.R
===================================================================
--- pkg/PerformanceAnalytics/R/ProspectRatio.R	2012-07-27 15:24:37 UTC (rev 2211)
+++ pkg/PerformanceAnalytics/R/ProspectRatio.R	2012-07-27 16:01:01 UTC (rev 2212)
@@ -3,7 +3,7 @@
 #' Prospect ratio is a ratio used to penalise loss since most people feel loss
 #' greater than gain
 #'
-#' \deqn{ProspectRatio(R) = \frac{frac{1}{n}*\sum^{n}_{i=1}(Max(r_i,0)+2.25*Min(r_i,0) - MAR)}{\sigma_D}}{ProspectRatio(R) = (1/n * sum(Max(ri,0) + 2.25 * Min(ri,0)) - MAR) / DownsideRisk}
+#' \deqn{ProspectRatio(R) = \frac{\frac{1}{n}*\sum^{n}_{i=1}(Max(r_i,0)+2.25*Min(r_i,0) - MAR)}{\sigma_D}}{ProspectRatio(R) = (1/n * sum(Max(ri,0) + 2.25 * Min(ri,0)) - MAR) / DownsideRisk}
 #'
 #' where \eqn{n} is the number of observations of the entire series, MAR is the minimum acceptable return and \eqn{\sigma_D} is the downside risk
 #' 

Added: pkg/PerformanceAnalytics/R/Selectivity.R
===================================================================
--- pkg/PerformanceAnalytics/R/Selectivity.R	                        (rev 0)
+++ pkg/PerformanceAnalytics/R/Selectivity.R	2012-07-27 16:01:01 UTC (rev 2212)
@@ -0,0 +1,37 @@
+#' Selectivity of the return distribution
+#'
+#' Selectivity is the same as Jensen's alpha
+#'
+#' \deqn{Selectivity = r_p - r_f - \beta_p * (b - r_f)}{Selectivity = r_p - r_f - beta_p * (b - r_f)}
+#'
+#' where \eqn{r_f} is the risk free rate, \eqn{\beta_r} is the regression beta,
+#' \eqn{r_p} is the portfolio return and b is the benchmark return
+#'
+#' @aliases Selectivity
+#' @param Ra an xts, vector, matrix, data frame, timeSeries or zoo object of
+#' asset returns
+#' @param Rb return vector of the benchmark asset
+#' @param Rf risk free rate, in same period as your returns
+#' @param \dots any other passthru parameters
+#' @author Matthieu Lestel
+#' @references Carl Bacon, \emph{Practical portfolio performance measurement 
+#' and attribution}, second edition 2008 p.78
+#' 
+#' @keywords ts multivariate distribution models
+#' @examples
+#'
+#' data(portfolio_bacon)
+#' print(Selectivity(portfolio_bacon[,1], portfolio_bacon[,2])) #expected -1.41
+#'
+#' data(managers)
+#' print(Selectivity(managers['1996',1], managers['1996',8]))
+#' print(Selectivity(managers['1996',1:5], managers['1996',8]))
+#'
+#' @export 
+
+Selectivity <-
+function (Ra, Rb, Rf = 0, ...)
+{
+	Period = Frequency(Ra)
+	CAPM.jensenAlpha(Ra,Rb,Rf,Period)
+}

Modified: pkg/PerformanceAnalytics/man/AppraisalRatio.Rd
===================================================================
--- pkg/PerformanceAnalytics/man/AppraisalRatio.Rd	2012-07-27 15:24:37 UTC (rev 2211)
+++ pkg/PerformanceAnalytics/man/AppraisalRatio.Rd	2012-07-27 16:01:01 UTC (rev 2212)
@@ -2,7 +2,9 @@
 \alias{AppraisalRatio}
 \title{Appraisal ratio of the return distribution}
 \usage{
-  AppraisalRatio(Ra, Rb, Rf = 0, period = 12, ...)
+  AppraisalRatio(Ra, Rb, Rf = 0,
+    method = c("appraisal", "modified", "alternative"),
+    ...)
 }
 \arguments{
   \item{Ra}{an xts, vector, matrix, data frame, timeSeries
@@ -12,27 +14,46 @@
 
   \item{Rf}{risk free rate, in same period as your returns}
 
-  \item{period}{number of periods in a year monthly scale =
-  12, quarterly = 4)}
+  \item{method}{is one of "appraisal" to calculate
+  appraisal ratio, "modified" to calculate modified
+  Jensen's alpha or "alternative" to calculate alternative
+  Jensen's alpha.}
 
   \item{\dots}{any other passthru parameters}
 }
 \description{
   Appraisal ratio is the Jensen's alpha adjusted for
-  systemeatic risk. The numerator is divided by specific
-  risk instead of total risk.
+  specific risk. The numerator is divided by specific risk
+  instead of total risk.
 }
 \details{
+  Modified Jensen's alpha is Jensen's alpha divided by
+  beta.
+
+  Alternative Jensen's alpha is Jensen's alpha divided by
+  systematic risk.
+
   \deqn{Appraisal ratio =
-  \frac{alpha}{\sigma_{\epsilon}}}{Appraisal ratio =
+  \frac{\alpha}{\sigma_{\epsilon}}}{Appraisal ratio =
   Jensen's alpha / specific risk}
 
-  where \eqn{alpha} is the Jensen's alpha and
-  \eqn{\sigma_{epsilon}} is the specific risk.
+  \deqn{Modified Jensen's alpha =
+  \frac{\alpha}{\beta}}{Modified Jensen's alpha = Jensen's
+  alpha / beta}
+
+  \deqn{Alternative Jensen's alpha =
+  \frac{\alpha}{\sigma_S}}{Alternative Jensen's alpha =
+  Jensen's alpha / systematic risk}
+
+  where \eqn{alpha} is the Jensen's alpha,
+  \eqn{\sigma_{epsilon}} is the specific risk,
+  \eqn{\sigma_S} is the systematic risk.
 }
 \examples{
 data(portfolio_bacon)
-print(AppraisalRatio(portfolio_bacon[,1], portfolio_bacon[,2])) #expected -0.0952
+print(AppraisalRatio(portfolio_bacon[,1], portfolio_bacon[,2], method="appraisal")) #expected -0.375
+print(AppraisalRatio(portfolio_bacon[,1], portfolio_bacon[,2], method="modified"))
+print(AppraisalRatio(portfolio_bacon[,1], portfolio_bacon[,2], method="alternative"))
 
 data(managers)
 print(AppraisalRatio(managers['1996',1], managers['1996',8]))
@@ -43,7 +64,7 @@
 }
 \references{
   Carl Bacon, \emph{Practical portfolio performance
-  measurement and attribution}, second edition 2008 p.72
+  measurement and attribution}, second edition 2008 p.77
 }
 \keyword{distribution}
 \keyword{models}

Modified: pkg/PerformanceAnalytics/man/DownsideDeviation.Rd
===================================================================
--- pkg/PerformanceAnalytics/man/DownsideDeviation.Rd	2012-07-27 15:24:37 UTC (rev 2211)
+++ pkg/PerformanceAnalytics/man/DownsideDeviation.Rd	2012-07-27 16:01:01 UTC (rev 2212)
@@ -3,9 +3,6 @@
 \alias{DownsidePotential}
 \alias{SemiDeviation}
 \alias{SemiVariance}
-\alias{UpsideDeviation,}
-\alias{UpsidePotential}
-\alias{UpsideVariance,}
 \title{downside risk (deviation, variance) of the return distribution}
 \usage{
   DownsideDeviation(R, MAR = 0,
@@ -14,9 +11,6 @@
   SemiDeviation(R)
 
   SemiVariance(R)
-
-  DownsideDeviation(R, MAR = 0,
-    method = c("full", "subset"), ..., potential = FALSE)
 }
 \arguments{
   \item{R}{an xts, vector, matrix, data frame, timeSeries
@@ -34,25 +28,6 @@
 
   \item{potential}{if TRUE, calculate downside potential
   instead, default FALSE}
-
-  \item{R}{an xts, vector, matrix, data frame, timeSeries
-  or zoo object of asset returns}
-
-  \item{MAR}{Minimum Acceptable Return, in the same
-  periodicity as your returns}
-
-  \item{method}{one of "full" or "subset", indicating
-  whether to use the length of the full series or the
-  length of the subset of the series below the MAR as the
-  denominator, defaults to "subset"}
-
-  \item{author}{one of "Bacon", "Sortino", indicating
-  whether to}
-
-  \item{\dots}{any other passthru parameters}
-
-  \item{potential}{if TRUE, calculate downside potential
-  instead, default FALSE}
 }
 \description{
   Downside deviation, semideviation, and semivariance are
@@ -145,29 +120,9 @@
 SemiDeviation(managers[,1:6])
 SemiVariance (managers[,1,drop=FALSE])
 SemiVariance (managers[,1:6]) #calculated using method="subset"
-#with data used in Bacon 2008
-
-portfolio_return <- c(0.3,2.6,1.1,-1.0,1.5,2.5,1.6,6.7,-1.4,4.0,-0.5,8.1,4.0,-3.7,
--6.1,1.7,-4.9,-2.2,7.0,5.8,-6.5,2.4,-0.5,-0.9)
-MAR = 0.5
-DownsideDeviation(portfolio_return, MAR) #expected 2.55
-DownsidePotential(portfolio_return, MAR) #expected 1.37
-
-#with data of managers
-
-data(managers)
-apply(managers[,1:6], 2, sd, na.rm=TRUE)
-DownsideDeviation(managers[,1:6])  # MAR 0\%
-DownsideDeviation(managers[,1:6], MAR = .04/12) #MAR 4\%
-SemiDeviation(managers[,1,drop=FALSE])
-SemiDeviation(managers[,1:6])
-SemiVariance (managers[,1,drop=FALSE])
-SemiVariance (managers[,1:6]) #calculated using method="subset"
 }
 \author{
   Peter Carl, Brian G. Peterson, Matthieu Lestel
-
-  Peter Carl, Brian G. Peterson, Matthieu Lestel
 }
 \references{
   Sortino, F. and Price, L. Performance Measurement in a
@@ -186,23 +141,6 @@
   especially end note 10
 
   \url{http://en.wikipedia.org/wiki/Semivariance}
-
-  Sortino, F. and Price, L. Performance Measurement in a
-  Downside Risk Framework. \emph{Journal of Investing}.
-  Fall 1994, 59-65. \cr Carl Bacon, \emph{Practical
-  portfolio performance measurement and attribution},
-  second edition 2008
-
-  Plantinga, A., van der Meer, R. and Sortino, F. The
-  Impact of Downside Risk on Risk-Adjusted Performance of
-  Mutual Funds in the Euronext Markets. July 19, 2001.
-  Available at SSRN: \url{http://ssrn.com/abstract=277352}
-  \cr
-
-  \url{http://www.sortino.com/htm/performance.htm} see
-  especially end note 10
-
-  \url{http://en.wikipedia.org/wiki/Semivariance}
 }
 \keyword{distribution}
 \keyword{models}

Added: pkg/PerformanceAnalytics/man/FamaBeta.Rd
===================================================================
--- pkg/PerformanceAnalytics/man/FamaBeta.Rd	                        (rev 0)
+++ pkg/PerformanceAnalytics/man/FamaBeta.Rd	2012-07-27 16:01:01 UTC (rev 2212)
@@ -0,0 +1,47 @@
+\name{FamaBeta}
+\alias{FamaBeta}
+\title{Fama beta of the return distribution}
+\usage{
+  FamaBeta(Ra, Rb, ...)
+}
+\arguments{
+  \item{Ra}{an xts, vector, matrix, data frame, timeSeries
+  or zoo object of asset returns}
+
+  \item{Rb}{return vector of the benchmark asset}
+
+  \item{\dots}{any other passthru parameters}
+}
+\description{
+  Fama beta is a beta used to calculate the loss of
+  diversification. It is made so so that the systematic
+  risk is equivalent to the total portfolio risk.
+}
+\details{
+  \deqn{\beta_F = \frac{\sigma_P}{\sigma_M}}{Fama beta =
+  portfolio standard deviation / benchmark standard
+  deviation}
+
+  where \eqn{\sigma_P} is the portfolio standard deviation
+  and \eqn{\sigma_M} is the market risk
+}
+\examples{
+data(portfolio_bacon)
+print(FamaBeta(portfolio_bacon[,1], portfolio_bacon[,2])) #expected 1.03
+
+data(managers)
+print(FamaBeta(managers['1996',1], managers['1996',8]))
+print(FamaBeta(managers['1996',1:5], managers['1996',8]))
+}
+\author{
+  Matthieu Lestel
+}
+\references{
+  Carl Bacon, \emph{Practical portfolio performance
+  measurement and attribution}, second edition 2008 p.78
+}
+\keyword{distribution}
+\keyword{models}
+\keyword{multivariate}
+\keyword{ts}
+

Modified: pkg/PerformanceAnalytics/man/ProspectRatio.Rd
===================================================================
--- pkg/PerformanceAnalytics/man/ProspectRatio.Rd	2012-07-27 15:24:37 UTC (rev 2211)
+++ pkg/PerformanceAnalytics/man/ProspectRatio.Rd	2012-07-27 16:01:01 UTC (rev 2212)
@@ -18,7 +18,7 @@
 }
 \details{
   \deqn{ProspectRatio(R) =
-  \frac{frac{1}{n}*\sum^{n}_{i=1}(Max(r_i,0)+2.25*Min(r_i,0)
+  \frac{\frac{1}{n}*\sum^{n}_{i=1}(Max(r_i,0)+2.25*Min(r_i,0)
   - MAR)}{\sigma_D}}{ProspectRatio(R) = (1/n *
   sum(Max(ri,0) + 2.25 * Min(ri,0)) - MAR) / DownsideRisk}
 

Added: pkg/PerformanceAnalytics/man/Selectivity.Rd
===================================================================
--- pkg/PerformanceAnalytics/man/Selectivity.Rd	                        (rev 0)
+++ pkg/PerformanceAnalytics/man/Selectivity.Rd	2012-07-27 16:01:01 UTC (rev 2212)
@@ -0,0 +1,50 @@
+\name{Selectivity}
+\alias{Selectivity}
+\title{Selectivity of the return distribution}
+\usage{
+  Selectivity(Ra, Rb, Rf = 0, period = 12, ...)
+}
+\arguments{
+  \item{Ra}{an xts, vector, matrix, data frame, timeSeries
+  or zoo object of asset returns}
+
+  \item{Rb}{return vector of the benchmark asset}
+
+  \item{Rf}{risk free rate, in same period as your returns}
+
+  \item{period}{number of periods in a year monthly scale =
+  12, quarterly = 4)}
+
+  \item{\dots}{any other passthru parameters}
+}
+\description{
+  Selectivity is the same as Jensen's alpha
+}
+\details{
+  \deqn{Selectivity = r_p - r_f - \beta_p * (b -
+  r_f)}{Selectivity = r_p - r_f - beta_p * (b - r_f)}
+
+  where \eqn{r_f} is the risk free rate, \eqn{\beta_r} is
+  the regression beta, \eqn{r_p} is the portfolio return
+  and b is the benchmark return
+}
+\examples{
+data(portfolio_bacon)
+print(Selectivity(portfolio_bacon[,1], portfolio_bacon[,2])) #expected -1.41
+
+data(managers)
+print(Selectivity(managers['1996',1], managers['1996',8]))
+print(Selectivity(managers['1996',1:5], managers['1996',8]))
+}
+\author{
+  Matthieu Lestel
+}
+\references{
+  Carl Bacon, \emph{Practical portfolio performance
+  measurement and attribution}, second edition 2008 p.78
+}
+\keyword{distribution}
+\keyword{models}
+\keyword{multivariate}
+\keyword{ts}
+



More information about the Returnanalytics-commits mailing list