[Returnanalytics-commits] r3427 - pkg/PortfolioAnalytics/sandbox

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jun 19 23:35:30 CEST 2014


Author: rossbennett34
Date: 2014-06-19 23:35:29 +0200 (Thu, 19 Jun 2014)
New Revision: 3427

Added:
   pkg/PortfolioAnalytics/sandbox/BlackLittermanFormula.R
Log:
Adding black litterman formula from Meucci

Copied: pkg/PortfolioAnalytics/sandbox/BlackLittermanFormula.R (from rev 3420, pkg/Meucci/R/BlackLittermanFormula.R)
===================================================================
--- pkg/PortfolioAnalytics/sandbox/BlackLittermanFormula.R	                        (rev 0)
+++ pkg/PortfolioAnalytics/sandbox/BlackLittermanFormula.R	2014-06-19 21:35:29 UTC (rev 3427)
@@ -0,0 +1,30 @@
+#' @title Computes the Black-Litterman formula for the moments of the posterior normal.
+#'
+#' @description This function computes the Black-Litterman formula for the moments of the posterior normal, as described in  
+#' A. Meucci, "Risk and Asset Allocation", Springer, 2005.
+#' 
+#'   @param		Mu       [vector] (N x 1) prior expected values.
+#'   @param		Sigma    [matrix] (N x N) prior covariance matrix.
+#'   @param		P        [matrix] (K x N) pick matrix.
+#'   @param		v        [vector] (K x 1) vector of views.
+#'   @param		Omega    [matrix] (K x K) matrix of confidence.
+#'
+#'   @return	BLMu     [vector] (N x 1) posterior expected values.
+#'   @return	BLSigma  [matrix] (N x N) posterior covariance matrix.
+#'
+#' @references
+#' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170}.
+#'
+#' See Meucci's script for "BlackLittermanFormula.m"
+#'
+#' @author Xavier Valls \email{flamejat@@gmail.com}
+#' @export
+
+BlackLittermanFormula = function( Mu, Sigma, P, v, Omega)
+{
+	BLMu    = Mu + Sigma %*% t( P ) %*% ( solve( P %*% Sigma %*% t( P ) + Omega ) %*% ( v - P %*% Mu ) );
+	BLSigma =  Sigma -  Sigma %*% t( P ) %*% ( solve( P %*% Sigma %*% t( P ) + Omega ) %*% ( P %*% Sigma ) );
+
+	return( list( BLMu = BLMu , BLSigma = BLSigma ) );
+
+}
\ No newline at end of file



More information about the Returnanalytics-commits mailing list