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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Sep 13 17:37:55 CEST 2013


Author: xavierv
Date: 2013-09-13 17:37:55 +0200 (Fri, 13 Sep 2013)
New Revision: 3088

Added:
   pkg/Meucci/man/ComputeCVaR.Rd
   pkg/Meucci/man/LongShortMeanCVaRFrontier.Rd
Modified:
   pkg/Meucci/NAMESPACE
   pkg/Meucci/R/ButterflyTradingFunctions.R
   pkg/Meucci/demo/ButterflyTrading.R
   pkg/Meucci/demo/FullFlexProbs.R
   pkg/Meucci/demo/FullyIntegratedLiquidityAndMarketRisk.R
   pkg/Meucci/demo/HermiteGrid_demo.R
   pkg/Meucci/demo/RankingInformation.R
   pkg/Meucci/demo/S_BlackLittermanBasic.R
   pkg/Meucci/demo/S_CallsProjectionPricing.R
   pkg/Meucci/demo/S_CrossSectionConstrainedIndustries.R
   pkg/Meucci/demo/S_CrossSectionIndustries.R
   pkg/Meucci/demo/S_EquitiesInvariants.R
   pkg/Meucci/demo/S_ExpectationMaximizationHighYield.R
   pkg/Meucci/demo/S_FitSwapToStudentT.R
   pkg/Meucci/demo/S_FixedIncomeInvariants.R
   pkg/Meucci/demo/S_FxCopulaMarginal.R
   pkg/Meucci/demo/S_HedgeOptions.R
   pkg/Meucci/demo/S_HorizonEffect.R
   pkg/Meucci/demo/S_MaximumLikelihood.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_MultiVarSqrRootRule.R
   pkg/Meucci/demo/S_ProjectNPriceMvGarch.R
   pkg/Meucci/demo/S_PureResidualBonds.R
   pkg/Meucci/demo/S_SnPCaseStudy.R
   pkg/Meucci/demo/S_StatArbSwaps.R
   pkg/Meucci/demo/S_SwapPca2Dim.R
   pkg/Meucci/demo/S_TimeSeriesConstrainedIndustries.R
   pkg/Meucci/demo/S_TimeSeriesIndustries.R
   pkg/Meucci/demo/S_TimeSeriesVsCrossSectionIndustries.R
Log:
 - changed the way data is loaded along the package

Modified: pkg/Meucci/NAMESPACE
===================================================================
--- pkg/Meucci/NAMESPACE	2013-09-13 14:37:41 UTC (rev 3087)
+++ pkg/Meucci/NAMESPACE	2013-09-13 15:37:55 UTC (rev 3088)
@@ -6,6 +6,7 @@
 export(CentralAndStandardizedStatistics)
 export(CMAcombination)
 export(CMAseparation)
+export(ComputeCVaR)
 export(ComputeMoments)
 export(ComputeMVE)
 export(CondProbViews)
@@ -36,6 +37,7 @@
 export(LognormalCopulaPdf)
 export(LognormalMoments2Parameters)
 export(LognormalParam2Statistics)
+export(LongShortMeanCVaRFrontier)
 export(MaxRsqCS)
 export(MaxRsqTS)
 export(MleRecursionForStudentT)

Modified: pkg/Meucci/R/ButterflyTradingFunctions.R
===================================================================
--- pkg/Meucci/R/ButterflyTradingFunctions.R	2013-09-13 14:37:41 UTC (rev 3087)
+++ pkg/Meucci/R/ButterflyTradingFunctions.R	2013-09-13 15:37:55 UTC (rev 3088)
@@ -275,6 +275,22 @@
   return( p_ );
 }
 
