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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jul 4 14:23:50 CEST 2013


Author: xavierv
Date: 2013-07-04 14:23:49 +0200 (Thu, 04 Jul 2013)
New Revision: 2498

Added:
   pkg/Meucci/R/Central2Raw.R
   pkg/Meucci/R/CentralAndStandardizedStatistics.R
   pkg/Meucci/R/Cumul2Raw.R
   pkg/Meucci/R/Raw2Central.R
   pkg/Meucci/R/Raw2Cumul.R
   pkg/Meucci/demo/S_LinVsLogReturn.R
   pkg/Meucci/demo/S_ProjectSummaryStatistics.R
   pkg/Meucci/demo/S_PureResidualBonds.R
   pkg/Meucci/man/CentralAndStandardizedStatistics.Rd
Modified:
   pkg/Meucci/DESCRIPTION
   pkg/Meucci/NAMESPACE
   pkg/Meucci/R/PerformIidAnalysis.R
   pkg/Meucci/man/Central2Raw.Rd
   pkg/Meucci/man/Cumul2Raw.Rd
   pkg/Meucci/man/PerformIidAnalysis.Rd
   pkg/Meucci/man/Raw2Central.Rd
   pkg/Meucci/man/Raw2Cumul.Rd
Log:
- added 3 new demo scripts and the new functions needed to make them run

Modified: pkg/Meucci/DESCRIPTION
===================================================================
--- pkg/Meucci/DESCRIPTION	2013-07-03 23:49:26 UTC (rev 2497)
+++ pkg/Meucci/DESCRIPTION	2013-07-04 12:23:49 UTC (rev 2498)
@@ -75,3 +75,8 @@
     'SimulateJumpDiffusionMerton.R'
     'BlackScholesCallPrice.R'
     'InterExtrapolate.R'
+    'Central2Raw.R'
+    'CentralAndStandardizedStatistics.R'
+    'Cumul2Raw.R'
+    'Raw2Central.R'
+    'Raw2Cumul.R'

Modified: pkg/Meucci/NAMESPACE
===================================================================
--- pkg/Meucci/NAMESPACE	2013-07-03 23:49:26 UTC (rev 2497)
+++ pkg/Meucci/NAMESPACE	2013-07-04 12:23:49 UTC (rev 2498)
@@ -1,5 +1,6 @@
 export(BlackScholesCallPrice)
 export(Central2Raw)
+export(CentralAndStandardizedStatistics)
 export(CMAcombination)
 export(CMAseparation)
 export(ComputeMoments)

Added: pkg/Meucci/R/Central2Raw.R
===================================================================
--- pkg/Meucci/R/Central2Raw.R	                        (rev 0)
+++ pkg/Meucci/R/Central2Raw.R	2013-07-04 12:23:49 UTC (rev 2498)
@@ -0,0 +1,30 @@
+#' Map central moments into raw moments
+#'
+#'	@param   mu  : [vector] (length N corresponding to order N) central moments
+#'
+#'	@return  mu_ : [vector] (length N corresponding to order N) corresponding raw moments
+#'
+#' @references
+#' \url{http://}
+#' See Meucci's script for "Central2Raw.m"
+#'
+#' @author Xavier Valls \email{flamejat@@gmail.com}
+#' @export
+
+Central2Raw = function(mu)
+{
+	N   = length(mu);
+	mu_ = mu;
+
+	for ( n in 2 : N )
+	{
+	    mu_[ n ] = ( ( -1 ) ^( n+1 ) ) * ( mu[ 1 ] )^(n);
+	    for( k in 1 : (n-1) )
+	    {
+	        mu_[ n ] =  mu_[ n ] + choose( n, k ) * ( (-1) ^ ( n - k + 1 )) * mu_[ k ] * (mu_[ 1 ]) ^ ( n - k);
+	    }
+	    mu_[ n ] = mu_[ n ] + mu[ n ];
+	}
+
+	return( mu_);
+}
\ No newline at end of file

