[Returnanalytics-commits] r2285 - in pkg/Meucci: . demo man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Sep 11 15:38:09 CEST 2012
Author: braverock
Date: 2012-09-11 15:38:08 +0200 (Tue, 11 Sep 2012)
New Revision: 2285
Added:
pkg/Meucci/demo/MeanDiversificationFrontier.R
pkg/Meucci/man/MaxEntropy.Rd
pkg/Meucci/man/MeanTCEntropyFrontier.Rd
Modified:
pkg/Meucci/DESCRIPTION
Log:
- a few more missed merge items from svn r2255, plus roxygen docs
Modified: pkg/Meucci/DESCRIPTION
===================================================================
--- pkg/Meucci/DESCRIPTION 2012-09-11 13:34:29 UTC (rev 2284)
+++ pkg/Meucci/DESCRIPTION 2012-09-11 13:38:08 UTC (rev 2285)
@@ -45,3 +45,16 @@
License: GPL
URL: http://r-forge.r-project.org/projects/returnanalytics/
Copyright: (c) 2012
+Collate:
+ 'CmaCopula.R'
+ 'DetectOutliersviaMVE.R'
+ 'EntropyProg.R'
+ 'FullyFlexibleBayesNets.R'
+ 'HermiteGrid.R'
+ 'InvariantProjection.R'
+ 'logToArithmeticCovariance.R'
+ 'MeanDiversificationFrontier.R'
+ 'MultivariateOUnCointegration.R'
+ 'Prior2Posterior.R'
+ 'RankingInformation.R'
+ 'RobustBayesianAllocation.R'
Added: pkg/Meucci/demo/MeanDiversificationFrontier.R
===================================================================
--- pkg/Meucci/demo/MeanDiversificationFrontier.R (rev 0)
+++ pkg/Meucci/demo/MeanDiversificationFrontier.R 2012-09-11 13:38:08 UTC (rev 2285)
@@ -0,0 +1,33 @@
+# This script computes the mean-diversification efficient frontier
+# see A. Meucci - "Managing Diversification", Risk Magazine, June 2009
+# available at www.ssrn.com
+
+# Code by A. Meucci. This version March 2009.
+# Last version available at MATLAB central as "Managing Diversification"
+
+# inputs
+# upload returns covariance and expectations
+
+# define benchmark and portfolio weights
+N = nrow( Mu )
+w_0 = rep( 1, N ) / N
+
+# define constraints
+# long-short constraints...
+Constr = list()
+Constr$A = rbind( diag( N ), -diag( N ) )
+Constr$b = rbind( as.matrix( rep( 1, N ) ), as.matrix( rep( 0.1, N ) ) )
+Constr$Aeq = t( as.matrix( rep( 1 , N ) ) ) # budget constraint...
+Constr$beq = as.matrix( 1 )
+
+# mean-diversification analysis and frontier
+EntropyFrontier = MeanTCEntropyFrontier( S , Mu , w_b , w_0 , Constr )
+
+# mean-diversification of current allocation
+m = t( Mu ) %*% ( w_0 - w_b )
+s = sqrt( t( w_0 - w_b ) %*% S %*% ( w_0 - w_b ) )
+GenPCResult = GenPCBasis( S , emptyMatrix )
+v_tilde = G %*% ( w_0 - w_b )
+TE_contr = ( v_tilde * v_tilde ) / s
+R_2 = max( 10^(-10) , TE_contr/sum(TE_contr) )
+Ne = exp( -t( R_2 ) %*% log( R_2 ) )
\ No newline at end of file
Added: pkg/Meucci/man/MaxEntropy.Rd
===================================================================
--- pkg/Meucci/man/MaxEntropy.Rd (rev 0)
+++ pkg/Meucci/man/MaxEntropy.Rd 2012-09-11 13:38:08 UTC (rev 2285)
@@ -0,0 +1,37 @@
+\name{MaxEntropy}
+\alias{MaxEntropy}
+\title{This function computes the extreme frontier}
+\usage{
+ MaxEntropy(G, w_b, w_0, Constr)
+}
+\arguments{
+ \item{G}{map weights -> conditional diversification
+ distribution (square root of, not normalized)}
+
+ \item{w_b}{a matrix containing the benchmark weights}
+
+ \item{w_0}{a matrix containing the initial portfolio
+ weights}
+
+ \item{Constr}{a list containing the equality and
+ inequality constraints}
+}
+\value{
+ x a numeric containing the maximum entropy
+
+ \deqn{ N_{ent} \equiv exp \big(-\sum_{n=k+1}^N p_{n} ln
+ p_{n} \big), w_{ \varphi } \equiv argmax_{w \in C, \mu'w
+ \geq \varphi } N_{ent} \big(w\big) }
+}
+\description{
+ This function computes the extreme frontier
+}
+\author{
+ Manan Shah \email{mkshah at cmu.edu}
+}
+\references{
+ A. Meucci - "Managing Diversification", Risk Magazine,
+ June 2009 - Formula (18,19)
+ \url{http://ssrn.com/abstract=1358533}
+}
+
Added: pkg/Meucci/man/MeanTCEntropyFrontier.Rd
===================================================================
--- pkg/Meucci/man/MeanTCEntropyFrontier.Rd (rev 0)
+++ pkg/Meucci/man/MeanTCEntropyFrontier.Rd 2012-09-11 13:38:08 UTC (rev 2285)
@@ -0,0 +1,44 @@
+\name{MeanTCEntropyFrontier}
+\alias{MeanTCEntropyFrontier}
+\title{This function computes the mean diversification efficient frontier}
+\usage{
+ MeanTCEntropyFrontier(S, Mu, w_b, w_0, Constr)
+}
+\arguments{
+ \item{S}{Covariance Matrix}
+
+ \item{Mu}{a matrix containing the expectations}
+
+ \item{w_b}{a matrix containing the benchmark weights}
+
+ \item{w_0}{a matrix containing the initial portfolio
+ weights}
+
+ \item{Constr}{a list containing the equality and
+ inequality constraints}
+}
+\value{
+ a list containing
+
+ Weights
+
+ Ne_s
+
+ R_2_s
+
+ m_s
+
+ s_S
+}
+\description{
+ This function computes the mean diversification efficient
+ frontier
+}
+\author{
+ Manan Shah \email{mkshah at cmu.edu}
+}
+\references{
+ A. Meucci - "Managing Diversification", Risk Magazine,
+ June 2009 \url{http://ssrn.com/abstract=1358533}
+}
+
More information about the Returnanalytics-commits
mailing list