[Returnanalytics-commits] r2918 - in pkg/Meucci: . R demo man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Aug 28 20:02:06 CEST 2013


Author: xavierv
Date: 2013-08-28 20:02:06 +0200 (Wed, 28 Aug 2013)
New Revision: 2918

Added:
   pkg/Meucci/R/EfficientFrontierReturns.R
   pkg/Meucci/R/EfficientFrontierReturnsBenchmark.R
   pkg/Meucci/demo/S_MeanVarianceBenchmark.R
   pkg/Meucci/demo/covNRets.Rda
   pkg/Meucci/man/EfficientFrontierReturns.Rd
   pkg/Meucci/man/EfficientFrontierReturnsBenchmark.Rd
Modified:
   pkg/Meucci/DESCRIPTION
   pkg/Meucci/NAMESPACE
   pkg/Meucci/R/ConvertChangeInYield2Price.R
   pkg/Meucci/R/MaxRsqCS.R
   pkg/Meucci/demo/S_CrossSectionConstrainedIndustries.R
Log:
- added S_MeanVarianceBenchmark demo script from chapter 6 and its associated functions

Modified: pkg/Meucci/DESCRIPTION
===================================================================
--- pkg/Meucci/DESCRIPTION	2013-08-28 10:38:55 UTC (rev 2917)
+++ pkg/Meucci/DESCRIPTION	2013-08-28 18:02:06 UTC (rev 2918)
@@ -89,6 +89,8 @@
     'MvnRnd.R'
     'MleRecursionForStudentT.R'
     'CovertCompoundedReturns2Price.R'
+    'MaxRsqCS.R'
+    'EfficientFrontierReturnsBenchmark.R'
+    'EfficientFrontierReturns.R'
     '
     FitOrnsteinUhlenbeck.R'
-    'MaxRsqCS.R'

Modified: pkg/Meucci/NAMESPACE
===================================================================
--- pkg/Meucci/NAMESPACE	2013-08-28 10:38:55 UTC (rev 2917)
+++ pkg/Meucci/NAMESPACE	2013-08-28 18:02:06 UTC (rev 2918)
@@ -10,6 +10,8 @@
 export(ConvertCompoundedReturns2Price)
 export(Cumul2Raw)
 export(DetectOutliersViaMVE)
+export(EfficientFrontierReturns)
+export(EfficientFrontierReturnsBenchmark)
 export(EntropyProg)
 export(FitExpectationMaximization)
 export(FitMultivariateGarch)

