[Returnanalytics-commits] r3008 - in pkg/Meucci: . R data demo

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Sep 6 10:03:45 CEST 2013


Author: xavierv
Date: 2013-09-06 10:03:44 +0200 (Fri, 06 Sep 2013)
New Revision: 3008

Added:
   pkg/Meucci/data/00Index
Modified:
   pkg/Meucci/DESCRIPTION
   pkg/Meucci/R/CentralAndStandardizedStatistics.R
   pkg/Meucci/R/EntropyProg.R
   pkg/Meucci/R/FitMultivariateGarch.R
   pkg/Meucci/R/RankingInformation.R
   pkg/Meucci/demo/00Index
Log:
 - minor error fixing

Modified: pkg/Meucci/DESCRIPTION
===================================================================
--- pkg/Meucci/DESCRIPTION	2013-09-06 07:15:20 UTC (rev 3007)
+++ pkg/Meucci/DESCRIPTION	2013-09-06 08:03:44 UTC (rev 3008)
@@ -50,7 +50,8 @@
     scatterplot3d,
     signal,
     fExtremes,
-    QZ
+    QZ,
+    PerformanceAnalytics
 License: GPL
 URL: http://r-forge.r-project.org/projects/returnanalytics/
 Copyright: (c) 2012

Modified: pkg/Meucci/R/CentralAndStandardizedStatistics.R
===================================================================
--- pkg/Meucci/R/CentralAndStandardizedStatistics.R	2013-09-06 07:15:20 UTC (rev 3007)
+++ pkg/Meucci/R/CentralAndStandardizedStatistics.R	2013-09-06 08:03:44 UTC (rev 3008)
@@ -16,6 +16,7 @@
 
 CentralAndStandardizedStatistics = function( X, N )
 {
+	if(!require("PerformanceAnalytics")) stop("PerformanceAnalytics package required for this script");
 	# compute central moments
 	mu = matrix( 0, 1, N);
 	mu[ 1 ] = mean(X);

Modified: pkg/Meucci/R/EntropyProg.R
===================================================================
--- pkg/Meucci/R/EntropyProg.R	2013-09-06 07:15:20 UTC (rev 3007)
+++ pkg/Meucci/R/EntropyProg.R	2013-09-06 08:03:44 UTC (rev 3008)
@@ -200,7 +200,7 @@
 {      
   if ( length( match.call() ) < 3 )
   {
-    J = size( X , 1 )        
+    J = dim( X )[ 1 ]        
     nBins = round( 10 * log(J) )
   }
   

Modified: pkg/Meucci/R/FitMultivariateGarch.R
===================================================================
--- pkg/Meucci/R/FitMultivariateGarch.R	2013-09-06 07:15:20 UTC (rev 3007)
+++ pkg/Meucci/R/FitMultivariateGarch.R	2013-09-06 08:03:44 UTC (rev 3008)
@@ -691,6 +691,7 @@
 
 minfro = function( A )
 {
+    if(!require("Matrix")) stop("Matrix package required for this script");
     if( any( diag( A ) < 0) )
     {
         stop("Diagonal Elements Must Be Non-Negative!");
@@ -726,7 +727,7 @@
                 b   = a - rho * m;
                 # Newton's step
                 x = newton( M, i, b, m, aii, n, rho );  
-                P = sparse( diag( 1, n ) );
+                P = as( diag( 1, n ), "sparseMatrix" );
                 P[ i, 1:n ] = t(x); 
                 # update
                 Mtest   = P %*% M %*% t(P);         
@@ -740,7 +741,7 @@
                 }           
             }
 
-            normj[ j+1 ] = oldnorm; ##ok<AGROW>
+            normj[ j+1 ] = oldnorm; 
             incj[ j ]    = oldnormj - oldnorm; 
             oldnormj     = oldnorm;       
 

Modified: pkg/Meucci/R/RankingInformation.R
===================================================================
--- pkg/Meucci/R/RankingInformation.R	2013-09-06 07:15:20 UTC (rev 3007)
+++ pkg/Meucci/R/RankingInformation.R	2013-09-06 08:03:44 UTC (rev 3008)
@@ -13,7 +13,7 @@
   data = as.data.frame( weightsMatrix )
   data$aspect = 1:nrow(data)
   data2 = reshape2:::melt( data , id.vars = "aspect" )
-  p <- ggplot(data2, aes(x=factor(aspect), y = value, fill=factor(variable))) + geom_bar() #+ opts( title = expression( "Efficient Frontier Weights" ))
+  p <- ggplot(data2, aes( x = factor(aspect), y = value, fill = factor( variable ) ) ) + geom_bar() #+ opts( title = expression( "Efficient Frontier Weights" ))
   return( p )
 }
 
@@ -25,6 +25,7 @@
 #' @param  Upper    a vector of indexes indicating which column is lower than the corresponding column number in Upper
 #' @export EntropyProg
 #  @example ViewRanking( X , p , Lower = c(3,4) , Upper = c(4,5) ) # two inequality views: asset 3 < asset 4 returns, and asset 4 < asset 5 returns
+
 ViewRanking = function( X , p , Lower , Upper )
 {
   library( matlab )

Added: pkg/Meucci/data/00Index
===================================================================
--- pkg/Meucci/data/00Index	                        (rev 0)
+++ pkg/Meucci/data/00Index	2013-09-06 08:03:44 UTC (rev 3008)
@@ -0,0 +1,10 @@
+butterflyAnalytics  X p FactorNames
+FactorDistributions  Butterflies
+ghq1000  ghqx
+MeucciFreaqEst  DY Data Dates X p Names
+MeucciTweakTest  A_ Aeq_ b_ beq_ db_ g_ lb_ ub_
+pseudodata  data
+ReturnsDistribution  P X
+SectorsSnP500 DP P
+MeanDiversificationFrontier S Mu w_b
+DB_SwapParRates Rates Dates
\ No newline at end of file

Modified: pkg/Meucci/demo/00Index
===================================================================
--- pkg/Meucci/demo/00Index	2013-09-06 07:15:20 UTC (rev 3007)
+++ pkg/Meucci/demo/00Index	2013-09-06 08:03:44 UTC (rev 3008)
@@ -1,7 +1,7 @@
 AnalyticalvsNumerical       This example script compares the numerical and the analytical solution of entropy-pooling
 ButterflyTrading            This example script performs the butterfly-trading case study for the Entropy-Pooling approach by Attilio Meucci
 DetectOutliersviaMVE        This example script detects outliers in two-asset and multi-asset case
-FullyFlexibleBayesNets       This case study uses Entropy Pooling to compute Fully Flexible Bayesian networks for risk management
+FullyFlexibleBayesNets      This case study uses Entropy Pooling to compute Fully Flexible Bayesian networks for risk management
 HermiteGrid_CaseStudy       This script estimates the prior of a hedge fund return and processes extreme views on CVaR according to Entropy Pooling
 HermiteGrid_CVaR_Recursion  This script illustrates the discrete Newton recursion  to process views on CVaR according to Entropy Pooling
 HermiteGrid_demo            This script compares the performance of plain Monte Carlo versus grid in applying Entropy Pooling to process extreme views
@@ -17,4 +17,4 @@
 S_CheckDiagonalization      This script verifies the correctness of the eigenvalue-eigenvector representation in terms of real matrices for the transition matrix of an OU process
 S_CovarianceEvolution       This script represents the evolution of the covariance of an OU process in terms of the dispersion ellipsoid
 S_DeterministicEvolution    This script animates the evolution of the determinstic component of an OU process
-MeanDiversificationFrontier This script computes the mean-diversification efficient frontier
\ No newline at end of file
+MeanDiversificationFrontier This script computes the mean-diversification efficient frontier



More information about the Returnanalytics-commits mailing list