[Returnanalytics-commits] r3141 - in pkg/Meucci: R demo man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Sep 19 10:29:51 CEST 2013
Author: xavierv
Date: 2013-09-19 10:29:50 +0200 (Thu, 19 Sep 2013)
New Revision: 3141
Modified:
pkg/Meucci/R/BlackLittermanFormula.R
pkg/Meucci/R/ButterflyTradingFunctions.R
pkg/Meucci/R/ConvertChangeInYield2Price.R
pkg/Meucci/R/CovertCompoundedReturns2Price.R
pkg/Meucci/R/EfficientFrontierPrices.R
pkg/Meucci/R/EfficientFrontierReturns.R
pkg/Meucci/R/EfficientFrontierReturnsBenchmark.R
pkg/Meucci/R/GenerateUniformDrawsOnUnitSphere.R
pkg/Meucci/R/Log2Lin.R
pkg/Meucci/R/PlotCompositionEfficientFrontier.R
pkg/Meucci/R/PlotMarginalsNormalInverseWishart.R
pkg/Meucci/demo/S_BuyNHold.R
pkg/Meucci/demo/S_CPPI.R
pkg/Meucci/demo/S_MeanVarianceBenchmark.R
pkg/Meucci/demo/S_MeanVarianceCalls.R
pkg/Meucci/demo/S_MeanVarianceHorizon.R
pkg/Meucci/demo/S_MeanVarianceOptimization.R
pkg/Meucci/demo/S_UtilityMax.R
pkg/Meucci/man/BlackLittermanFormula.Rd
pkg/Meucci/man/ConvertChangeInYield2Price.Rd
pkg/Meucci/man/ConvertCompoundedReturns2Price.Rd
pkg/Meucci/man/EfficientFrontierPrices.Rd
pkg/Meucci/man/EfficientFrontierReturns.Rd
pkg/Meucci/man/EfficientFrontierReturnsBenchmark.Rd
pkg/Meucci/man/HorizonPricing.Rd
pkg/Meucci/man/Log2Lin.Rd
pkg/Meucci/man/PlotCompositionEfficientFrontier.Rd
pkg/Meucci/man/PlotMarginalsNormalInverseWishart.Rd
Log:
- updated documentation for chapter 6 demo scripts and its functions
Modified: pkg/Meucci/R/BlackLittermanFormula.R
===================================================================
--- pkg/Meucci/R/BlackLittermanFormula.R 2013-09-18 21:33:19 UTC (rev 3140)
+++ pkg/Meucci/R/BlackLittermanFormula.R 2013-09-19 08:29:50 UTC (rev 3141)
@@ -1,17 +1,20 @@
-#' This function computes the Black-Litterman formula for the moments of the posterior normal, as described in
+#' @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.
+#' @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.
+#' @return BLMu [vector] (N x 1) posterior expected values.
+#' @return BLSigma [matrix] (N x N) posterior covariance matrix.
#'
#' @references
-#' \url{http://}
+#' 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}
Modified: pkg/Meucci/R/ButterflyTradingFunctions.R
===================================================================
--- pkg/Meucci/R/ButterflyTradingFunctions.R 2013-09-18 21:33:19 UTC (rev 3140)
+++ pkg/Meucci/R/ButterflyTradingFunctions.R 2013-09-19 08:29:50 UTC (rev 3141)
@@ -12,7 +12,7 @@
return( s )
}
-#' Compute the pricing in the horizon, as it appears in A. Meucci, "Fully Flexible Views: Theory and Practice",
+#' Compute the pricing in the horizon as it appears in A. Meucci, "Fully Flexible Views: Theory and Practice",
#' The Risk Magazine, October 2008, p 100-106.
#'
#' @param Butterflies List of securities with some analytics computed.
Modified: pkg/Meucci/R/ConvertChangeInYield2Price.R
===================================================================
--- pkg/Meucci/R/ConvertChangeInYield2Price.R 2013-09-18 21:33:19 UTC (rev 3140)
+++ pkg/Meucci/R/ConvertChangeInYield2Price.R 2013-09-19 08:29:50 UTC (rev 3141)
@@ -1,7 +1,7 @@
#' @title Convert change in yield-to-maturity to price for fixed-income securities
#'
#' @description Convert change in yield-to-maturity to price for fixed-income securities, as described in
-#' A. Meucci "Risk and Asset Allocation", Springer, 2005
+#' A. Meucci "Risk and Asset Allocation", Springer, 2005.
#'
#' @param Exp_DY [vector] (N x 1) expected value of change in yield to maturity
#' @param Cov_DY [matrix] (N x N) covariance of change in yield to maturity
@@ -13,15 +13,13 @@
#'
#' @references
#' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170},
+#' See Meucci's script for "ConvertChangeInYield2Price.m".
#'
-#' See (6.77)-(6.79) in "Risk and Asset Allocation"-Springer (2005), by A. Meucci
+#' A. Meucci - "Risk and Asset Allocation"-Springer (2005). See (6.77)-(6.79).
#'
-#' See Meucci's script for "ConvertChangeInYield2Price.m"
-#'
#' @author Xavier Valls \email{flamejat@@gmail.com}
#' @export
-
ConvertChangeInYield2Price = function( Exp_DY, Cov_DY, Times2Mat, CurrentPrices )
{
Mu = log( CurrentPrices ) - Times2Mat * Exp_DY;
Modified: pkg/Meucci/R/CovertCompoundedReturns2Price.R
===================================================================
--- pkg/Meucci/R/CovertCompoundedReturns2Price.R 2013-09-18 21:33:19 UTC (rev 3140)
+++ pkg/Meucci/R/CovertCompoundedReturns2Price.R 2013-09-19 08:29:50 UTC (rev 3141)
@@ -1,25 +1,27 @@
-#' Convert compounded returns to prices for equity-like securities, as described in
-#' A. Meucci "Risk and Asset Allocation", Springer, 2005
+#' @title Convert compounded returns to prices for equity-like securities.
#'
-#' @param Exp_Comp_Rets : [vector] (N x 1) expected values of compounded returns
-#' @param Cov_Comp_Rets : [matrix] (N x N) covariance matrix of compounded returns
-#' @param Starting_Prices : [vector] (N x 1)
+#' @description Convert compounded returns to prices for equity-like securities, as described in
+#' A. Meucci "Risk and Asset Allocation", Springer, 2005.
+#'
+#' @param Exp_Comp_Rets [vector] (N x 1) expected values of compounded returns
+#' @param Cov_Comp_Rets [matrix] (N x N) covariance matrix of compounded returns
+#' @param Starting_Prices [vector] (N x 1)
#'
-#' @return Exp_Prices : [vector] (N x 1) expected values of prices
-#' @return Cov_Prices : [matrix] (N x N) covariance matrix of prices
+#' @return Exp_Prices [vector] (N x 1) expected values of prices
+#' @return Cov_Prices [matrix] (N x N) covariance matrix of prices
#'
#' @references
#' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170}.
-#' See (6.77)-(6.79) in "Risk and Asset Allocation"-Springer (2005), by A. Meucci
-#' See Meucci's script for "ConvertCompoundedReturns2Price.m"
+#' See Meucci's script for "ConvertCompoundedReturns2Price.m".
#'
+#' A. Meucci - "Risk and Asset Allocation"-Springer (2005). See (6.77)-(6.79).
+#'
#' @author Xavier Valls \email{flamejat@@gmail.com}
#' @export
-
ConvertCompoundedReturns2Price = function(Exp_Comp_Rets, Cov_Comp_Rets, Starting_Prices)
{
- Mu = log(Starting_Prices) + Exp_Comp_Rets;
+ Mu = log(Starting_Prices) + Exp_Comp_Rets;
Sigma = Cov_Comp_Rets;
Exp_Prices = exp( Mu + 0.5 * diag( Sigma ) );
Modified: pkg/Meucci/R/EfficientFrontierPrices.R
===================================================================
--- pkg/Meucci/R/EfficientFrontierPrices.R 2013-09-18 21:33:19 UTC (rev 3140)
+++ pkg/Meucci/R/EfficientFrontierPrices.R 2013-09-19 08:29:50 UTC (rev 3141)
@@ -1,20 +1,23 @@
-#' Compute the mean-variance efficient frontier (on prices) by quadratic programming, as described in
+#' @title Computes the mean-variance efficient frontier (on prices) by quadratic programming
+#'
+#' @description Compute the mean-variance efficient frontier (on prices) 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 Current_Prices : [vector] (N x 1) current prices
-#' @param Budget : [scalar] budget constraint
+#' @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 Current_Prices [vector] (N x 1) current prices
+#' @param Budget [scalar] budget constraint
#'
-#' @return ExpectedValue : [vector] (NumPortf x 1) expected values of the portfolios
-#' @return Std_Deviation : [vector] (NumPortf x 1) standard deviations of the portfolios
-#' @return Composition : [matrix] (NumPortf x N) optimal portfolios
+#' @return ExpectedValue [vector] (NumPortf x 1) expected values of the portfolios
+#' @return Std_Deviation [vector] (NumPortf x 1) standard deviations of the portfolios
+#' @return Composition [matrix] (NumPortf x N) optimal portfolios
#'
#' @references
#' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170}.
-#' See Meucci's script for "EfficientFrontierReturns.m"
#'
+#' See Meucci's script for "EfficientFrontierReturns.m".
+#'
#' @author Xavier Valls \email{flamejat@@gmail.com}
#' @export
Modified: pkg/Meucci/R/EfficientFrontierReturns.R
===================================================================
--- pkg/Meucci/R/EfficientFrontierReturns.R 2013-09-18 21:33:19 UTC (rev 3140)
+++ pkg/Meucci/R/EfficientFrontierReturns.R 2013-09-19 08:29:50 UTC (rev 3141)
@@ -1,19 +1,22 @@
-#' Compute the mean-variance efficient frontier (on returns) by quadratic programming, as described in
+#' @title Compute the mean-variance efficient frontier (on returns) by quadratic programming.
+#'
+#' @description 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
+#' @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
+#' @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
#' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170}.
-#' See Meucci's script for "EfficientFrontierReturns.m"
#'
+#' See Meucci's script for "EfficientFrontierReturns.m".
+#'
#' @author Xavier Valls \email{flamejat@@gmail.com}
#' @export
Modified: pkg/Meucci/R/EfficientFrontierReturnsBenchmark.R
===================================================================
--- pkg/Meucci/R/EfficientFrontierReturnsBenchmark.R 2013-09-18 21:33:19 UTC (rev 3140)
+++ pkg/Meucci/R/EfficientFrontierReturnsBenchmark.R 2013-09-19 08:29:50 UTC (rev 3141)
@@ -1,18 +1,21 @@
-#' Compute the mean-variance efficient frontier (on returns) by quadratic programming, as described in
+#' @title Computes the mean-variance efficient frontier (on returns) by quadratic programming.
+#'
+#' @description 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
+#' @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
+#' @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
-#' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170}.
+#' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170}.
+#'
#' See Meucci's script for "EfficientFrontierReturnsBenchmark.m"
#'
#' @author Xavier Valls \email{flamejat@@gmail.com}
Modified: pkg/Meucci/R/GenerateUniformDrawsOnUnitSphere.R
===================================================================
--- pkg/Meucci/R/GenerateUniformDrawsOnUnitSphere.R 2013-09-18 21:33:19 UTC (rev 3140)
+++ pkg/Meucci/R/GenerateUniformDrawsOnUnitSphere.R 2013-09-19 08:29:50 UTC (rev 3141)
@@ -15,7 +15,7 @@
# R is a distribution on (0,1) proportional to r^(Dims-1), i.e. the area of surface of radius r.
#'
#' @references
-#' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170}.
+#' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170}.
#' See Meucci's script for "GenerateUniformDrawsOnUnitSphere.m"
#'
#' @author Xavier Valls \email{flamejat@@gmail.com}
Modified: pkg/Meucci/R/Log2Lin.R
===================================================================
--- pkg/Meucci/R/Log2Lin.R 2013-09-18 21:33:19 UTC (rev 3140)
+++ pkg/Meucci/R/Log2Lin.R 2013-09-19 08:29:50 UTC (rev 3141)
@@ -1,14 +1,17 @@
-#' Map moments of log-returns to linear returns, as described in A. Meucci,
+#' @title Maps moments of log-returns to linear returns .
+#'
+#' @description Map moments of log-returns to linear returns, as described in A. Meucci,
#' "Risk and Asset Allocation", Springer, 2005.
#'
-#' @param Mu : [vector] (N x 1)
-#' @param Sigma : [matrix] (N x N)
+#' @param Mu [vector] (N x 1)
+#' @param Sigma [matrix] (N x N)
#'
-#' @return M : [vector] (N x 1)
-#' @return S : [matrix] (N x N)
+#' @return M [vector] (N x 1)
+#' @return S [matrix] (N x N)
#'
#' @references
#' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170}.
+#'
#' See Meucci's script for "Log2Lin.m"
#'
#' @author Xavier Valls \email{flamejat@@gmail.com}
Modified: pkg/Meucci/R/PlotCompositionEfficientFrontier.R
===================================================================
--- pkg/Meucci/R/PlotCompositionEfficientFrontier.R 2013-09-18 21:33:19 UTC (rev 3140)
+++ pkg/Meucci/R/PlotCompositionEfficientFrontier.R 2013-09-19 08:29:50 UTC (rev 3141)
@@ -1,10 +1,13 @@
-#' Plot the efficient frontier, as described in A. Meucci,
+#' @title Plots the efficient frontier
+#'
+#' @description Plot the efficient frontier, as described in A. Meucci,
#' "Risk and Asset Allocation", Springer, 2005.
#'
#' @param Portfolios : [matrix] (M x N) M portfolios of size N (weights)
#'
#' @references
#' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170}.
+#'
#' See Meucci's script for "PlotCompositionEfficientFrontier.m"
#'
#' @author Xavier Valls \email{flamejat@@gmail.com}
Modified: pkg/Meucci/R/PlotMarginalsNormalInverseWishart.R
===================================================================
--- pkg/Meucci/R/PlotMarginalsNormalInverseWishart.R 2013-09-18 21:33:19 UTC (rev 3140)
+++ pkg/Meucci/R/PlotMarginalsNormalInverseWishart.R 2013-09-19 08:29:50 UTC (rev 3141)
@@ -1,13 +1,13 @@
#' Plot the marginals of the normal-inverse-Whishart model.
#' Described in A. Meucci "Risk and Asset Allocation", Springer, 2005
#'
-#' @param Mu_Simul : []
-#' @param InvSigma_Simul : []
-#' @param Mu_0 : []
-#' @param T_0 : []
-#' @param Sigma_0 : []
-#' @param Nu_0 : []
-#' @param Legend : []
+#' @param Mu_Simul []
+#' @param InvSigma_Simul []
+#' @param Mu_0 []
+#' @param T_0 []
+#' @param Sigma_0 []
+#' @param Nu_0 []
+#' @param Legend []
#'
#' @note Numerically and analytically the marginal pdf of
#' - the first entry of the random vector Mu
@@ -17,6 +17,7 @@
#'
#' @references
#' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170}.
+#'
#' See Meucci's script for "PlotMarginalsNormalInverseWishart.m"
#'
#' @author Xavier Valls \email{flamejat@@gmail.com}
Modified: pkg/Meucci/demo/S_BuyNHold.R
===================================================================
--- pkg/Meucci/demo/S_BuyNHold.R 2013-09-18 21:33:19 UTC (rev 3140)
+++ pkg/Meucci/demo/S_BuyNHold.R 2013-09-19 08:29:50 UTC (rev 3141)
@@ -2,7 +2,9 @@
#' Springer, 2005, Chapter 6.
#'
#' @references
-#' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170}.
+#' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170},
+#' "E 261 - Buy and hold".
+#'
#' See Meucci's script for "S_BuyNHold.m"
#
#' @author Xavier Valls \email{flamejat@@gmail.com}
Modified: pkg/Meucci/demo/S_CPPI.R
===================================================================
--- pkg/Meucci/demo/S_CPPI.R 2013-09-18 21:33:19 UTC (rev 3140)
+++ pkg/Meucci/demo/S_CPPI.R 2013-09-19 08:29:50 UTC (rev 3141)
@@ -2,8 +2,10 @@
#' A. Meucci,"Risk and Asset Allocation", Springer, 2005, Chapter 6.
#'
#' @references
-#' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170}.
-#' See Meucci's script for "S_CPPI.m"
+#' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170},
+#' "E 264 - Constant proportion portfolio insurance".
+#'
+#' See Meucci's script for "S_CPPI.m"E 264 – Constant proportion portfolio insurance
#
#' @author Xavier Valls \email{flamejat@@gmail.com}
Modified: pkg/Meucci/demo/S_MeanVarianceBenchmark.R
===================================================================
--- pkg/Meucci/demo/S_MeanVarianceBenchmark.R 2013-09-18 21:33:19 UTC (rev 3140)
+++ pkg/Meucci/demo/S_MeanVarianceBenchmark.R 2013-09-19 08:29:50 UTC (rev 3141)
@@ -6,8 +6,10 @@
#' Described in A. Meucci,"Risk and Asset Allocation", Springer, 2005, Chapter 6.
#'
#' @references
-#' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170}.
-#' See Meucci's script for "S_MeanVarianceBenchmark.m"
+#' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170},
+#' "E 257 - Benchmark driven allocation I" and "E 258 - Benchmark driven allocation II".
+#'
+#' See Meucci's script for "S_MeanVarianceBenchmark.m" and "E 255 - Mean-variance pitfalls: two-step approach II" from the book.
#
#' @author Xavier Valls \email{flamejat@@gmail.com}
Modified: pkg/Meucci/demo/S_MeanVarianceCalls.R
===================================================================
--- pkg/Meucci/demo/S_MeanVarianceCalls.R 2013-09-18 21:33:19 UTC (rev 3140)
+++ pkg/Meucci/demo/S_MeanVarianceCalls.R 2013-09-19 08:29:50 UTC (rev 3141)
@@ -2,7 +2,9 @@
#' Described in A. Meucci,"Risk and Asset Allocation", Springer, 2005, Chapter 6.
#'
#' @references
-#' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170}.
+#' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170},
+#' "E 259 - Mean-variance for derivatives".
+#'
#' See Meucci's script for "S_MeanVarianceCalls.m"
#
#' @author Xavier Valls \email{flamejat@@gmail.com}
@@ -66,9 +68,9 @@
ExpectedValues = matrix( apply( L, 2, mean) );
Covariance = cov( L );
NumPortf = 40;
-#[e, vol, w] =
-EFR = EfficientFrontierReturns( NumPortf, Covariance, ExpectedValues, Constr );
+EFR = PlotVolVsCompositionEfficientFrontiericientFrontierReturns( NumPortf, Covariance, ExpectedValues, Constr );
+
##################################################################################################################
### Plots
PlotVolVsCompositionEfficientFrontier( EFR$Composition, EFR$Volatility );
Modified: pkg/Meucci/demo/S_MeanVarianceHorizon.R
===================================================================
--- pkg/Meucci/demo/S_MeanVarianceHorizon.R 2013-09-18 21:33:19 UTC (rev 3140)
+++ pkg/Meucci/demo/S_MeanVarianceHorizon.R 2013-09-19 08:29:50 UTC (rev 3141)
@@ -5,8 +5,10 @@
#' Described in A. Meucci,"Risk and Asset Allocation", Springer, 2005, Chapter 6.
#'
#' @references
-#' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170}.
-#' See Meucci's script for "S_MeanVarianceHorizon.m"
+#' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170},
+#' "E 256 – Mean-variance pitfalls: horizon effect".
+#'
+#' See Meucci's script for "S_MeanVarianceHorizon.m" and "E 255 - Mean-variance pitfalls: two-step approach II" from the book.
#
#' @author Xavier Valls \email{flamejat@@gmail.com}
Modified: pkg/Meucci/demo/S_MeanVarianceOptimization.R
===================================================================
--- pkg/Meucci/demo/S_MeanVarianceOptimization.R 2013-09-18 21:33:19 UTC (rev 3140)
+++ pkg/Meucci/demo/S_MeanVarianceOptimization.R 2013-09-19 08:29:50 UTC (rev 3141)
@@ -1,13 +1,15 @@
#' 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
+#' horizon.
#' Then it computes the distribution of prices at the investment horizon and performs the two-step mean-variance
#' optimization.
#' Described in A. Meucci,"Risk and Asset Allocation", Springer, 2005, Chapter 6.
#'
#' @references
-#' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170}.
-#' See Meucci's script for "S_MeanVarianceHorizon.m"
+#' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170},
+#' "E 254 - Mean-variance pitfalls: two-step approach I" and "E 255 - Mean-variance pitfalls: two-step approach II".
+#'
+#' See Meucci's script for "S_MeanVarianceOptimization.m"
#
#' @author Xavier Valls \email{flamejat@@gmail.com}
@@ -100,7 +102,7 @@
SDev_Hrzn_DY_Hat = sigmas * sqrt(tau / tau_tilde);
Corr_Hrzn_DY_Hat = matrix( 1, N, N ); # full co-dependence
Cov_Hrzn_DY_Hat = diag(SDev_Hrzn_DY_Hat, length( SDev_Hrzn_DY_Hat)) %*% Corr_Hrzn_DY_Hat %*% diag(SDev_Hrzn_DY_Hat, length( SDev_Hrzn_DY_Hat));
-#[BondExp_Prices, BondCov_Prices]
+
CCY2P = ConvertChangeInYield2Price(Exp_Hrzn_DY_Hat, Cov_Hrzn_DY_Hat, u_minus_tau, BondCurrent_Prices_Shifted);
print( CCY2P$Exp_Prices );
print( CCY2P$Cov_Prices );
@@ -121,8 +123,6 @@
NumPortf = 40;
# frontier with QP (no short-sales)
-#[ExpectedValue, EFP$Std_Deviation, EFP$Composition]
-
EFP = EfficientFrontierPrices( NumPortf, S, E,Current_Prices, Budget );
# step 2: ...evaluate satisfaction for all EFP$Composition on the frontier ...
Modified: pkg/Meucci/demo/S_UtilityMax.R
===================================================================
--- pkg/Meucci/demo/S_UtilityMax.R 2013-09-18 21:33:19 UTC (rev 3140)
+++ pkg/Meucci/demo/S_UtilityMax.R 2013-09-19 08:29:50 UTC (rev 3141)
@@ -2,8 +2,10 @@
#' A. Meucci,"Risk and Asset Allocation", Springer, 2005, Chapter 6.
#'
#' @references
-#' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170}.
-#' See Meucci's script for "S_UtilityMax.m"
+#' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170},
+#' "E 263 - Utility maximization II".
+#'
+#' See Meucci's script for "S_UtilityMax.m" and "E 262 – Utility maximization I" from the book.
#
#' @author Xavier Valls \email{flamejat@@gmail.com}
Modified: pkg/Meucci/man/BlackLittermanFormula.Rd
===================================================================
--- pkg/Meucci/man/BlackLittermanFormula.Rd 2013-09-18 21:33:19 UTC (rev 3140)
+++ pkg/Meucci/man/BlackLittermanFormula.Rd 2013-09-19 08:29:50 UTC (rev 3141)
@@ -1,25 +1,24 @@
\name{BlackLittermanFormula}
\alias{BlackLittermanFormula}
-\title{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.}
+\title{Computes the Black-Litterman formula for the moments of the posterior normal.}
\usage{
BlackLittermanFormula(Mu, Sigma, P, v, Omega)
}
\arguments{
- \item{Mu}{: [vector] (N x 1) prior expected values.}
+ \item{Mu}{[vector] (N x 1) prior expected values.}
- \item{Sigma}{: [matrix] (N x N) prior covariance matrix.}
+ \item{Sigma}{[matrix] (N x N) prior covariance matrix.}
- \item{P}{: [matrix] (K x N) pick matrix.}
+ \item{P}{[matrix] (K x N) pick matrix.}
- \item{v}{: [vector] (K x 1) vector of views.}
+ \item{v}{[vector] (K x 1) vector of views.}
- \item{Omega}{: [matrix] (K x K) matrix of confidence.}
+ \item{Omega}{[matrix] (K x K) matrix of confidence.}
}
\value{
- BLMu : [vector] (N x 1) posterior expected values.
+ BLMu [vector] (N x 1) posterior expected values.
- BLSigma : [matrix] (N x N) posterior covariance matrix.
+ BLSigma [matrix] (N x N) posterior covariance matrix.
}
\description{
This function computes the Black-Litterman formula for
@@ -30,7 +29,9 @@
Xavier Valls \email{flamejat at gmail.com}
}
\references{
- \url{http://} See Meucci's script for
- "BlackLittermanFormula.m"
+ A. Meucci - "Exercises in Advanced Risk and Portfolio
+ Management" \url{http://symmys.com/node/170}.
+
+ See Meucci's script for "BlackLittermanFormula.m"
}
Modified: pkg/Meucci/man/ConvertChangeInYield2Price.Rd
===================================================================
--- pkg/Meucci/man/ConvertChangeInYield2Price.Rd 2013-09-18 21:33:19 UTC (rev 3140)
+++ pkg/Meucci/man/ConvertChangeInYield2Price.Rd 2013-09-19 08:29:50 UTC (rev 3141)
@@ -24,18 +24,17 @@
\description{
Convert change in yield-to-maturity to price for
fixed-income securities, as described in A. Meucci "Risk
- and Asset Allocation", Springer, 2005
+ and Asset Allocation", Springer, 2005.
}
\author{
Xavier Valls \email{flamejat at gmail.com}
}
\references{
A. Meucci - "Exercises in Advanced Risk and Portfolio
- Management" \url{http://symmys.com/node/170},
+ Management" \url{http://symmys.com/node/170}, See
+ Meucci's script for "ConvertChangeInYield2Price.m".
- See (6.77)-(6.79) in "Risk and Asset Allocation"-Springer
- (2005), by A. Meucci
-
- See Meucci's script for "ConvertChangeInYield2Price.m"
+ A. Meucci - "Risk and Asset Allocation"-Springer (2005).
+ See (6.77)-(6.79).
}
Modified: pkg/Meucci/man/ConvertCompoundedReturns2Price.Rd
===================================================================
--- pkg/Meucci/man/ConvertCompoundedReturns2Price.Rd 2013-09-18 21:33:19 UTC (rev 3140)
+++ pkg/Meucci/man/ConvertCompoundedReturns2Price.Rd 2013-09-19 08:29:50 UTC (rev 3141)
@@ -1,29 +1,28 @@
\name{ConvertCompoundedReturns2Price}
\alias{ConvertCompoundedReturns2Price}
-\title{Convert compounded returns to prices for equity-like securities, as described in
-A. Meucci "Risk and Asset Allocation", Springer, 2005}
+\title{Convert compounded returns to prices for equity-like securities.}
\usage{
ConvertCompoundedReturns2Price(Exp_Comp_Rets,
Cov_Comp_Rets, Starting_Prices)
}
\arguments{
- \item{Exp_Comp_Rets}{: [vector] (N x 1) expected values
- of compounded returns}
+ \item{Exp_Comp_Rets}{[vector] (N x 1) expected values of
+ compounded returns}
- \item{Cov_Comp_Rets}{: [matrix] (N x N) covariance matrix
+ \item{Cov_Comp_Rets}{[matrix] (N x N) covariance matrix
of compounded returns}
- \item{Starting_Prices}{: [vector] (N x 1)}
+ \item{Starting_Prices}{[vector] (N x 1)}
}
\value{
- Exp_Prices : [vector] (N x 1) expected values of prices
+ Exp_Prices [vector] (N x 1) expected values of prices
- Cov_Prices : [matrix] (N x N) covariance matrix of prices
+ Cov_Prices [matrix] (N x N) covariance matrix of prices
}
\description{
Convert compounded returns to prices for equity-like
securities, as described in A. Meucci "Risk and Asset
- Allocation", Springer, 2005
+ Allocation", Springer, 2005.
}
\author{
Xavier Valls \email{flamejat at gmail.com}
@@ -31,8 +30,9 @@
\references{
A. Meucci - "Exercises in Advanced Risk and Portfolio
Management" \url{http://symmys.com/node/170}. See
- (6.77)-(6.79) in "Risk and Asset Allocation"-Springer
- (2005), by A. Meucci See Meucci's script for
- "ConvertCompoundedReturns2Price.m"
+ Meucci's script for "ConvertCompoundedReturns2Price.m".
+
+ A. Meucci - "Risk and Asset Allocation"-Springer (2005).
+ See (6.77)-(6.79).
}
Modified: pkg/Meucci/man/EfficientFrontierPrices.Rd
===================================================================
--- pkg/Meucci/man/EfficientFrontierPrices.Rd 2013-09-18 21:33:19 UTC (rev 3140)
+++ pkg/Meucci/man/EfficientFrontierPrices.Rd 2013-09-19 08:29:50 UTC (rev 3141)
@@ -1,32 +1,30 @@
\name{EfficientFrontierPrices}
\alias{EfficientFrontierPrices}
-\title{Compute the mean-variance efficient frontier (on prices) by quadratic programming, as described in
-A. Meucci "Risk and Asset Allocation", Springer, 2005}
+\title{Computes the mean-variance efficient frontier (on prices) by quadratic programming}
\usage{
EfficientFrontierPrices(NumPortf, Covariance,
ExpectedValues, Current_Prices, Budget)
}
\arguments{
- \item{NumPortf}{: [scalar] number of portfolio in the
+ \item{NumPortf}{[scalar] number of portfolio in the
efficient frontier}
- \item{Covariance}{: [matrix] (N x N) covariance matrix}
+ \item{Covariance}{[matrix] (N x N) covariance matrix}
- \item{ExpectedValues}{: [vector] (N x 1) expected
- returns}
+ \item{ExpectedValues}{[vector] (N x 1) expected returns}
- \item{Current_Prices}{: [vector] (N x 1) current prices}
+ \item{Current_Prices}{[vector] (N x 1) current prices}
- \item{Budget}{: [scalar] budget constraint}
+ \item{Budget}{[scalar] budget constraint}
}
\value{
- ExpectedValue : [vector] (NumPortf x 1) expected values
+ ExpectedValue [vector] (NumPortf x 1) expected values of
+ the portfolios
+
+ Std_Deviation [vector] (NumPortf x 1) standard deviations
of the portfolios
- Std_Deviation : [vector] (NumPortf x 1) standard
- deviations of the portfolios
-
- Composition : [matrix] (NumPortf x N) optimal portfolios
+ Composition [matrix] (NumPortf x N) optimal portfolios
}
\description{
Compute the mean-variance efficient frontier (on prices)
@@ -38,7 +36,8 @@
}
\references{
A. Meucci - "Exercises in Advanced Risk and Portfolio
- Management" \url{http://symmys.com/node/170}. See
- Meucci's script for "EfficientFrontierReturns.m"
+ Management" \url{http://symmys.com/node/170}.
+
+ See Meucci's script for "EfficientFrontierReturns.m".
}
Modified: pkg/Meucci/man/EfficientFrontierReturns.Rd
===================================================================
--- pkg/Meucci/man/EfficientFrontierReturns.Rd 2013-09-18 21:33:19 UTC (rev 3140)
+++ pkg/Meucci/man/EfficientFrontierReturns.Rd 2013-09-19 08:29:50 UTC (rev 3141)
@@ -1,31 +1,29 @@
\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}
+\title{Compute the mean-variance efficient frontier (on returns) by quadratic programming.}
\usage{
EfficientFrontierReturns(NumPortf, Covariance,
ExpectedValues, Constraints = NULL)
}
\arguments{
- \item{NumPortf}{: [scalar] number of portfolio in the
+ \item{NumPortf}{[scalar] number of portfolio in the
efficient frontier}
- \item{Covariance}{: [matrix] (N x N) covariance matrix}
+ \item{Covariance}{[matrix] (N x N) covariance matrix}
- \item{ExpectedValues}{: [vector] (N x 1) expected
- returns}
+ \item{ExpectedValues}{[vector] (N x 1) expected returns}
- \item{Constraints}{: [struct] set of constraints.
- Default: weights sum to one, and no-short positions}
+ \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
+ ExpectedValue [vector] (NumPortf x 1) expected values of
+ the portfolios
- Volatility : [vector] (NumPortf x 1) standard deviations
- of the portfolios
+ Volatility [vector] (NumPortf x 1) standard deviations of
+ the portfolios
- Composition : [matrix] (NumPortf x N) optimal portfolios
+ Composition [matrix] (NumPortf x N) optimal portfolios
}
\description{
Compute the mean-variance efficient frontier (on returns)
@@ -37,7 +35,8 @@
}
\references{
A. Meucci - "Exercises in Advanced Risk and Portfolio
- Management" \url{http://symmys.com/node/170}. See
- Meucci's script for "EfficientFrontierReturns.m"
+ Management" \url{http://symmys.com/node/170}.
+
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/returnanalytics -r 3141
More information about the Returnanalytics-commits
mailing list