Added: pkg/Meucci/R/CentralAndStandardizedStatistics.R
===================================================================
--- pkg/Meucci/R/CentralAndStandardizedStatistics.R	                        (rev 0)
+++ pkg/Meucci/R/CentralAndStandardizedStatistics.R	2013-07-04 12:23:49 UTC (rev 2498)
@@ -0,0 +1,39 @@
+#' Compute central and standardized statistics, as described in A. Meucci 
+#' "Risk and Asset Allocation", Springer, 2005
+#'
+#'	@param    X  : [vector] (J x 1) draws from the distribution
+#'	@param    N  : [scalar] highest degree for the central moment
+#'
+#'	@return   ga : [vector] (1 x N) standardized statistics up to order N
+#'	@return   mu : [vector] (1 x N) central moments up to order N
+#'
+#' @references
+#' \url{http://symmys.com/node/170}
+#' See Meucci's script for "CentralAndStandardizedStatistics.m"
+#'
+#' @author Xavier Valls \email{flamejat@@gmail.com}
+#' @export
+
+CentralAndStandardizedStatistics = function( X, N )
+{
+	# compute central moments
+	mu = matrix( 0, 1, N);
+	mu[ 1 ] = mean(X);
+	for( n in 2 : N )
+	{
+	    mu[ n ] = centeredmoment(X, n);
+	}
+
+	# compute standardized statistics 
+
+	ga = mu;
+
+	ga[ 2 ] = sqrt( mu[ 2 ]);
+	for( n in 3 : N )
+	{
+	    ga[ n ] = mu[ n ] / (ga[ 2 ] ^ n);
+	}
+	
+	return( list( ga = ga, mu = mu ) );
+
+}
\ No newline at end of file

Added: pkg/Meucci/R/Cumul2Raw.R
===================================================================
--- pkg/Meucci/R/Cumul2Raw.R	                        (rev 0)
+++ pkg/Meucci/R/Cumul2Raw.R	2013-07-04 12:23:49 UTC (rev 2498)
@@ -0,0 +1,30 @@
+#' Map cumulative moments into raw moments, as described in A. Meucci "Risk and Asset Allocation",
+#' Springer, 2005
+#'
+#'	@param    ka  : [vector] (length N corresponding to order N) cumulative moments
+#'
+#'	@return   mu_ : [vector] (length N corresponding to order N) corresponding raw moments
+#'
+#' @references
+#' \url{http://symmys.com/node/170}
+#' See Meucci's script for "Cumul2Raw.m"
+#'
+#' @author Xavier Valls \email{flamejat@@gmail.com}
+#' @export
+Cumul2Raw = function( ka )
+{
+	N  = length( ka );
+	mu_ = ka;
+
+	for( n in 2 : N )
+	{
+	    #ka[ n ] = mu_[ n ]; Doesn't make sense
+
+	    for( k in 1 : (n-1) )
+	    {
+	        mu_[ n ] = mu_[ n ] + choose( n-1, k-1 ) * ka[ k ] * mu_[ n-k ]; 
+	    }    
+	}
+
+	return( mu_ );
+}
\ No newline at end of file

Modified: pkg/Meucci/R/PerformIidAnalysis.R
===================================================================
--- pkg/Meucci/R/PerformIidAnalysis.R	2013-07-03 23:49:26 UTC (rev 2497)
+++ pkg/Meucci/R/PerformIidAnalysis.R	2013-07-04 12:23:49 UTC (rev 2498)
@@ -11,7 +11,7 @@
 #     under i.i.d. the location-dispersion ellipsoid should be a circle
 #'
 #' @references
-#' \url{http://}
+#' \url{http://symmys.com/node/170}
 #' See Meucci's script for "PerformIidAnalysis.m"
 #'
 #' @author Xavier Valls \email{flamejat@@gmail.com}