+#' Computes the conditional value at risk as it appears in A. Meucci, "Fully Flexible Views: Theory and Practice",
+#' The Risk Magazine, October 2008, p 100-106
+#'  
+#'  @param   Units         panel of joint factors realizations 
+#'  @param   Scenarios     vector of probabilities
+#'  @param   Conf          Confidence 
+#'
+#'  @return  CVaR          Conditional Value at Risk
+#'
+#' @references 
+#' A. Meucci, "Fully Flexible Views: Theory and Practice" \url{http://www.symmys.com/node/158}
+#' See Meucci script for "ButterflyTrading/ComputeCVaR.m"
+#'
+#' @author Ram Ahluwalia \email{ram@@wingedfootcapital.com}
+#' @export
+
 ComputeCVaR = function( Units , Scenarios , Conf )
 {
   PnL = Scenarios %*% Units
@@ -288,6 +304,26 @@
   return( CVaR )
 }
 
+#' Computes the long-short conditional value at risk frontier as it appears in A. Meucci,
+#' "Fully Flexible Views: Theory and Practice", The Risk Magazine, October 2008, p 100-106
+#'  
+#'  @param   PnL           Profit and Loss scenarios
+#'  @param   Probs         vector of probabilities
+#'  @param   Butterflies   list of securities with some analytics computed.         
+#'  @param   Options       list of options
+#'
+#'  @return  Exp           vector of expected returns for each asset
+#'  @return  SDev          vector of security volatilities along the efficient frontier
+#'  @return  CVaR          Conditional Value at Risk for each portfolio
+#'  @return  Composition   matrix of compositions (security weights) for each portfolio along the efficient frontier
+#'
+#' @references 
+#' A. Meucci, "Fully Flexible Views: Theory and Practice" \url{http://www.symmys.com/node/158}
+#' See Meucci script for "ButterflyTrading/LongShortMeanCVaRFrontier.m"
+#'
+#' @author Ram Ahluwalia \email{ram@@wingedfootcapital.com}, Xavier Valls \email{flamejat@@gmail.com}
+#' @export
+
 LongShortMeanCVaRFrontier = function( PnL , Probs , Butterflies , Options )
 {
   library( matlab )
@@ -378,17 +414,3 @@
   
   return( list( Exp = Exp , SDev = SDev , CVaR = CVaR , Composition = Composition ) )
 }
-
-
-MapVol = function( sig , y , K , T )
-{
-  # in real life a and b below should be calibrated to security-specific time series
-  
-  a = -0.00000000001
-  b = 0.00000000001 
-  
-  s = sig + a/sqrt(T) * ( log(K) - log(y) ) + b/T*( log(K) - log(y) )^2
-  
-  return( s )
-}
-

Modified: pkg/Meucci/demo/ButterflyTrading.R
===================================================================
--- pkg/Meucci/demo/ButterflyTrading.R	2013-09-13 14:37:41 UTC (rev 3087)
+++ pkg/Meucci/demo/ButterflyTrading.R	2013-09-13 15:37:55 UTC (rev 3088)
@@ -1,3 +1,4 @@
+
 #' This script performs the butterfly-trading case study for the Entropy-Pooling approach by Attilio Meucci, 
 #' as it appears in A. Meucci, "Fully Flexible Views: Theory and Practice", The Risk Magazine, October 2008, 
 #' p 100-106
@@ -16,29 +17,15 @@
 # In real life, these are provided by the estimation process
 ###########################################################################################################
 
-load( "../data/factorsDistribution.rda" )
+data("factorsDistribution" )
 
-emptyMatrix = matrix( nrow = 0 , ncol = 0 )
-
 ###########################################################################################################
 # Load current prices, deltas and other analytics of the securities 
 # In real life, these are provided by data provider
 ###########################################################################################################
-load("../data/butterfliesAnalytics.rda")
 
+data("butterfliesAnalytics")
 
-
-# create Butterflies as a list of named arrays
-Butterflies = as.matrix( Butterflies[[1]] , nrow = 8 , ncol = 9 )
-Butterflies = matrix(Butterflies, ncol = 9 , nrow = 8 )
-rownames( Butterflies ) = c( "Name" , "P_0" , "Y_0" , "K" , "T" , "sig_0" , "Delta" , "Vega" )
-colnames( Butterflies ) = c( "MSFT_vol_30" , "MSFT_vol_91" , "MSFT_vol_182" , 
-                             "YHOO_vol_30" , "YHOO_vol_91" , "YHOO_vol_182" ,	
-                             "GOOG_vol_30" , "GOOG_vol_91" , "GOOG_vol_182" )
-
-colnames( X ) = FactorNames
-Butterflies = lapply( seq_len( ncol( Butterflies ) ), function( i ) Butterflies[ , i ] )
-
 ###########################################################################################################
 # Map factors scenarios into p&l scenarios at the investment horizon
 # In real life with complex products, the pricing can be VERY costly 