Modified: pkg/Meucci/R/ConvertChangeInYield2Price.R
===================================================================
--- pkg/Meucci/R/ConvertChangeInYield2Price.R	2013-08-28 10:38:55 UTC (rev 2917)
+++ pkg/Meucci/R/ConvertChangeInYield2Price.R	2013-08-28 18:02:06 UTC (rev 2918)
@@ -21,8 +21,9 @@
 ConvertChangeInYield2Price = function( Exp_DY, Cov_DY, Times2Mat, CurrentPrices )
 {
 	Mu    = log( CurrentPrices ) - Times2Mat * Exp_DY;
-	Sigma = diag( Times2Mat^2 ) %*% Cov_DY;
+	Sigma = diag( Times2Mat ^ 2, length(Times2Mat) ) %*% Cov_DY;
 
+
 	Exp_Prices = exp(Mu + (1/2) * diag( Sigma ));
 	Cov_Prices = exp(Mu + (1/2) * diag( Sigma )) %*% t(exp(Mu + (1/2) * diag(Sigma))) * ( exp( Sigma ) - 1);
 

Added: pkg/Meucci/R/EfficientFrontierReturns.R
===================================================================
--- pkg/Meucci/R/EfficientFrontierReturns.R	                        (rev 0)
+++ pkg/Meucci/R/EfficientFrontierReturns.R	2013-08-28 18:02:06 UTC (rev 2918)
@@ -0,0 +1,97 @@
+#' Compute the mean-variance efficient frontier (on returns) by quadratic programming, as described in 
+#' A. Meucci "Risk and Asset Allocation", Springer, 2005
+#'
+#'  @param  NumPortf       : [scalar] number of portfolio in the efficient frontier
+#'  @param  Covariance     : [matrix] (N x N) covariance matrix
+#'  @param  ExpectedValues : [vector] (N x 1) expected returns
+#'  @param  Constraints    : [struct] set of constraints. Default: weights sum to one, and no-short positions
+#'  
+#'  @return ExpectedValue  : [vector] (NumPortf x 1) expected values of the portfolios
+#'  @return Volatility     : [vector] (NumPortf x 1) standard deviations of the portfolios
+#'  @return Composition    : [matrix] (NumPortf x N) optimal portfolios 
+#'
+#' @references
+#' \url{http://symmys.com/node/170}
+#' See Meucci's script for "EfficientFrontierReturns.m"
+#'
+#' @author Xavier Valls \email{flamejat@@gmail.com}
+#' @export
+
+EfficientFrontierReturns = function(NumPortf, Covariance, ExpectedValues, Constraints = NULL)
+{
+
+    NumAssets = ncol(Covariance);
+
+    ##################################################################################################################
+    # determine return of minimum-risk portfolio
+    FirstDegree  = matrix( 0, NumAssets, 1);
+    SecondDegree = Covariance;
+    if( !length(Constraints) )
+    {
+        Aeq  = matrix( 1, 1, NumAssets);
+        beq  = 1;
+        A    = -diag( 1, NumAssets);     # no-short constraint
+        b    = matrix( 0, NumAssets, 1); # no-short constraint
+    }else
+    {
+        Aeq = Constraints$Aeq;
+        beq = Constraints$beq;
+        A   = Constraints$Aleq; # no-short constraint
+        b   = Constraints$bleq; # no-short constraint
+    }    
+
+    x0 = 1 / NumAssets * matrix( 1, NumAssets, 1);
+    Amat = rbind( Aeq, A);
+    bvec = rbind( beq, b);
+######    MinVol_Weights = quadprog( SecondDegree, -FirstDegree, A, b, Aeq, beq, [], [], x0, options );
+    MinVol_Weights = matrix( solve.QP( Dmat = SecondDegree, dvec = -FirstDegree, Amat = -t(Amat), bvec = -bvec, meq = length( beq )  )$solution );
+    MinVol_Return  = t( MinVol_Weights ) %*% ExpectedValues;
+
+    ##################################################################################################################
+    ### Determine return of maximum-return portfolio
+    MaxRet_Return = max(ExpectedValues);
+    MaxRet_Index = which( ExpectedValues == max(ExpectedValues) );
+    ##################################################################################################################
+    ### Slice efficient frontier in NumPortf equally thick horizontal sectors in the upper branch only
+    Step = (MaxRet_Return - MinVol_Return) / (NumPortf - 1);
+    TargetReturns = seq( MinVol_Return, MaxRet_Return, Step );
+
+    ##################################################################################################################
+    ### Compute the NumPortf compositions and risk-return coordinates of the optimal allocations relative to each slice
+
+    # initialization
+    Composition   = matrix( NaN, NumPortf, NumAssets);
+    Volatility    = matrix( NaN, NumPortf, 1);
+    ExpectedValue = matrix( NaN, NumPortf, 1);
+
+    # start with min vol portfolio
+    Composition[ 1, ] = t(MinVol_Weights);
+    Volatility[ 1 ]     = sqrt(t(MinVol_Weights) %*% Covariance %*% MinVol_Weights);
+    ExpectedValue[ 1 ]  = t(MinVol_Weights) %*% ExpectedValues;
+
+    for( i in 2 : (NumPortf - 1) )
+    {
+        # determine least risky portfolio for given expected return
+        AEq = rbind( matrix( 1, 1, NumAssets), t(ExpectedValues) );
+        bEq = rbind( 1, TargetReturns[ i ]);
+        Amat = rbind( AEq, A);
+        bvec = rbind( bEq, b)
+
+        Weights = t( solve.QP( Dmat = SecondDegree, dvec = -FirstDegree, Amat = -t(Amat), bvec = -bvec, meq = length( bEq )  )$solution );
+        #Weights = t(quadprog(SecondDegree, FirstDegree, A, b, AEq, bEq, [], [], x0, options));
+        
+        Composition[ i, ]   = Weights;
+        Volatility[ i ]     = sqrt( Weights %*% Covariance %*% t(Weights));
+        ExpectedValue[ i ]  = Weights %*% ExpectedValues;
+    }
+
+    # add max ret portfolio
+    Weights = matrix( 0, 1, NumAssets);
+    Weights[ MaxRet_Index ] = 1;
+    Composition[ nrow(Composition), ] = Weights;
+    Volatility[ length(Volatility) ]   = sqrt(Weights %*% Covariance %*% t(Weights));
+    ExpectedValue[ length(ExpectedValue) ]  = Weights %*% ExpectedValues;
+
+    return( list( ExpectedValue = ExpectedValue, Volatility = Volatility, Composition = Composition ) );
+
+}
\ No newline at end of file

Added: pkg/Meucci/R/EfficientFrontierReturnsBenchmark.R
===================================================================
--- pkg/Meucci/R/EfficientFrontierReturnsBenchmark.R	                        (rev 0)
+++ pkg/Meucci/R/EfficientFrontierReturnsBenchmark.R	2013-08-28 18:02:06 UTC (rev 2918)
@@ -0,0 +1,98 @@
+#' Compute the mean-variance efficient frontier (on returns) by quadratic programming, as described in 
+#' A. Meucci "Risk and Asset Allocation", Springer, 2005
+#'
+#'  @param  NumPortf       : [scalar] number of portfolio in the efficient frontier
+#'  @param  Covariance     : [matrix] (N x N) covariance matrix
+#'  @param  ExpectedValues : [vector] (N x 1) expected returns
+#'  @param  Benchmark      : [vector] (N x 1) of benchmark weights
+#'  @param  Constraints    : [struct] set of constraints. Default: weights sum to one, and no-short positions
+#'  
+#'  @return ExpectedValue  : [vector] (NumPortf x 1) expected values of the portfolios
+#'  @return Volatility     : [vector] (NumPortf x 1) standard deviations of the portfolios
+#'  @return Composition    : [matrix] (NumPortf x N) optimal portfolios 
+#'
+#' @references
+#' \url{http://symmys.com/node/170}
+#' See Meucci's script for "EfficientFrontierReturnsBenchmark.m"
+#'
+#' @author Xavier Valls \email{flamejat@@gmail.com}
+#' @export
+
+EfficientFrontierReturnsBenchmark = function(NumPortf, Covariance, ExpectedValues, Benchmark, Constraints = NULL)
+{
+
+    NumAssets = ncol(Covariance);
+
+    ##################################################################################################################
+    # determine return of minimum-risk portfolio
+    FirstDegree  = -Covariance %*% Benchmark;
+    SecondDegree = Covariance;
+    if( !length(Constraints) )
+    {
+        Aeq  = matrix( 1, 1, NumAssets);
+        beq  = 1;
+        A    = -diag( 1, NumAssets);     # no-short constraint
+        b    = matrix( 0, NumAssets, 1); # no-short constraint
+    }else
+    {
+        Aeq = Constraints$Aeq;
+        beq = Constraints$beq;
+        A   = Constraints$Aleq; # no-short constraint
+        b   = Constraints$bleq; # no-short constraint
+    }    
+
+    Amat = rbind( Aeq, A);
+    bvec = rbind( beq, b);
+
+######    MinVol_Weights = quadprog( SecondDegree, -FirstDegree, A, b, Aeq, beq, [], [], x0, options );
+    MinVol_Weights = matrix( solve.QP( Dmat = SecondDegree, dvec = -FirstDegree, Amat = -t(Amat), bvec = -bvec, meq = length( beq )  )$solution );
+    MinVol_Return  = t( MinVol_Weights ) %*% ExpectedValues;
+
+    ##################################################################################################################
+    ### Determine return of maximum-return portfolio
+    MaxRet_Return = max(ExpectedValues);
+    MaxRet_Index = which( ExpectedValues == max(ExpectedValues) );
+    ##################################################################################################################
+    ### Slice efficient frontier in NumPortf equally thick horizontal sectors in the upper branch only
+    Step = (MaxRet_Return - MinVol_Return) / (NumPortf - 1);
+    TargetReturns = seq( MinVol_Return, MaxRet_Return, Step );
+
+    ##################################################################################################################
+    ### Compute the NumPortf compositions and risk-return coordinates of the optimal allocations relative to each slice
+
+    # initialization
+    Composition   = matrix( NaN, NumPortf, NumAssets);
+    Volatility    = matrix( NaN, NumPortf, 1);
+    ExpectedValue = matrix( NaN, NumPortf, 1);
+
+    # start with min vol portfolio
+    Composition[ 1, ] = t(MinVol_Weights);
+    Volatility[ 1 ]     = sqrt(t(MinVol_Weights) %*% Covariance %*% MinVol_Weights);
+    ExpectedValue[ 1 ]  = t(MinVol_Weights) %*% ExpectedValues;
+
+    for( i in 2 : (NumPortf - 1) )
+    {
+        # determine least risky portfolio for given expected return
+        AEq = rbind( matrix( 1, 1, NumAssets), t(ExpectedValues) );
+        bEq = rbind( 1, TargetReturns[ i ]);
+        Amat = rbind( AEq, A);
+        bvec = rbind( bEq, b)
+
+        Weights = t( solve.QP( Dmat = SecondDegree, dvec = -FirstDegree, Amat = -t(Amat), bvec = -bvec, meq = length( bEq )  )$solution );
+        #Weights = t(quadprog(SecondDegree, FirstDegree, A, b, AEq, bEq, [], [], x0, options));
+        
+        Composition[ i, ]   = Weights;
+        Volatility[ i ]     = sqrt( Weights %*% Covariance %*% t(Weights));
+        ExpectedValue[ i ]  = Weights %*% ExpectedValues;
+    }
+
+    # add max ret portfolio
+    Weights = matrix( 0, 1, NumAssets);
+    Weights[ MaxRet_Index ] = 1;
+    Composition[ nrow(Composition), ] = Weights;
+    Volatility[ length(Volatility) ]   = sqrt(Weights %*% Covariance %*% t(Weights));
+    ExpectedValue[ length(ExpectedValue) ]  = Weights %*% ExpectedValues;
+
+    return( list( ExpectedValue = ExpectedValue, Volatility = Volatility, Composition = Composition ) );
+
+}
\ No newline at end of file

Modified: pkg/Meucci/R/MaxRsqCS.R
===================================================================
--- pkg/Meucci/R/MaxRsqCS.R	2013-08-28 10:38:55 UTC (rev 2917)
+++ pkg/Meucci/R/MaxRsqCS.R	2013-08-28 18:02:06 UTC (rev 2918)
@@ -109,7 +109,6 @@
     
 
     b = ipop( c = matrix( FirstDegree ), H = SecondDegree, A = Amat, b = bvec, l = lb , u = ub , r = rep(0, length(bvec)) )
-    
     # reshape for output
     G = t( matrix( attributes(b)$primal, N, ) );
 

Modified: pkg/Meucci/demo/S_CrossSectionConstrainedIndustries.R
===================================================================
--- pkg/Meucci/demo/S_CrossSectionConstrainedIndustries.R	2013-08-28 10:38:55 UTC (rev 2917)
+++ pkg/Meucci/demo/S_CrossSectionConstrainedIndustries.R	2013-08-28 18:02:06 UTC (rev 2918)
@@ -1,9 +1,3 @@
-
-##################################################################################################################
-### This script fits a cross-sectional linear factor model creating industry factors, 
-### 
-### == Chapter 3 ==
-##################################################################################################################
 #' This script fits a cross-sectional linear factor model creating industry factors, where the industry factors 
 #' are constrained to be uncorrelated with the market as described in A. Meucci, "Risk and Asset Allocation",
 #' Springer, 2005,  Chapter 3.
@@ -49,6 +43,8 @@
 #BOUNDARIES 
 lb = -100
 ub = 700
+
+#THE ROWS 3 and 6 should be 0 and instead of it we got outliers.
 G   = MaxRsqCS(X, B, W, A, D, Aeq, Deq, lb, ub);
 
 # compute intercept a and residual U

Added: pkg/Meucci/demo/S_MeanVarianceBenchmark.R
===================================================================
--- pkg/Meucci/demo/S_MeanVarianceBenchmark.R	                        (rev 0)
+++ pkg/Meucci/demo/S_MeanVarianceBenchmark.R	2013-08-28 18:02:06 UTC (rev 2918)
@@ -0,0 +1,144 @@
+#' This script projects the distribution of the market invariants for the bond and stock markets
+#' (i.e. the changes in yield to maturity and compounded returns) from the estimation interval to the investment horizon.
+#' Then it computes the distribution of prices at the investment horizon and translates this distribution into the returns 
+#' distribution.
+#' Finally, it computes the mean-variance efficient frontier both for a total-return and for a benchmark-driven investor
+#' Described in A. Meucci,"Risk and Asset Allocation", Springer, 2005,  Chapter 6.
+#'
+#' @references
+#' \url{http://symmys.com/node/170}
+#' See Meucci's script for "S_MeanVarianceBenchmark.m"
+#
+#' @author Xavier Valls \email{flamejat@@gmail.com}
+
+##################################################################################################################
+### Load data
+load("../data/stockSeries.Rda"); 	
+
+###################################################################################################################
+### Inputs
+
+tau       = 4 / 52; # time to horizon expressed in years
+tau_tilde = 1 / 52; # estimation period expressed in years
+FlatCurve = 0.04;   
+TimeToMat = 5 / 52; # time to maturity of bond expressed in years
+
+# parameters of the distribution of the changes in yield to maturity
+u_minus_tau = TimeToMat - tau;
+mu = 0 * u_minus_tau;
+sigma=( 20 + 5 / 4 * u_minus_tau ) / 10000;
+
+nSim   = 100000;
+Budget = 100;
+
+##################################################################################################################
+### Estimation of weekly invariants stock market (compounded returns)
+Week_C = log( StockSeries$Prices.TimeSeries[ -1, ]) - log( StockSeries$Prices.TimeSeries[-nrow(StockSeries$Prices.TimeSeries), ] );
+N = ncol(Week_C);
+
+la = 0.1;
+Shrk_Exp = matrix( 0, N, 1 );
+Exp_C_Hat = ( 1 - la ) * matrix( apply( Week_C, 2, mean ) ) + la * Shrk_Exp;
+
+lb = 0.1;
+Shrk_Cov = diag( 1, N ) * sum(diag(cov(Week_C))) / N;
+Cov_C_Hat = ( 1 - lb ) * cov(Week_C) + lb * (Shrk_Cov);
+
+######################################################################################################(############
+### Stock market projection to horizon and pricing 
+Exp_Hrzn_C_Hat = Exp_C_Hat * tau / tau_tilde;
+Cov_Hrzn_C_Hat = Cov_C_Hat * tau / tau_tilde;
+StockCompReturns_Scenarios = rmvnorm( nSim, Exp_Hrzn_C_Hat, Cov_Hrzn_C_Hat);
+
+StockCurrent_Prices = matrix( StockSeries$Prices.TimeSeries[ nrow(StockSeries$Prices.TimeSeries), ]);
+StockMarket_Scenarios = ( matrix( 1, nSim, 1) %*% t(StockCurrent_Prices)) * exp( StockCompReturns_Scenarios );
+
+##################################################################################################################
+# MV inputs - analytical
+Stock = ConvertCompoundedReturns2Price(Exp_Hrzn_C_Hat, Cov_Hrzn_C_Hat, StockCurrent_Prices);
+print( Stock$Exp_Prices );
+print( Stock$Cov_Prices );
+
+##################################################################################################################
+# MV inputs - numerical
+StockExp_Prices = matrix( apply( StockMarket_Scenarios, 2, mean ));
+StockCov_Prices = cov( StockMarket_Scenarios );
+print(StockExp_Prices);
+print(StockCov_Prices);
+
+##################################################################################################################
+### Bond market projection to horizon and pricing 
+BondCurrent_Prices_Shifted = exp( -FlatCurve * u_minus_tau);
+BondCurrent_Prices = exp( -FlatCurve * TimeToMat);
+
+# generate changes in yield-to-maturity
+DY_Scenarios = matrix( rnorm( nSim, mu * tau / tau_tilde, sigma * sqrt(tau / tau_tilde)) ); 
+# compute the horizon prices, (3.81) in "Risk and Asset Allocation" - Springer
+X = -u_minus_tau * DY_Scenarios;
+BondMarket_Scenarios = BondCurrent_Prices_Shifted * exp(X); 
+
+# MV inputs - analytical
+Exp_Hrzn_DY_Hat  = mu * tau / tau_tilde;
+SDev_Hrzn_DY_Hat = sigma * sqrt(tau / tau_tilde);
+Cov_Hrzn_DY_Hat  = diag( SDev_Hrzn_DY_Hat, length(SDev_Hrzn_DY_Hat) ) %*% diag( SDev_Hrzn_DY_Hat, length(SDev_Hrzn_DY_Hat) );
+Bond = ConvertChangeInYield2Price(Exp_Hrzn_DY_Hat, Cov_Hrzn_DY_Hat, u_minus_tau, BondCurrent_Prices_Shifted);
+print(Bond$Exp_Prices);
+print(Bond$Cov_Prices);
+
+# MV inputs - numerical
+BondExp_Prices = t( mean( BondMarket_Scenarios ));
+BondCov_Prices = cov(BondMarket_Scenarios);
+
+##################################################################################################################
+### Put market together and compute returns
+Current_Prices   = rbind( StockCurrent_Prices, BondCurrent_Prices);
+Prices_Scenarios = cbind( StockMarket_Scenarios, BondMarket_Scenarios )
+Rets_Scenarios   = Prices_Scenarios / (matrix( 1, nSim, 1 ) %*% t(Current_Prices)) - 1;
+E = matrix(apply( Rets_Scenarios, 2, mean));
+S = cov(Rets_Scenarios);
+
+N = ncol(StockSeries$Prices.TimeSeries) + 1;
+w_b = matrix( 1, N, 1) / N; # relative benchmar weights
+
+##################################################################################################################
+### Portolio optimization
+# MV total return quadratic optimization to determine one-parameter frontier of quasi-optimal solutions 
+NumPortf = 40;
+Ef = EfficientFrontierReturns( NumPortf, S, E );
+Rel_ExpectedValue = array( 0, NumPortf );
+Rel_Std_Deviation = array( 0, NumPortf );
+for( k in 1 : NumPortf )
+{
+    Rel_ExpectedValue[ k ] = t( Ef$Composition[ k, ] - w_b) %*% E;
+    Rel_Std_Deviation[ k ] = sqrt(t( Ef$Composition[ k, ] - w_b ) %*% S %*% ( Ef$Composition[ k,  ] - w_b ) );
+}
+
+##################################################################################################################
+### Benchmark-relative statistics
+# MV benchmark-relative quadratic optimization to determine one-parameter frontier of quasi-optimal solutions
+Ef_b = EfficientFrontierReturnsBenchmark(NumPortf, S, E, w_b);
+Rel_ExpectedValue_b = array( 0, NumPortf );
+Rel_Std_Deviation_b = array( 0, NumPortf );
+for( k in 1 : NumPortf )
+{
+	Rel_ExpectedValue_b[ k ] = t( Ef_b$Composition[ k, ]  - w_b ) %*% E; 
+    Rel_Std_Deviation_b[ k ] = sqrt(t( Ef_b$Composition[ k, ] - w_b ) %*% S %*% ( Ef_b$Composition[ k,  ] - w_b ) );
+}
+
+##################################################################################################################
+### Plots
+# frontiers in total return space
+dev.new();
+plot( Ef$Volatility, Ef$ExpectedValue, type = "l", lwd = 2, col = "blue", xlab = "st.dev. rets.", ylab = "exp.val rets.",
+	xlim =c( Ef_b$Volatility[1], Ef_b$Volatility[length(Ef_b$Volatility)] ), ylim = c( min(Ef_b$ExpectedValue), max(Ef_b$ExpectedValue)) );
+lines( Ef_b$Volatility , Ef_b$ExpectedValue, type = "l", lwd = 2, col = "red" );
+legend( "topleft", 1.9, c( "total ret", "relative" ), col = c( "blue","red" ),
+     lty=1, bg = "gray90" );
+
+# frontiers in relative return space
+dev.new();
+plot( Rel_Std_Deviation, Rel_ExpectedValue, type = "l", lwd = 2, col = "blue", xlab = "TE rets.", ylab = "EOP rets.",
+	xlim =c( Rel_Std_Deviation_b[1], Rel_Std_Deviation_b[length(Rel_Std_Deviation_b)] ), ylim = c( min( Rel_ExpectedValue_b ), max( Rel_ExpectedValue_b )) ););
+lines( Rel_Std_Deviation_b, Rel_ExpectedValue_b, lwd = 2, col = "red" );
+legend( "topleft", 1.9, c( "total ret", "relative" ), col = c( "blue","red" ),
+     lty=1, bg = "gray90" );