Added: pkg/Meucci/R/Raw2Central.R
===================================================================
--- pkg/Meucci/R/Raw2Central.R	                        (rev 0)
+++ pkg/Meucci/R/Raw2Central.R	2013-07-04 12:23:49 UTC (rev 2498)
@@ -0,0 +1,33 @@
+#' Map raw moments into central moments, as described in A. Meucci "Risk and Asset Allocation",
+#'  Springer, 2005
+#'
+#'	@param    mu_ : [vector] (length N corresponding to order N) corresponding raw moments
+#'
+#'	@return   mu  : [vector] (length N corresponding to order N) central moments
+#'
+#' @references
+#' \url{http://symmys.com/node/170}
+#' See Meucci's script for "Raw2Central.m"
+#'
+#' @author Xavier Valls \email{flamejat@@gmail.com}
+#' @export
+
+Raw2Central = function( mu_ )
+{
+	N  = length( mu_ );
+	mu = mu_;
+
+	for( n in 2 : N )
+	{
+		mu[ n ] = ( (-1) ^ n ) * ( mu_[ 1 ] )^( n );
+	    
+	    for( k in 1 : (n-1) )
+	    {
+	        mu[ n ] = mu[ n ] + choose( n, k ) * ((-1)^(n-k)) * mu_[ k ] * (mu_[ 1 ])^(n-k) ; 
+	    }    
+
+	    mu[ n ] = mu[ n ] + mu_[ n ];
+	}
+
+	return( mu );
+}
\ No newline at end of file

Added: pkg/Meucci/R/Raw2Cumul.R
===================================================================
--- pkg/Meucci/R/Raw2Cumul.R	                        (rev 0)
+++ pkg/Meucci/R/Raw2Cumul.R	2013-07-04 12:23:49 UTC (rev 2498)
@@ -0,0 +1,30 @@
+#' Map raw moments into cumulative moments, as described in A. Meucci "Risk and Asset Allocation",
+#' Springer, 2005
+#'
+#'	@param    mu_ : [vector] (length N corresponding to order N) corresponding raw moments
+#'
+#'	@return   ka  : [vector] (length N corresponding to order N) cumulative moments
+#'
+#' @references
+#' \url{http://symmys.com/node/170}
+#' See Meucci's script for "Raw2Cumul.m"
+#'
+#' @author Xavier Valls \email{flamejat@@gmail.com}
+#' @export
+Raw2Cumul = function( mu_ )
+{
+	N  = length( mu_ );
+	ka = mu_;
+
+	for( n in 2 : N )
+	{
+	    #ka[ n ] = mu_[ n ]; Doesn't make sense
+
+	    for( k in 1 : (n-1) )
+	    {
+	        ka[ n ] = ka[ n ] - choose( n-1, k-1 ) * ka[ k ] * mu_[ n-k ]; 
+	    }    
+	}
+
+	return( ka );
+}
\ No newline at end of file

Added: pkg/Meucci/demo/S_LinVsLogReturn.R
===================================================================
--- pkg/Meucci/demo/S_LinVsLogReturn.R	                        (rev 0)
+++ pkg/Meucci/demo/S_LinVsLogReturn.R	2013-07-04 12:23:49 UTC (rev 2498)
@@ -0,0 +1,84 @@
+#' This script project a distribution in the future according to the i.i.d.-implied square-root rule, as described
+#'  in A. Meucci "Risk and Asset Allocation", Springer, 2005, chapter 3.
+#'
+#' @references
+#' \url{http://symmys.com/node/170}
+#' See Meucci's script for "S_LinVsLogReturn.m"
+#'
+#' @author Xavier Valls \email{flamejat@@gmail.com}
+
+
+##################################################################################################################
+### Inputs
+# in general R=exp(C)-1. Furtheremore, here we assume C~N(m*t,s^2*t) 
+m = 0.05;
+s = 0.25;
+
+ts = seq( 0.1, 3, 0.3 );
+ps = matrix( c( 0.01, 0.99 ) );
+
+D = 0.7 * min( abs( diff( ts ) ) );
+C = list( q = NULL, x = NULL, pdf = NULL);
+R = list( q = NULL, x = NULL, pdf = NULL);
+
+Steps = 100;
+
+for( i in 1 : length(ts) )
+{
+    t = ts[ i ];
+    
+    q = qnorm( ps, m * t ,s * sqrt( t ) );
+    
+    x = seq( min(q), max(q) , (max(q)-min(q))/Steps );
+
+    pdf = dnorm( x, m*t, s*sqrt(t));
+    pdf = pdf / max( pdf ) * D;
+    
+    C$q   = cbind( C$q, q );
+    C$pdf = cbind( C$pdf, pdf );
+    C$x   = cbind( C$x, x );
+
+    q = exp( q )-1;
+    
+    x = seq( min(q), max(q), (max(q)-min(q))/Steps );
+
+    pdf = dlnorm( x + 1, m * t, s * sqrt( t ) );
+    pdf = pdf / max( pdf ) * D;
+    
+    R$pdf = cbind( R$pdf, pdf);
+    R$x   = cbind( R$x, x );
+}
+ 
+
+R$q = exp( C$q ) - 1;
+
+Col = rgb( 0.8, 0.8, 0.8 );
+
+subplot('Position', ( 0.05, 0.55, 0.9, 0.4 ) );
+
+par(mfrow=c(2,1));
+
+
+matplot(c( 0, ts ), t(cbind( 0*ps, C$q )), type="l", lty=1, col = "red", 
+    xlab ="", ylab ="", main = "compounded returns" );
+
+
+for( i in 1 : length(ts) )
+{
+    xx = rbind( ts[i] , ts[i] + C$pdf[ ,i ] , ts[i]);
+    yy = rbind( min(C$x[,i]) , C$x[ ,i ], max(C$x[,i]));
+    polygon(xx, yy, col= Col);
+}
+
+
+matplot(c( 0, ts ), t(cbind( 0*ps, R$q )), type="l", lty=1, col = "red", 
+    xlab ="", ylab ="", main = "linear returns" );
+
+for( i in 1 : length(ts) )
+{
+    xx = rbind( ts[i] , ts[i] + R$pdf[ ,i ] , ts[i]);
+    yy = rbind( min(R$x[,i]) , R$x[ ,i ], max(R$x[,i]));
+    polygon(xx, yy, col= Col);
+}
+
+# xlim and ylim  should be ylim = min(yy)*1.5 max(yy)*1.5,  xlim=c(0, max(xx)*1.01)) respectively in each one of the plots
\ No newline at end of file