@@ -59,11 +46,10 @@
 
 optimalPortfolios = LongShortMeanCVaRFrontier( PnL , as.matrix(factorsDistribution$p ) , butterfliesAnalytics , Options )
 
-View( optimalPortfolios ) # Note that composition is measured in dollars. Here we are short GOOG_vol_91 and long GOOG_vol_182
+#View( optimalPortfolios ) # Note that composition is measured in dollars. Here we are short GOOG_vol_91 and long GOOG_vol_182
 
 PlotFrontier( optimalPortfolios$Exp , optimalPortfolios$CVaR , optimalPortfolios$Composition )
 
-#[Exp,SDev,CVaR,w] = LongShortMeanCVaRFrontier(PnL,p,butterfliesAnalytics,Options);
 #PlotEfficientFrontier(Exp,CVaR,w)
 
 ###########################################################################################################

Modified: pkg/Meucci/demo/FullFlexProbs.R
===================================================================
--- pkg/Meucci/demo/FullFlexProbs.R	2013-09-13 14:37:41 UTC (rev 3087)
+++ pkg/Meucci/demo/FullFlexProbs.R	2013-09-13 15:37:55 UTC (rev 3088)
@@ -47,7 +47,7 @@
 # risk drivers scenarios
 ###########################################################################
 
-load( "../data/dbFFP.rda" )
+data("dbFFP" )
 
 Infl = dbFFP$Data[ , length( dbFFP$Names ) ];
 Vix = dbFFP$Data[ , length( dbFFP$Names ) - 1 ];

Modified: pkg/Meucci/demo/FullyIntegratedLiquidityAndMarketRisk.R
===================================================================
--- pkg/Meucci/demo/FullyIntegratedLiquidityAndMarketRisk.R	2013-09-13 14:37:41 UTC (rev 3087)
+++ pkg/Meucci/demo/FullyIntegratedLiquidityAndMarketRisk.R	2013-09-13 15:37:55 UTC (rev 3088)
@@ -25,7 +25,7 @@
 # load  fILMR$Daily_Prices: closing prices 
 #       fILMR$Daily_Volumes_Shares: daily volumes   
 #       fILMR$Daily_Liq: Morgan Stanley liquidity index 
-load("../data/fILMR.rda")
+data("fILMR")
 
 # Prices and returns
 #Daily_Prices = Daily_Prices(:,Selectstock);

Modified: pkg/Meucci/demo/HermiteGrid_demo.R
===================================================================
--- pkg/Meucci/demo/HermiteGrid_demo.R	2013-09-13 14:37:41 UTC (rev 3087)
+++ pkg/Meucci/demo/HermiteGrid_demo.R	2013-09-13 15:37:55 UTC (rev 3088)
@@ -25,7 +25,7 @@
 
 # numerical (Gauss-Hermite grid) prior 
 ghqMesh = emptyMatrix
-load( "ghq1000.rda" )
+load( "ghq1000" )
 
 tmp = ( ghqx - min( ghqx ) ) / ( max( ghqx ) - min( ghqx ) ) # rescale GH zeros so they belong to [0,1]
 epsilon = 1e-10

Modified: pkg/Meucci/demo/RankingInformation.R
===================================================================
--- pkg/Meucci/demo/RankingInformation.R	2013-09-13 14:37:41 UTC (rev 3087)
+++ pkg/Meucci/demo/RankingInformation.R	2013-09-13 15:37:55 UTC (rev 3088)
@@ -17,7 +17,7 @@
 # Load panel X of joint returns realizations and vector p of respective probabilities
 # In real life, these are provided by the estimation process
 #############################################################################