Added: pkg/Meucci/demo/covNRets.Rda
===================================================================
(Binary files differ)


Property changes on: pkg/Meucci/demo/covNRets.Rda
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: pkg/Meucci/man/EfficientFrontierReturns.Rd
===================================================================
--- pkg/Meucci/man/EfficientFrontierReturns.Rd	                        (rev 0)
+++ pkg/Meucci/man/EfficientFrontierReturns.Rd	2013-08-28 18:02:06 UTC (rev 2918)
@@ -0,0 +1,42 @@
+\name{EfficientFrontierReturns}
+\alias{EfficientFrontierReturns}
+\title{Compute the mean-variance efficient frontier (on returns) by quadratic programming, as described in
+A. Meucci "Risk and Asset Allocation", Springer, 2005}
+\usage{
+  EfficientFrontierReturns(NumPortf, Covariance,
+    ExpectedValues, Constraints = NULL)
+}
+\arguments{
+  \item{NumPortf}{: [scalar] number of portfolio in the
+  efficient frontier}
+
+  \item{Covariance}{: [matrix] (N x N) covariance matrix}
+
+  \item{ExpectedValues}{: [vector] (N x 1) expected
+  returns}
+
+  \item{Constraints}{: [struct] set of constraints.
+  Default: weights sum to one, and no-short positions}
+}
+\value{
+  ExpectedValue : [vector] (NumPortf x 1) expected values
+  of the portfolios
+
+  Volatility : [vector] (NumPortf x 1) standard deviations
+  of the portfolios
+
+  Composition : [matrix] (NumPortf x N) optimal portfolios
+}
+\description{
+  Compute the mean-variance efficient frontier (on returns)
+  by quadratic programming, as described in A. Meucci "Risk
+  and Asset Allocation", Springer, 2005
+}
+\author{
+  Xavier Valls \email{flamejat at gmail.com}
+}
+\references{
+  \url{http://symmys.com/node/170} See Meucci's script for
+  "EfficientFrontierReturns.m"
+}
+

Added: pkg/Meucci/man/EfficientFrontierReturnsBenchmark.Rd
===================================================================
--- pkg/Meucci/man/EfficientFrontierReturnsBenchmark.Rd	                        (rev 0)
+++ pkg/Meucci/man/EfficientFrontierReturnsBenchmark.Rd	2013-08-28 18:02:06 UTC (rev 2918)
@@ -0,0 +1,44 @@
+\name{EfficientFrontierReturnsBenchmark}
+\alias{EfficientFrontierReturnsBenchmark}
+\title{Compute the mean-variance efficient frontier (on returns) by quadratic programming, as described in
+A. Meucci "Risk and Asset Allocation", Springer, 2005}
+\usage{
+  EfficientFrontierReturnsBenchmark(NumPortf, Covariance,
+    ExpectedValues, Benchmark, Constraints = NULL)
+}
+\arguments{
+  \item{NumPortf}{: [scalar] number of portfolio in the
+  efficient frontier}
+
+  \item{Covariance}{: [matrix] (N x N) covariance matrix}
+
+  \item{ExpectedValues}{: [vector] (N x 1) expected
+  returns}
+
+  \item{Benchmark}{: [vector] (N x 1) of benchmark weights}
+
+  \item{Constraints}{: [struct] set of constraints.
+  Default: weights sum to one, and no-short positions}
+}
+\value{
+  ExpectedValue : [vector] (NumPortf x 1) expected values
+  of the portfolios
+
+  Volatility : [vector] (NumPortf x 1) standard deviations
+  of the portfolios
+
+  Composition : [matrix] (NumPortf x N) optimal portfolios
+}
+\description{
+  Compute the mean-variance efficient frontier (on returns)
+  by quadratic programming, as described in A. Meucci "Risk
+  and Asset Allocation", Springer, 2005
+}
+\author{
+  Xavier Valls \email{flamejat at gmail.com}
+}
+\references{
+  \url{http://symmys.com/node/170} See Meucci's script for
+  "EfficientFrontierReturnsBenchmark.m"
+}
+



More information about the Returnanalytics-commits mailing list