Added: pkg/Meucci/demo/S_ProjectSummaryStatistics.R
===================================================================
--- pkg/Meucci/demo/S_ProjectSummaryStatistics.R	                        (rev 0)
+++ pkg/Meucci/demo/S_ProjectSummaryStatistics.R	2013-07-04 12:23:49 UTC (rev 2498)
@@ -0,0 +1,58 @@
+
+#' This script projects summary statistics to arbitrary horizons, as described in A. Meucci 
+#' "Risk and Asset Allocation", Springer, 2005, chapter 3.
+#'
+#' @references
+#' \url{http://symmys.com/node/170}
+#' See Meucci's script for "S_ProjectSummaryStatistics.m"
+#'
+#' @author Xavier Valls \email{flamejat@@gmail.com}
+
+##################################################################################################################
+### Inputs
+
+N = 6;   # focus on first N standardized summary statistics
+K = 100; # projection horizon
+
+# generate arbitrary distribution
+J = 100000;  # number of scenarios
+
+Z = rnorm( J ); 
+X = sin( Z ) + log( cos( Z ) + 2 );
+
+##################################################################################################################
+### Compute single-period standardized statistics and central moments
+CaSS = CentralAndStandardizedStatistics( X, N );
+print( CaSS$ga );
+print( CaSS$mu );
+
+# compute single-period non-central moments
+mu_ = Central2Raw( CaSS$mu );
+print( mu_);
+
+# compute single-period cumulants
+ka = Raw2Cumul(mu_);
+print(ka);
+
+# compute multi-period cumulants
+Ka = K * ka;
+print(Ka);
+
+# compute multi-period non-central moments
+Mu_ = Cumul2Raw(Ka);
+print(Mu_);
+
+# compute multi-period central moments
+Mu = Raw2Central(Mu_);
+print(Mu);
+
+# compute multi-period standardized statistics
+Ga = Mu;
+Ga[ 2 ] = sqrt( Mu[ 2 ]);
+
+for( n in 3 : N )
+{
+    Ga[ n ] = Mu[ n ] / ( Ga[ 2 ] ^ n );
+}
+
+print(Ga);
\ No newline at end of file