-load("../data/returnsDistribution.rda");
+data("returnsDistribution");
 
 ###########################################################################################################
 # compute and plot efficient frontier based on prior market distribution

Modified: pkg/Meucci/demo/S_BlackLittermanBasic.R
===================================================================
--- pkg/Meucci/demo/S_BlackLittermanBasic.R	2013-09-13 14:37:41 UTC (rev 3087)
+++ pkg/Meucci/demo/S_BlackLittermanBasic.R	2013-09-13 15:37:55 UTC (rev 3088)
@@ -12,7 +12,7 @@
 
 ##################################################################################################################
 ### Load inputs
-load("../data/covNRets.rda"); 
+data("covNRets"); 
 
 ##################################################################################################################
 ### Compute efficient frontier

Modified: pkg/Meucci/demo/S_CallsProjectionPricing.R
===================================================================
--- pkg/Meucci/demo/S_CallsProjectionPricing.R	2013-09-13 14:37:41 UTC (rev 3087)
+++ pkg/Meucci/demo/S_CallsProjectionPricing.R	2013-09-13 15:37:55 UTC (rev 3088)
@@ -13,7 +13,7 @@
 
 # load 'spot' for underlying and current vol surface, given by
 # 'impVol' for different 'days2Maturity' and 'moneyness' (K/S)
-load("../data/implVol.rda");
+data("implVol");
 
 ##################################################################################################################
 ### Inputs

Modified: pkg/Meucci/demo/S_CrossSectionConstrainedIndustries.R
===================================================================
--- pkg/Meucci/demo/S_CrossSectionConstrainedIndustries.R	2013-09-13 14:37:41 UTC (rev 3087)
+++ pkg/Meucci/demo/S_CrossSectionConstrainedIndustries.R	2013-09-13 15:37:55 UTC (rev 3088)
@@ -10,10 +10,10 @@
 
 ##################################################################################################################
 ### Loads weekly stock returns X and indices stock returns F
-load("../data/securitiesTS.rda");
+data("securitiesTS");
 Data_Securities = securitiesTS$data[ , -1 ]; # 1st column is date
 
-load("../data/securitiesIndustryClassification.rda");
+data("securitiesIndustryClassification");
 Securities_IndustryClassification = securitiesIndustryClassification$data;
 ##################################################################################################################
 ### Linear returns for stocks

Modified: pkg/Meucci/demo/S_CrossSectionIndustries.R
===================================================================
--- pkg/Meucci/demo/S_CrossSectionIndustries.R	2013-09-13 14:37:41 UTC (rev 3087)
+++ pkg/Meucci/demo/S_CrossSectionIndustries.R	2013-09-13 15:37:55 UTC (rev 3088)
@@ -10,10 +10,10 @@
 ##################################################################################################################
 ### Load data
 # loads weekly stock returns X and indices stock returns F
-load("../data/securitiesTS.rda");
+data("securitiesTS");
 Data_Securities = securitiesTS$data[ , -1 ]; # 1st column is date
 
-load("../data/securitiesIndustryClassification.rda");
+data("securitiesIndustryClassification");
 Securities_IndustryClassification = securitiesIndustryClassification$data;
 
 ##################################################################################################################

Modified: pkg/Meucci/demo/S_EquitiesInvariants.R
===================================================================
--- pkg/Meucci/demo/S_EquitiesInvariants.R	2013-09-13 14:37:41 UTC (rev 3087)
+++ pkg/Meucci/demo/S_EquitiesInvariants.R	2013-09-13 15:37:55 UTC (rev 3088)
@@ -11,7 +11,7 @@
 
 ##################################################################################################################
 ### Load daily stock prices from the utility sector in the S&P 500
-load("../data/equities.rda");
+data("equities");
 
 ##################################################################################################################
 ### Pick one stock from database

Modified: pkg/Meucci/demo/S_ExpectationMaximizationHighYield.R
===================================================================
--- pkg/Meucci/demo/S_ExpectationMaximizationHighYield.R	2013-09-13 14:37:41 UTC (rev 3087)
+++ pkg/Meucci/demo/S_ExpectationMaximizationHighYield.R	2013-09-13 15:37:55 UTC (rev 3088)
@@ -10,7 +10,7 @@
 
 ##################################################################################################################
 ### Load data
