[Returnanalytics-commits] r2658 - in pkg/Meucci: R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Jul 28 21:54:14 CEST 2013
Author: xavierv
Date: 2013-07-28 21:54:14 +0200 (Sun, 28 Jul 2013)
New Revision: 2658
Removed:
pkg/Meucci/R/Cumul2Raw.R
Modified:
pkg/Meucci/R/InvariantProjection.R
pkg/Meucci/man/Cumul2Raw.Rd
Log:
- fixed duplication for Cumul2Raw
Deleted: pkg/Meucci/R/Cumul2Raw.R
===================================================================
--- pkg/Meucci/R/Cumul2Raw.R 2013-07-28 19:29:59 UTC (rev 2657)
+++ pkg/Meucci/R/Cumul2Raw.R 2013-07-28 19:54:14 UTC (rev 2658)
@@ -1,30 +0,0 @@
-#' 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/InvariantProjection.R
===================================================================
--- pkg/Meucci/R/InvariantProjection.R 2013-07-28 19:29:59 UTC (rev 2657)
+++ pkg/Meucci/R/InvariantProjection.R 2013-07-28 19:54:14 UTC (rev 2658)
@@ -34,7 +34,7 @@
return( mu = mu )
}
-#' Transforms cumulants of Y-t into raw moments
+#' Map cumulative moments into raw moments.
#'
#' step 5 of the projection process:
#'
@@ -46,28 +46,35 @@
#' \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} }
#'
-#' @param ka cumulants of Y
-#' @return mu_ the raw non-central moments of Y
+#' @param ka : [vector] (length N corresponding to order N) cumulative moments
+#'
+#' @return mu_ : [vector] (length N corresponding to order N) corresponding raw moments
#'
-#' @author Ram Ahluwalia \email{rahluwalia@@gmail.com}
+#' @author Xavier Valls \email{flamejat@@gmail.com} and Ram Ahluwalia \email{rahluwalia@@gmail.com}
#' @references
+#' \url{http://symmys.com/node/170}
+#' See Meucci's script for "Cumul2Raw.m".
+#'
#' 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}
#' @export
+
Cumul2Raw = function( ka )
{
- N = length( ka )
- mu_ = ka
-
- for ( n in 1:N )
+ N = length( ka );
+ mu_ = ka;
+
+ for( n in 2 : N )
{
- mu_[n] = ka[n]
- for ( k in 1:(n-1) )
- {
- if ( n != 1 ) { mu_[n] = mu_[n] + choose(n-1,k-1) * ka[k] * mu_[n-k] }
- }
- }
- return( mu_ = mu_ )
+ #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_ );
}
#' Transforms raw moments into cumulants
Modified: pkg/Meucci/man/Cumul2Raw.Rd
===================================================================
--- pkg/Meucci/man/Cumul2Raw.Rd 2013-07-28 19:29:59 UTC (rev 2657)
+++ pkg/Meucci/man/Cumul2Raw.Rd 2013-07-28 19:54:14 UTC (rev 2658)
@@ -1,19 +1,21 @@
\name{Cumul2Raw}
\alias{Cumul2Raw}
-\title{Transforms cumulants of Y-t into raw moments}
+\title{Map cumulative moments 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}
\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
mu_ : [vector] (length N corresponding to order N)
corresponding raw moments
@@ -36,11 +38,15 @@
\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} and Ram Ahluwalia
+ \email{rahluwalia at gmail.com}
Xavier Valls \email{flamejat at gmail.com}
}
\references{
+ \url{http://symmys.com/node/170} See Meucci's script for
+ "Cumul2Raw.m".
+
A. Meucci - "Annualization and General Projection of
Skewness, Kurtosis and All Summary Statistics" - formula
(24) Symmys site containing original MATLAB source code
More information about the Returnanalytics-commits
mailing list