Added: pkg/Meucci/demo/S_PureResidualBonds.R
===================================================================
--- pkg/Meucci/demo/S_PureResidualBonds.R	                        (rev 0)
+++ pkg/Meucci/demo/S_PureResidualBonds.R	2013-07-04 12:23:49 UTC (rev 2498)
@@ -0,0 +1,39 @@
+
+#' This script models the joint distribution of the yet-to-be realized key rates of the government curve,
+#' as described in A. Meucci "Risk and Asset Allocation", Springer, 2005, chapter 3.
+#'
+#' @references
+#' \url{http://symmys.com/node/170}
+#' See Meucci's script for "S_PureResidualBonds.m"
+#'
+#' @author Xavier Valls \email{flamejat@@gmail.com}
+
+##################################################################################################################
+### Load data
+load("../data/bondAttribution.Rda");
+
+
+##################################################################################################################
+# bondAttribution$B = key rate durations
+# bondAttribution$F = key rate weekly changes
+# bondAttribution$X = bonds returns net of carry
+
+Dim = dim(bondAttribution$B);
+
+U = 0 * bondAttribution$X;
+
+for( t in 1 : Dim[1] )
+{
+    U[ t, ] = bondAttribution$X[ t, ] - bondAttribution$F[ t, ] %*% drop(bondAttribution$B[ t, , ]);
+}
+
+C = cor(cbind( U, bondAttribution$F ) );
+
+
+C_U  = C[ 1:Dim[3], 1:Dim[3] ];
+C_FU = C[ 1:Dim[3], -(1:Dim[3]) ];
+
+# not systematic-plus-idiosyncratic model
+print(C_U);
+print(C_FU); 
+