-load("../data/highYieldIndices.rda");
+data("highYieldIndices");
 
 ##################################################################################################################
 ### Compute invariants and set NaN for large values

Modified: pkg/Meucci/demo/S_FitSwapToStudentT.R
===================================================================
--- pkg/Meucci/demo/S_FitSwapToStudentT.R	2013-09-13 14:37:41 UTC (rev 3087)
+++ pkg/Meucci/demo/S_FitSwapToStudentT.R	2013-09-13 15:37:55 UTC (rev 3088)
@@ -11,7 +11,7 @@
 
 ##################################################################################################################
 ### Load data
-load( "../data/usSwapRates.rda" );
+data("usSwapRates" );
 
 ##################################################################################################################
 ### Inputs

Modified: pkg/Meucci/demo/S_FixedIncomeInvariants.R
===================================================================
--- pkg/Meucci/demo/S_FixedIncomeInvariants.R	2013-09-13 14:37:41 UTC (rev 3087)
+++ pkg/Meucci/demo/S_FixedIncomeInvariants.R	2013-09-13 15:37:55 UTC (rev 3088)
@@ -9,7 +9,7 @@
 
 ##################################################################################################################
 ### Load government yield curve and bond yield data for different dates
-load("../data/fixedIncome.rda");
+data("fixedIncome");
 
 ##################################################################################################################
 ### Pick time-to-maturity for one point on the yield curve

Modified: pkg/Meucci/demo/S_FxCopulaMarginal.R
===================================================================
--- pkg/Meucci/demo/S_FxCopulaMarginal.R	2013-09-13 14:37:41 UTC (rev 3087)
+++ pkg/Meucci/demo/S_FxCopulaMarginal.R	2013-09-13 15:37:55 UTC (rev 3088)
@@ -9,7 +9,7 @@
 #' @export 
 
 ### Load data and select the pair to display
-load( "../data/fX.rda" )
+data("fX" )
 
 Display = c( 1, 2 );  # 1 = Spot USD/EUR; 2 = Spot USD/GBP; 3 = Spot USD/JPY; 
 

Modified: pkg/Meucci/demo/S_HedgeOptions.R
===================================================================
--- pkg/Meucci/demo/S_HedgeOptions.R	2013-09-13 14:37:41 UTC (rev 3087)
+++ pkg/Meucci/demo/S_HedgeOptions.R	2013-09-13 15:37:55 UTC (rev 3088)
@@ -9,7 +9,7 @@
 
 ##################################################################################################################
 ### Load data
-load( "../data/implVol.rda" );
+data("implVol" );
 
 ##################################################################################################################
 ### Inputs

Modified: pkg/Meucci/demo/S_HorizonEffect.R
===================================================================
--- pkg/Meucci/demo/S_HorizonEffect.R	2013-09-13 14:37:41 UTC (rev 3087)
+++ pkg/Meucci/demo/S_HorizonEffect.R	2013-09-13 15:37:55 UTC (rev 3088)
@@ -17,7 +17,7 @@
 
 ##################################################################################################################
 # Load parameters of the model: D, muX, sigmaF, sigmaEps
-load( "../data/linearModel.rda" );
+data("linearModel" );
 
 # Specify range of investment horizon, weeks
 tauRangeWeeks = 1:52;

Modified: pkg/Meucci/demo/S_MaximumLikelihood.R
===================================================================
--- pkg/Meucci/demo/S_MaximumLikelihood.R	2013-09-13 14:37:41 UTC (rev 3087)
+++ pkg/Meucci/demo/S_MaximumLikelihood.R	2013-09-13 15:37:55 UTC (rev 3088)
@@ -51,7 +51,7 @@
 
 ##########################################################################################################
 ### Load data
-load( "../data/timeSeries.rda");
+data("timeSeries");
 
 ##########################################################################################################
 ### inputs