Modified: pkg/Meucci/man/Central2Raw.Rd
===================================================================
--- pkg/Meucci/man/Central2Raw.Rd	2013-07-03 23:49:26 UTC (rev 2497)
+++ pkg/Meucci/man/Central2Raw.Rd	2013-07-04 12:23:49 UTC (rev 2498)
@@ -1,33 +1,47 @@
-\name{Central2Raw}
-\alias{Central2Raw}
-\title{Transforms first n central moments into first n raw moments (first central moment defined as expectation)}
-\usage{
-  Central2Raw(mu)
-}
-\arguments{
-  \item{mu}{a vector of central moments}
-}
-\value{
-  mu_ a vector of non-central moments
-}
-\description{
-  step 2 of projection process: From the central moments of
-  step 1, we compute the non-central moments. To do so we
-  start with the first non-central moment and apply
-  recursively an identity (formula 20)
-}
-\details{
-  \deqn{ \tilde{ \mu }^{ \big(1\big) }_{X} \equiv \mu
-  ^{\big(1\big)}_{X} \\ \tilde{ \mu }^{ \big(n\big) }_{X}
-  \equiv \mu ^{n}_{X} \sum_{k=0}^{n-1} \big(-1\big)^{n-k+1}
-  \mu ^{n-k}_{X} \tilde{ \mu }^{\big(k\big)}_{X} }
-}
-\author{
-  Ram Ahluwalia \email{rahluwalia at gmail.com}
-}
-\references{
-  A. Meucci - "Exercises in Advanced Risk and Portfolio
-  Management". See page 10. Symmys site containing original
-  MATLAB source code \url{http://www.symmys.com}
-}
-
+\name{Central2Raw}
+\alias{Central2Raw}
+\title{Transforms first n central moments into first n raw moments (first central moment defined as expectation)}
+\usage{
+  Central2Raw(mu)
+
+  Central2Raw(mu)
+}
+\arguments{
+  \item{mu}{a vector of central moments}
+
+  \item{mu}{: [vector] (length N corresponding to order N)
+  central moments}
+}
+\value{
+  mu_ a vector of non-central moments
+
+  mu_ : [vector] (length N corresponding to order N)
+  corresponding raw moments
+}
+\description{
+  step 2 of projection process: From the central moments of
+  step 1, we compute the non-central moments. To do so we
+  start with the first non-central moment and apply
+  recursively an identity (formula 20)
+
+  Map central moments into raw moments
+}
+\details{
+  \deqn{ \tilde{ \mu }^{ \big(1\big) }_{X} \equiv \mu
+  ^{\big(1\big)}_{X} \\ \tilde{ \mu }^{ \big(n\big) }_{X}
+  \equiv \mu ^{n}_{X} \sum_{k=0}^{n-1} \big(-1\big)^{n-k+1}
+  \mu ^{n-k}_{X} \tilde{ \mu }^{\big(k\big)}_{X} }
+}
+\author{
+  Ram Ahluwalia \email{rahluwalia at gmail.com}
+
+  Xavier Valls \email{flamejat at gmail.com}
+}
+\references{
+  A. Meucci - "Exercises in Advanced Risk and Portfolio
+  Management". See page 10. Symmys site containing original
+  MATLAB source code \url{http://www.symmys.com}
+
+  \url{http://} See Meucci's script for "Central2Raw.m"
+}
+

Added: pkg/Meucci/man/CentralAndStandardizedStatistics.Rd
===================================================================
--- pkg/Meucci/man/CentralAndStandardizedStatistics.Rd	                        (rev 0)
+++ pkg/Meucci/man/CentralAndStandardizedStatistics.Rd	2013-07-04 12:23:49 UTC (rev 2498)
@@ -0,0 +1,31 @@
+\name{CentralAndStandardizedStatistics}
+\alias{CentralAndStandardizedStatistics}
+\title{Compute central and standardized statistics, as described in A. Meucci
+"Risk and Asset Allocation", Springer, 2005}
+\usage{
+  CentralAndStandardizedStatistics(X, N)
+}
+\arguments{
+  \item{X}{: [vector] (J x 1) draws from the distribution}
+
+  \item{N}{: [scalar] highest degree for the central
+  moment}
+}
+\value{
+  ga : [vector] (1 x N) standardized statistics up to order
+  N
+
+  mu : [vector] (1 x N) central moments up to order N
+}
+\description{
+  Compute central and standardized statistics, 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
+  "CentralAndStandardizedStatistics.m"
+}
+

Modified: pkg/Meucci/man/Cumul2Raw.Rd
===================================================================
--- pkg/Meucci/man/Cumul2Raw.Rd	2013-07-03 23:49:26 UTC (rev 2497)
+++ pkg/Meucci/man/Cumul2Raw.Rd	2013-07-04 12:23:49 UTC (rev 2498)
@@ -1,36 +1,52 @@
-\name{Cumul2Raw}
-\alias{Cumul2Raw}
-\title{Transforms cumulants of Y-t into raw moments}
-\usage{
-  Cumul2Raw(ka)
-}
-\arguments{
-  \item{ka}{cumulants of Y}
-}
-\value{
-  mu_ the raw non-central moments of Y
-}
-\description{
-  step 5 of the projection process:
-}
-\details{
-  From the cumulants of Y we compute the raw non-central
-  moments of Y
-
-  We do so recursively by the identity in formula (24)
-  which follows from applying (21) and re-arranging terms
-
-  \deqn{ \tilde{ \mu } ^{ \big(n\big) }_{Y} \equiv \kappa^{
-  \big(n\big) }_{Y} + \sum_{k=1}^{n-1} (n-1)C_{k-1}
-  \kappa_{Y}^{ \big(k\big) } \tilde{ \mu } ^{n-k}_{Y} }
-}
-\author{
-  Ram Ahluwalia \email{rahluwalia at gmail.com}
-}
-\references{
-  A. Meucci - "Annualization and General Projection of
-  Skewness, Kurtosis and All Summary Statistics" - formula
-  (24) Symmys site containing original MATLAB source code
-  \url{http://www.symmys.com/node/136}
-}
-
+\name{Cumul2Raw}
+\alias{Cumul2Raw}
+\title{Transforms cumulants of Y-t into raw moments}
+\usage{
+  Cumul2Raw(ka)
+
+  Cumul2Raw(ka)
+}
+\arguments{
+  \item{ka}{cumulants of Y}
+
+  \item{ka}{: [vector] (length N corresponding to order N)
+  cumulative moments}
+}
+\value{
+  mu_ the raw non-central moments of Y
+
+  mu_ : [vector] (length N corresponding to order N)
+  corresponding raw moments
+}
+\description{
+  step 5 of the projection process:
+
+  Map cumulative moments into raw moments, as described in
+  A. Meucci "Risk and Asset Allocation", Springer, 2005
+}
+\details{
+  From the cumulants of Y we compute the raw non-central
+  moments of Y
+
+  We do so recursively by the identity in formula (24)
+  which follows from applying (21) and re-arranging terms
+
+  \deqn{ \tilde{ \mu } ^{ \big(n\big) }_{Y} \equiv \kappa^{
+  \big(n\big) }_{Y} + \sum_{k=1}^{n-1} (n-1)C_{k-1}
+  \kappa_{Y}^{ \big(k\big) } \tilde{ \mu } ^{n-k}_{Y} }
+}
+\author{
+  Ram Ahluwalia \email{rahluwalia at gmail.com}
+
+  Xavier Valls \email{flamejat at gmail.com}
+}
+\references{
+  A. Meucci - "Annualization and General Projection of
+  Skewness, Kurtosis and All Summary Statistics" - formula
+  (24) Symmys site containing original MATLAB source code
+  \url{http://www.symmys.com/node/136}
+
+  \url{http://symmys.com/node/170} See Meucci's script for
+  "Cumul2Raw.m"
+}
+

Modified: pkg/Meucci/man/PerformIidAnalysis.Rd
===================================================================
--- pkg/Meucci/man/PerformIidAnalysis.Rd	2013-07-03 23:49:26 UTC (rev 2497)
+++ pkg/Meucci/man/PerformIidAnalysis.Rd	2013-07-04 12:23:49 UTC (rev 2498)
@@ -24,7 +24,7 @@
   Xavier Valls \email{flamejat at gmail.com}
 }
 \references{
-  \url{http://} See Meucci's script for
+  \url{http://symmys.com/node/170} See Meucci's script for
   "PerformIidAnalysis.m"
 }
 

Modified: pkg/Meucci/man/Raw2Central.Rd
===================================================================
--- pkg/Meucci/man/Raw2Central.Rd	2013-07-03 23:49:26 UTC (rev 2497)
+++ pkg/Meucci/man/Raw2Central.Rd	2013-07-04 12:23:49 UTC (rev 2498)
@@ -1,35 +1,51 @@
-\name{Raw2Central}
-\alias{Raw2Central}
-\title{Transforms the first n raw moments into the first n central moments}
-\usage{
-  Raw2Central(mu_)
-}
-\arguments{
-  \item{mu_}{the raw (multi-period) non-central moment of
-  Y-t}
-}
-\value{
-  mu (multi-period) central moment of Y-t
-}
-\description{
-  step 6 of projection process:
-}
-\details{
-  compute multi-period central moments.
-
-  Note the first central moment defined as expectation.
-
-  \deqn{\tilde{ \mu } ^ {\big(n\big)} _{X} \equiv E \big\{
-  X^{n} \big\}, \\ \mu ^{ \big(n\big) }_{X} \equiv
-  \sum_0^{n-1} \big(-1\big)^{n-k} \mu ^{n-k}_{X} \tilde{
-  \mu }^{k}_{X} + \tilde{ \mu }_{X}^{n} }
-}
-\author{
-  Ram Ahluwalia \email{rahluwalia at gmail.com}
-}
-\references{
-  A. Meucci - "Exercises in Advanced Risk and Portfolio
-  Management". See page 9 Symmys site containing original
-  MATLAB source code \url{http://www.symmys.com}
-}
-
+\name{Raw2Central}
+\alias{Raw2Central}
+\title{Transforms the first n raw moments into the first n central moments}
+\usage{
+  Raw2Central(mu_)
+
+  Raw2Central(mu_)
+}
+\arguments{
+  \item{mu_}{the raw (multi-period) non-central moment of
+  Y-t}
+
+  \item{mu_}{: [vector] (length N corresponding to order N)
+  corresponding raw moments}
+}
+\value{
+  mu (multi-period) central moment of Y-t
+
+  mu : [vector] (length N corresponding to order N) central
+  moments
+}
+\description{
+  step 6 of projection process:
+
+  Map raw moments into central moments, as described in A.
+  Meucci "Risk and Asset Allocation", Springer, 2005
+}
+\details{
+  compute multi-period central moments.
+
+  Note the first central moment defined as expectation.
+
+  \deqn{\tilde{ \mu } ^ {\big(n\big)} _{X} \equiv E \big\{
+  X^{n} \big\}, \\ \mu ^{ \big(n\big) }_{X} \equiv
+  \sum_0^{n-1} \big(-1\big)^{n-k} \mu ^{n-k}_{X} \tilde{
+  \mu }^{k}_{X} + \tilde{ \mu }_{X}^{n} }
+}
+\author{
+  Ram Ahluwalia \email{rahluwalia at gmail.com}
+
+  Xavier Valls \email{flamejat at gmail.com}
+}
+\references{
+  A. Meucci - "Exercises in Advanced Risk and Portfolio
+  Management". See page 9 Symmys site containing original
+  MATLAB source code \url{http://www.symmys.com}
+
+  \url{http://symmys.com/node/170} See Meucci's script for
+  "Raw2Central.m"
+}
+

Modified: pkg/Meucci/man/Raw2Cumul.Rd
===================================================================
--- pkg/Meucci/man/Raw2Cumul.Rd	2013-07-03 23:49:26 UTC (rev 2497)
+++ pkg/Meucci/man/Raw2Cumul.Rd	2013-07-04 12:23:49 UTC (rev 2498)
@@ -1,37 +1,53 @@
-\name{Raw2Cumul}
-\alias{Raw2Cumul}
-\title{Transforms raw moments into cumulants}
-\usage{
-  Raw2Cumul(mu_)
-}
-\arguments{
-  \item{mu_}{non-central moments of the invariant X-t}
-}
-\value{
-  ka cumulants of X-t
-}
-\description{
-  Step 3 of the projection process: From the non-central
-  moments of X-t, we compute the cumulants.
-}
-\details{
-  This process follows from the Taylor approximations for
-  any small z and ln(1+x)~x for any small x, and from the
-  definition of the first cumulant in (17). The we apply
-  recursively the identity in formula (21). See Kendall and
-  Stuart (1969)
-
-  \deqn{ \kappa^{ \big(n\big) }_{X} \equiv \tilde{ \mu } ^{
-  \big(n\big) }_{X} - \sum_{k=1}^{n-1} (n-1)C_{k-1}
-  \kappa_{X}^{ \big(k\big) } \tilde{ \mu } ^{n-k}_{X} }
-}
-\author{
-  Ram Ahluwalia \email{rahluwalia at gmail.com}
-}
-\references{
-  A. Meucci - "Annualization and General Projection of
-  Skewness, Kurtosis and All Summary Statistics" - formula
-  (21) Symmys site containing original MATLAB source code
-  \url{http://www.symmys.com/node/136}
-}
-
+\name{Raw2Cumul}
+\alias{Raw2Cumul}
+\title{Transforms raw moments into cumulants}
+\usage{
+  Raw2Cumul(mu_)
+
+  Raw2Cumul(mu_)
+}
+\arguments{
+  \item{mu_}{non-central moments of the invariant X-t}
+
+  \item{mu_}{: [vector] (length N corresponding to order N)
+  corresponding raw moments}
+}
+\value{
+  ka cumulants of X-t
+
+  ka : [vector] (length N corresponding to order N)
+  cumulative moments
+}
+\description{
+  Step 3 of the projection process: From the non-central
+  moments of X-t, we compute the cumulants.
+
+  Map raw moments into cumulative moments, as described in
+  A. Meucci "Risk and Asset Allocation", Springer, 2005
+}
+\details{
+  This process follows from the Taylor approximations for
+  any small z and ln(1+x)~x for any small x, and from the
+  definition of the first cumulant in (17). The we apply
+  recursively the identity in formula (21). See Kendall and
+  Stuart (1969)
+
+  \deqn{ \kappa^{ \big(n\big) }_{X} \equiv \tilde{ \mu } ^{
+  \big(n\big) }_{X} - \sum_{k=1}^{n-1} (n-1)C_{k-1}
+  \kappa_{X}^{ \big(k\big) } \tilde{ \mu } ^{n-k}_{X} }
+}
+\author{
+  Ram Ahluwalia \email{rahluwalia at gmail.com}
+
+  Xavier Valls \email{flamejat at gmail.com}
+}
+\references{
+  A. Meucci - "Annualization and General Projection of
+  Skewness, Kurtosis and All Summary Statistics" - formula
+  (21) Symmys site containing original MATLAB source code
+  \url{http://www.symmys.com/node/136}
+
+  \url{http://symmys.com/node/170} See Meucci's script for
+  "Raw2Cumul.m"
+}
+



More information about the Returnanalytics-commits mailing list