Modified: pkg/Meucci/demo/S_MeanVarianceBenchmark.R
===================================================================
--- pkg/Meucci/demo/S_MeanVarianceBenchmark.R	2013-09-13 14:37:41 UTC (rev 3087)
+++ pkg/Meucci/demo/S_MeanVarianceBenchmark.R	2013-09-13 15:37:55 UTC (rev 3088)
@@ -13,7 +13,7 @@
 
 ##################################################################################################################
 ### Load data
-load("../data/stockSeries.rda"); 	
+data("stockSeries"); 	
 
 ###################################################################################################################
 ### Inputs

Modified: pkg/Meucci/demo/S_MeanVarianceCalls.R
===================================================================
--- pkg/Meucci/demo/S_MeanVarianceCalls.R	2013-09-13 14:37:41 UTC (rev 3087)
+++ pkg/Meucci/demo/S_MeanVarianceCalls.R	2013-09-13 15:37:55 UTC (rev 3088)
@@ -9,7 +9,7 @@
 ##################################################################################################################
 ### Load dat
 
-load("../data/db.rda" );
+data("db" );
 
 ##################################################################################################################
 ### Inputs

Modified: pkg/Meucci/demo/S_MeanVarianceHorizon.R
===================================================================
--- pkg/Meucci/demo/S_MeanVarianceHorizon.R	2013-09-13 14:37:41 UTC (rev 3087)
+++ pkg/Meucci/demo/S_MeanVarianceHorizon.R	2013-09-13 15:37:55 UTC (rev 3088)
@@ -12,7 +12,7 @@
 
 ##################################################################################################################
 ### Load data
-load("../data/stockSeries.rda"); 	
+data("stockSeries"); 	
 
 ##################################################################################################################
 ### Inputs

Modified: pkg/Meucci/demo/S_MeanVarianceOptimization.R
===================================================================
--- pkg/Meucci/demo/S_MeanVarianceOptimization.R	2013-09-13 14:37:41 UTC (rev 3087)
+++ pkg/Meucci/demo/S_MeanVarianceOptimization.R	2013-09-13 15:37:55 UTC (rev 3088)
@@ -13,7 +13,7 @@
 
 ##################################################################################################################
 ### Load data
-load( "../data/stockSeries.rda" );
+data("stockSeries" );
 
 ##################################################################################################################
 ### Inputs

Modified: pkg/Meucci/demo/S_MultiVarSqrRootRule.R
===================================================================
--- pkg/Meucci/demo/S_MultiVarSqrRootRule.R	2013-09-13 14:37:41 UTC (rev 3087)
+++ pkg/Meucci/demo/S_MultiVarSqrRootRule.R	2013-09-13 15:37:55 UTC (rev 3088)
@@ -9,7 +9,7 @@
 
 ##################################################################################################################
 ### Load data
-load("../data/swaps.rda");
+data("swaps");
 
 ##################################################################################################################
 ### Aggregation steps in days

Modified: pkg/Meucci/demo/S_ProjectNPriceMvGarch.R
===================================================================
--- pkg/Meucci/demo/S_ProjectNPriceMvGarch.R	2013-09-13 14:37:41 UTC (rev 3087)
+++ pkg/Meucci/demo/S_ProjectNPriceMvGarch.R	2013-09-13 15:37:55 UTC (rev 3088)
@@ -13,7 +13,7 @@
 
 ##################################################################################################################
 ### Load data
-load( "../data/equities.rda" );
+data("equities" );
 
 ##################################################################################################################
 ### Inputs

Modified: pkg/Meucci/demo/S_PureResidualBonds.R
===================================================================
--- pkg/Meucci/demo/S_PureResidualBonds.R	2013-09-13 14:37:41 UTC (rev 3087)
+++ pkg/Meucci/demo/S_PureResidualBonds.R	2013-09-13 15:37:55 UTC (rev 3088)
@@ -10,7 +10,7 @@
 
 ##################################################################################################################
 ### Load data
-load("../data/bondAttribution.rda");
+data("bondAttribution");
 
 
 ##################################################################################################################

Modified: pkg/Meucci/demo/S_SnPCaseStudy.R
===================================================================
--- pkg/Meucci/demo/S_SnPCaseStudy.R	2013-09-13 14:37:41 UTC (rev 3087)
+++ pkg/Meucci/demo/S_SnPCaseStudy.R	2013-09-13 15:37:55 UTC (rev 3088)
@@ -4,7 +4,7 @@
 # source on www.symmys.com
 ####################################################################
 
-load("../data/sectorsSnP500.rda")
+data("sectorsSnP500")
 
 p_m = 0.1 # aversion to estimation risk for mu
 p_s = 0.1 # aversion to estimation risk for sigma

Modified: pkg/Meucci/demo/S_StatArbSwaps.R
===================================================================
--- pkg/Meucci/demo/S_StatArbSwaps.R	2013-09-13 14:37:41 UTC (rev 3087)
+++ pkg/Meucci/demo/S_StatArbSwaps.R	2013-09-13 15:37:55 UTC (rev 3088)
@@ -11,7 +11,7 @@
 
 ##################################################################################################################
 ### Load data
-load("../data/swapParRates.rda");
+data("swapParRates");
 
 ##################################################################################################################
 ### Estimate covariance and PCA decomposition

Modified: pkg/Meucci/demo/S_SwapPca2Dim.R
===================================================================
--- pkg/Meucci/demo/S_SwapPca2Dim.R	2013-09-13 14:37:41 UTC (rev 3087)
+++ pkg/Meucci/demo/S_SwapPca2Dim.R	2013-09-13 15:37:55 UTC (rev 3088)
@@ -12,7 +12,7 @@
 #' @author Xavier Valls \email{flamejat@@gmail.com}
 ##################################################################################################################
 ### Load data
-load( "../data/swap2y4y.mat" );
+data("swap2y4y.mat" );
 
 ##################################################################################################################
 ### Current curve

Modified: pkg/Meucci/demo/S_TimeSeriesConstrainedIndustries.R
===================================================================
--- pkg/Meucci/demo/S_TimeSeriesConstrainedIndustries.R	2013-09-13 14:37:41 UTC (rev 3087)
+++ pkg/Meucci/demo/S_TimeSeriesConstrainedIndustries.R	2013-09-13 15:37:55 UTC (rev 3088)
@@ -10,10 +10,10 @@
 
 ##################################################################################################################
 ### Loads weekly stock returns X and indices stock returns F
-load("../data/securitiesTS.rda");
+data("securitiesTS");
 Data_Securities = securitiesTS$data[ , -1 ]; # 1st column is date
 
-load("../data/sectorsTS.rda");
+data("sectorsTS");
 Data_Sectors = sectorsTS$data[ , -(1:2) ]; #1st column is date, 2nd column is SPX
 
 ##################################################################################################################

Modified: pkg/Meucci/demo/S_TimeSeriesIndustries.R
===================================================================
--- pkg/Meucci/demo/S_TimeSeriesIndustries.R	2013-09-13 14:37:41 UTC (rev 3087)
+++ pkg/Meucci/demo/S_TimeSeriesIndustries.R	2013-09-13 15:37:55 UTC (rev 3088)
@@ -9,10 +9,10 @@
 
 ##################################################################################################################
 ### Loads weekly stock returns X and indices stock returns F
-load("../data/securitiesTS.rda");
+data("securitiesTS");
 Data_Securities = securitiesTS$data[ , -1 ]; # 1st column is date
 
-load("../data/sectorsTS.rda");
+data("sectorsTS");
 Data_Sectors = sectorsTS$data[ , -(1:2) ]; #1st column is for date, 2nd column is SPX index
 
 ##################################################################################################################

Modified: pkg/Meucci/demo/S_TimeSeriesVsCrossSectionIndustries.R
===================================================================
--- pkg/Meucci/demo/S_TimeSeriesVsCrossSectionIndustries.R	2013-09-13 14:37:41 UTC (rev 3087)
+++ pkg/Meucci/demo/S_TimeSeriesVsCrossSectionIndustries.R	2013-09-13 15:37:55 UTC (rev 3088)
@@ -10,13 +10,13 @@
 ##################################################################################################################
 ### Load data
 # loads weekly stock returns X and indices stock returns F
-load("../data/securitiesTS.rda");
+data("securitiesTS");
 Data_Securities = securitiesTS$data[ , -1 ]; # 1st column is date
 
-load("../data/sectorsTS.rda");
+data("sectorsTS");
 Data_Sectors = sectorsTS$data[ , -(1:2) ];
 
-load("../data/securitiesIndustryClassification.rda");
+data("securitiesIndustryClassification");
 Securities_IndustryClassification = securitiesIndustryClassification$data;
 
 ##################################################################################################################

Added: pkg/Meucci/man/ComputeCVaR.Rd
===================================================================
--- pkg/Meucci/man/ComputeCVaR.Rd	                        (rev 0)
+++ pkg/Meucci/man/ComputeCVaR.Rd	2013-09-13 15:37:55 UTC (rev 3088)
@@ -0,0 +1,31 @@
+\name{ComputeCVaR}
+\alias{ComputeCVaR}
+\title{Computes the conditional value at risk as it appears in A. Meucci, "Fully Flexible Views: Theory and Practice",
+The Risk Magazine, October 2008, p 100-106}
+\usage{
+  ComputeCVaR(Units, Scenarios, Conf)
+}
+\arguments{
+  \item{Units}{panel of joint factors realizations}
+
+  \item{Scenarios}{vector of probabilities}
+
+  \item{Conf}{Confidence}
+}
+\value{
+  CVaR Conditional Value at Risk
+}
+\description{
+  Computes the conditional value at risk as it appears in
+  A. Meucci, "Fully Flexible Views: Theory and Practice",
+  The Risk Magazine, October 2008, p 100-106
+}
+\author{
+  Ram Ahluwalia \email{ram at wingedfootcapital.com}
+}
+\references{
+  A. Meucci, "Fully Flexible Views: Theory and Practice"
+  \url{http://www.symmys.com/node/158} See Meucci script
+  for "ButterflyTrading/ComputeCVaR.m"
+}
+

Added: pkg/Meucci/man/LongShortMeanCVaRFrontier.Rd
===================================================================
--- pkg/Meucci/man/LongShortMeanCVaRFrontier.Rd	                        (rev 0)
+++ pkg/Meucci/man/LongShortMeanCVaRFrontier.Rd	2013-09-13 15:37:55 UTC (rev 3088)
@@ -0,0 +1,45 @@
+\name{LongShortMeanCVaRFrontier}
+\alias{LongShortMeanCVaRFrontier}
+\title{Computes the long-short conditional value at risk frontier as it appears in A. Meucci,
+"Fully Flexible Views: Theory and Practice", The Risk Magazine, October 2008, p 100-106}
+\usage{
+  LongShortMeanCVaRFrontier(PnL, Probs, Butterflies,
+    Options)
+}
+\arguments{
+  \item{PnL}{Profit and Loss scenarios}
+
+  \item{Probs}{vector of probabilities}
+
+  \item{Butterflies}{list of securities with some analytics
+  computed.}
+
+  \item{Options}{list of options}
+}
+\value{
+  Exp vector of expected returns for each asset
+
+  SDev vector of security volatilities along the efficient
+  frontier
+
+  CVaR Conditional Value at Risk for each portfolio
+
+  Composition matrix of compositions (security weights) for
+  each portfolio along the efficient frontier
+}
+\description{
+  Computes the long-short conditional value at risk
+  frontier as it appears in A. Meucci, "Fully Flexible
+  Views: Theory and Practice", The Risk Magazine, October
+  2008, p 100-106
+}
+\author{
+  Ram Ahluwalia \email{ram at wingedfootcapital.com}, Xavier
+  Valls \email{flamejat at gmail.com}
+}
+\references{
+  A. Meucci, "Fully Flexible Views: Theory and Practice"
+  \url{http://www.symmys.com/node/158} See Meucci script
+  for "ButterflyTrading/LongShortMeanCVaRFrontier.m"
+}
+



More information about the Returnanalytics-commits mailing list