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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Sep 18 10:49:27 CEST 2013


Author: xavierv
Date: 2013-09-18 10:49:26 +0200 (Wed, 18 Sep 2013)
New Revision: 3132

Modified:
   pkg/Meucci/R/CentralAndStandardizedStatistics.R
   pkg/Meucci/R/FitMultivariateGarch.R
   pkg/Meucci/R/FitOrnsteinUhlenbeck.R
   pkg/Meucci/R/LognormalMoments2Parameters.R
   pkg/Meucci/R/MaxRsqCS.R
   pkg/Meucci/R/MaxRsqTS.R
   pkg/Meucci/R/ProjectionStudentT.R
   pkg/Meucci/R/SimulateJumpDiffusionMerton.R
   pkg/Meucci/demo/S_AutocorrelatedProcess.R
   pkg/Meucci/demo/S_BondProjectionPricingNormal.R
   pkg/Meucci/demo/S_BondProjectionPricingStudentT.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_EquityProjectionPricing.R
   pkg/Meucci/demo/S_FactorAnalysisNotOk.R
   pkg/Meucci/demo/S_FactorResidualCorrelation.R
   pkg/Meucci/demo/S_FixedIncomeInvariants.R
   pkg/Meucci/demo/S_HedgeOptions.R
   pkg/Meucci/demo/S_HorizonEffect.R
   pkg/Meucci/demo/S_JumpDiffusionMerton.R
   pkg/Meucci/demo/S_LinVsLogReturn.R
   pkg/Meucci/demo/S_MultiVarSqrRootRule.R
   pkg/Meucci/demo/S_ProjectNPriceMvGarch.R
   pkg/Meucci/demo/S_ProjectSummaryStatistics.R
   pkg/Meucci/demo/S_PureResidualBonds.R
   pkg/Meucci/demo/S_ResidualAnalysisTheory.R
   pkg/Meucci/demo/S_SelectionHeuristics.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
   pkg/Meucci/demo/S_Toeplitz.R
   pkg/Meucci/demo/S_VolatilityClustering.R
   pkg/Meucci/man/CentralAndStandardizedStatistics.Rd
   pkg/Meucci/man/FitMultivariateGarch.Rd
   pkg/Meucci/man/FitOrnsteinUhlenbeck.Rd
   pkg/Meucci/man/LognormalMoments2Parameters.Rd
   pkg/Meucci/man/MaxRsqCS.Rd
   pkg/Meucci/man/MaxRsqTS.Rd
   pkg/Meucci/man/ProjectionStudentT.Rd
   pkg/Meucci/man/SimulateJumpDiffusionMerton.Rd
   pkg/Meucci/man/garch1f4.Rd
   pkg/Meucci/man/garch2f8.Rd
Log:
 - updated documentation for chapter 3 demo scripts and its functions

Modified: pkg/Meucci/R/CentralAndStandardizedStatistics.R
===================================================================
--- pkg/Meucci/R/CentralAndStandardizedStatistics.R	2013-09-18 05:40:20 UTC (rev 3131)
+++ pkg/Meucci/R/CentralAndStandardizedStatistics.R	2013-09-18 08:49:26 UTC (rev 3132)
@@ -1,6 +1,12 @@
-#' Compute central and standardized statistics, as described in A. Meucci 
-#' "Risk and Asset Allocation", Springer, 2005
+#' @title Compute central and standardized statistics.
 #'
+#' @description Compute central and standardized statistics, as described in A. Meucci 
+#' "Risk and Asset Allocation", Springer, 2005.
+#'
+#'	Computes the central moments \deqn{ CM_1^X \equiv \mu_{X}\,, \quad CM_n^X \equiv E \{(X - E\{ X \})^{n}\}\,, \quad n=2,3,\ldots ,}
+#'  and from them the standarized statistics \deqn{ \mu_{X},\sigma_{X},sk_{X},ku_{X},\gamma_{X}^{(5)}, \ldots ,\gamma_{X}^{(n)} .}
+#'  where \deqn{\gamma_{X}^{(n)} \equiv E \{(X - \mu_{X})^{n}\}/\sigma_{X}^{n},\quad n\geq3 .} 
+#'
 #'	@param    X  : [vector] (J x 1) draws from the distribution
 #'	@param    N  : [scalar] highest degree for the central moment
 #'
@@ -8,9 +14,14 @@
 #'	@return   mu : [vector] (1 x N) central moments up to order N
 #'
 #' @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 97 - Projection of skewness, kurtosis, and all standardized summary statistics".
 #' See Meucci's script for "CentralAndStandardizedStatistics.m"
 #'
+#' Kendall, M., Stuart, A., 1969. The Advanced Theory of Statistics, Volume, 3rd Edition. Griffin.
+#'
+#' A. Meucci - "Annualization and general projection of skweness, kurtosis, and all summary statistics",
+#' GARP Risk Professional August 2010, 55–56. \url{http://symmys.com/node/136}.
 #' @author Xavier Valls \email{flamejat@@gmail.com}
 #' @export
 

Modified: pkg/Meucci/R/FitMultivariateGarch.R
===================================================================
--- pkg/Meucci/R/FitMultivariateGarch.R	2013-09-18 05:40:20 UTC (rev 3131)
+++ pkg/Meucci/R/FitMultivariateGarch.R	2013-09-18 08:49:26 UTC (rev 3132)
@@ -11,10 +11,12 @@
 #'	@return   CTMF    : [matrix] coefficient matrix C-tilde (in the notation of the paper)
 #'	@return   Hhat    : [matrix] forecasted conditional covariance matrix
 #'
-#' @note Initially written by Olivier Ledoit and Michael Wolf
+#' @note Code for MATLAB initially written by Olivier Ledoit and Michael Wolf
 #'
 #' @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 136 - Equity market: multivariate GARCH process".
+#'
 #' See Meucci's script for "FitMultivariateGarch.m"
 #'
 #' @author Xavier Valls \email{flamejat@@gmail.com}
@@ -123,11 +125,14 @@
 #'
 #' @note 
 #'  MATLAB's script initially written by Olivier Ledoit, 4/28/1997
-#'  Uses a conditional t-distribution with fixed degrees of freedom
-#'  Difference with garch1f: errors come from the score alone
+#'
+#'   Uses a conditional t-distribution with fixed degrees of freedom
+#'
+#'   Difference with garch1f: errors come from the score alone
 #' 
 #' @references
 #' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170}.
+#'
 #' See Meucci's script for "FitMultivariateGarch.m"
 #'
 #' @author Xavier Valls \email{flamejat@@gmail.com}
@@ -385,14 +390,17 @@
 #'  @return   hferr : [scalar] standard error on hf
 #'
 #' @note 
-#'  Initially written by Olivier Ledoit, 4/28/1997
-#'  Uses a conditional t-distribution with fixed degrees of freedom
-#'  Steepest Ascent on boundary, Hessian off boundary, no grid search
+#'  MATLAB's code initially written by Olivier Ledoit, 4/28/1997
+#'
+#'   Uses a conditional t-distribution with fixed degrees of freedom
+#'
+#'   Steepest Ascent on boundary, Hessian off boundary, no grid search
 #' 
 #' @references
 #' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170}.
-#' See Meucci's script for "FitMultivariateGarch.m"
 #'
+#'  See Meucci's script for "FitMultivariateGarch.m"
+#'
 #' @author Xavier Valls \email{flamejat@@gmail.com}
 #' @export
 
@@ -681,10 +689,11 @@
 #  @return   XXX : [matrix] positive semi-definite matrix with same diagonal elements as A that is closest
 #                           to A according to the Frobenius norm
 #
-# @note Written initially by Ilya Sharapov (1997)
+# @note MATLAB's code written initially by Ilya Sharapov (1997)
 #
 # @references
-# \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 "FitMultivariateGarch.m"
 #
 # @author Xavier Valls \email{flamejat@@gmail.com}

Modified: pkg/Meucci/R/FitOrnsteinUhlenbeck.R
===================================================================
--- pkg/Meucci/R/FitOrnsteinUhlenbeck.R	2013-09-18 05:40:20 UTC (rev 3131)
+++ pkg/Meucci/R/FitOrnsteinUhlenbeck.R	2013-09-18 08:49:26 UTC (rev 3132)
@@ -1,4 +1,6 @@
-#' Fit a multivariate OU process at estimation step tau, as described in  A. Meucci 
+#'  @title Fits a multivariate Ornstein - Uhlenbeck process at estimation step tau.
+#'
+#'  @description Fit a multivariate OU process at estimation step tau, as described in  A. Meucci 
 #' "Risk and Asset Allocation", Springer, 2005
 #'
 #'  @param  Y   : [matrix] (T x N)
@@ -14,6 +16,7 @@
 #'
 #' @references
 #' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170}.
+#'
 #' See Meucci's script for "FitOrnsteinUhlenbeck.m"
 #'
 #' @author Xavier Valls \email{flamejat@@gmail.com}

Modified: pkg/Meucci/R/LognormalMoments2Parameters.R
===================================================================
--- pkg/Meucci/R/LognormalMoments2Parameters.R	2013-09-18 05:40:20 UTC (rev 3131)
+++ pkg/Meucci/R/LognormalMoments2Parameters.R	2013-09-18 08:49:26 UTC (rev 3132)
@@ -1,7 +1,7 @@
 #' @title Computes the mean and standard deviation of a lognormal distribution from its parameters.
 #'
 #' @description determines $\mu$ and $\sigma^2$ from $\Expect\{X\}$ and $\Var\{X\}$, and uses it to determine $\mu$ 
-#'  and $\sigma^{2}$ such that $\Expect\left\{  X\right\} \bydef 3$ and $\Var\left\{  X\right\}  \bydef 5$, as described in  
+#'  and $\sigma^{2}$ such that $\Expect\left\{  X\right\} \equiv 3$ and $\Var\left\{  X\right\}  \equiv 5$, as described in  
 #'  A. Meucci, "Risk and Asset Allocation", Springer, 2005.
 #'
 #' \deqn{\sigma^{2} = \ln \left( 1 + \frac{V}{E^{2}} \right) , }

Modified: pkg/Meucci/R/MaxRsqCS.R
===================================================================
--- pkg/Meucci/R/MaxRsqCS.R	2013-09-18 05:40:20 UTC (rev 3131)
+++ pkg/Meucci/R/MaxRsqCS.R	2013-09-18 08:49:26 UTC (rev 3132)
@@ -22,7 +22,7 @@
 #'
 #' @references
 #' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170}.
-#' Used in "E 123 – Cross-section factors: generalized cross-section industry factors".
+#' Used in "E 123 - Cross-section factors: generalized cross-section industry factors".
 #'
 #' See Meucci's script for "MaxRsqCS.m"
 #'

Modified: pkg/Meucci/R/MaxRsqTS.R
===================================================================
--- pkg/Meucci/R/MaxRsqTS.R	2013-09-18 05:40:20 UTC (rev 3131)
+++ pkg/Meucci/R/MaxRsqTS.R	2013-09-18 08:49:26 UTC (rev 3132)
@@ -15,7 +15,7 @@
 #'  @return   B   : [matrix] (N x K)
 #'
 #'  @note
-#'  Initial code by Tai-Ho Wang 
+#'  Initial MATLAB's code by Tai-Ho Wang. 
 #'
 #' @references
 #' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170}.

Modified: pkg/Meucci/R/ProjectionStudentT.R
===================================================================
--- pkg/Meucci/R/ProjectionStudentT.R	2013-09-18 05:40:20 UTC (rev 3131)
+++ pkg/Meucci/R/ProjectionStudentT.R	2013-09-18 08:49:26 UTC (rev 3132)
@@ -14,7 +14,7 @@
 #'
 #' @references
 #' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170},
-#' "E 141 – Fixed-income market: projection of Student t invariants".
+#' "E 141 - Fixed-income market: projection of Student t invariants".
 #'
 #' See Meucci's script for "ProjectionStudentT.m"
 #'

Modified: pkg/Meucci/R/SimulateJumpDiffusionMerton.R
===================================================================
--- pkg/Meucci/R/SimulateJumpDiffusionMerton.R	2013-09-18 05:40:20 UTC (rev 3131)
+++ pkg/Meucci/R/SimulateJumpDiffusionMerton.R	2013-09-18 08:49:26 UTC (rev 3132)
@@ -1,22 +1,28 @@
-
-#' This function simulates a jump diffusion process, as described in A. Meucci "Risk and Asset Allocation",
-#' Springer, 2005
+#'@title Simulates a Merton jump-diffusion process.
 #'
-#'  @param  m  : [scalar] deterministic drift of diffusion
-#'  @param  s  : [scalar] standard deviation of diffusion
-#'  @param  l  : [scalar] Poisson process arrival rate
-#'  @param  a  : [scalar] drift of log-jump
-#'  @param  D  : [scalar] st.dev of log-jump
-#'  @param  ts : [vector] time steps
-#'  @param  J  : [scalar] number of simulations
+#' @description This function simulates a jump diffusion process, as described in A. Meucci "Risk and Asset Allocation",
+#' Springer, 2005.
 #'
-#'  @return  X  : [matrix] (J x length(ts)) of simulations
+#'  @param  m   [scalar] deterministic drift of diffusion
+#'  @param  s   [scalar] standard deviation of diffusion
+#'  @param  l   [scalar] Poisson process arrival rate
+#'  @param  a   [scalar] drift of log-jump
+#'  @param  D   [scalar] st.dev of log-jump
+#'  @param  ts  [vector] time steps
+#'  @param  J   [scalar] number of simulations
 #'
+#'  @return  X  [matrix] (J x length(ts)) of simulations
+#'
 #' @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 132 - Simulation of a jump-diffusion process".
+#'
 #' See Meucci's script for "SimulateJumpDiffusionMerton.m"
 #'
-#' @author Xavier Valls \email{flamejat@@gmail.com}
+#' Merton, R. C., 1976. "Option pricing when underlying stocks are discontinuous". Journal of Financial
+#' Economics 3, 125–144.
+#' 
+#'@author Xavier Valls \email{flamejat@@gmail.com}
 #' @export
 
 SimulateJumpDiffusionMerton = function( m, s, l, a, D, ts, J )

Modified: pkg/Meucci/demo/S_AutocorrelatedProcess.R
===================================================================
--- pkg/Meucci/demo/S_AutocorrelatedProcess.R	2013-09-18 05:40:20 UTC (rev 3131)
+++ pkg/Meucci/demo/S_AutocorrelatedProcess.R	2013-09-18 08:49:26 UTC (rev 3132)
@@ -3,7 +3,7 @@
 #'
 #' @references
 #' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170},
-#' "E 133 – Simulation of a Ornstein-Uhlenbeck process".
+#' "E 133 - Simulation of a Ornstein-Uhlenbeck process".
 #'
 #' See Meucci's script for "S_AutocorrelatedProcess.m"
 #'

Modified: pkg/Meucci/demo/S_BondProjectionPricingNormal.R
===================================================================
--- pkg/Meucci/demo/S_BondProjectionPricingNormal.R	2013-09-18 05:40:20 UTC (rev 3131)
+++ pkg/Meucci/demo/S_BondProjectionPricingNormal.R	2013-09-18 08:49:26 UTC (rev 3132)
@@ -5,7 +5,7 @@
 #'
 #' @references
 #' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170},
-#' "E 140 – Fixed-income market: projection of normal invariants".
+#' "E 140 - Fixed-income market: projection of normal invariants".
 #'
 #' See Meucci's script for "S_BondProjectionPricingNormal.m"
 #'

Modified: pkg/Meucci/demo/S_BondProjectionPricingStudentT.R
===================================================================
--- pkg/Meucci/demo/S_BondProjectionPricingStudentT.R	2013-09-18 05:40:20 UTC (rev 3131)
+++ pkg/Meucci/demo/S_BondProjectionPricingStudentT.R	2013-09-18 08:49:26 UTC (rev 3132)
@@ -5,7 +5,7 @@
 #'
 #' @references
 #' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170},
-#' "E 141 – Fixed-income market: projection of Student t invariants".
+#' "E 141 - Fixed-income market: projection of Student t invariants".
 #'
 #' See Meucci's script for "S_BondProjectionPricingStudentT.m"
 #'

Modified: pkg/Meucci/demo/S_CallsProjectionPricing.R
===================================================================
--- pkg/Meucci/demo/S_CallsProjectionPricing.R	2013-09-18 05:40:20 UTC (rev 3131)
+++ pkg/Meucci/demo/S_CallsProjectionPricing.R	2013-09-18 08:49:26 UTC (rev 3132)
@@ -4,7 +4,7 @@
 #'
 #' @references
 #' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170},
-#' "E 143 – Derivatives market: projection of invariants".
+#' "E 143 - Derivatives market: projection of invariants".
 #'
 #' See Meucci's script for "S_CallsProjectionPricing.m"
 #'

Modified: pkg/Meucci/demo/S_CrossSectionConstrainedIndustries.R
===================================================================
--- pkg/Meucci/demo/S_CrossSectionConstrainedIndustries.R	2013-09-18 05:40:20 UTC (rev 3131)
+++ pkg/Meucci/demo/S_CrossSectionConstrainedIndustries.R	2013-09-18 08:49:26 UTC (rev 3132)
@@ -4,7 +4,7 @@
 #'
 #' @references
 #' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170},
-#' "E 123 – Cross-section factors: generalized cross-section industry factors".
+#' "E 123 - Cross-section factors: generalized cross-section industry factors".
 #'
 #' See Meucci's script for "S_CrossSectionConstrainedIndustries.m"
 #'

Modified: pkg/Meucci/demo/S_CrossSectionIndustries.R
===================================================================
--- pkg/Meucci/demo/S_CrossSectionIndustries.R	2013-09-18 05:40:20 UTC (rev 3131)
+++ pkg/Meucci/demo/S_CrossSectionIndustries.R	2013-09-18 08:49:26 UTC (rev 3132)
@@ -3,7 +3,7 @@
 #'
 #' @references
 #' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170},
-#' "E 122 – Cross-section factors: unconstrained cross-section industry factors".
+#' "E 122 - Cross-section factors: unconstrained cross-section industry factors".
 #'
 #' See Meucci's script for "S_CrossSectionIndustries.m"
 #'

Modified: pkg/Meucci/demo/S_EquitiesInvariants.R
===================================================================
--- pkg/Meucci/demo/S_EquitiesInvariants.R	2013-09-18 05:40:20 UTC (rev 3131)
+++ pkg/Meucci/demo/S_EquitiesInvariants.R	2013-09-18 08:49:26 UTC (rev 3132)
@@ -3,7 +3,7 @@
 #'
 #' @references
 #' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170},
-#' "E 135 – Equity market: quest for invariance".
+#' "E 135 - Equity market: quest for invariance".
 #'
 #' See Meucci's script for "S_EquitiesInvariants.m"
 #'

Modified: pkg/Meucci/demo/S_EquityProjectionPricing.R
===================================================================
--- pkg/Meucci/demo/S_EquityProjectionPricing.R	2013-09-18 05:40:20 UTC (rev 3131)
+++ pkg/Meucci/demo/S_EquityProjectionPricing.R	2013-09-18 08:49:26 UTC (rev 3132)
@@ -6,7 +6,7 @@
 #'
 #' @references
 #' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170},
-#' "E 138 – Equity market: linear vs. compounded returns projection II".
+#' "E 138 - Equity market: linear vs. compounded returns projection II".
 #'
 #' See Meucci's script for "S_EquityProjectionPricing.m"
 #'

Modified: pkg/Meucci/demo/S_FactorAnalysisNotOk.R
===================================================================
--- pkg/Meucci/demo/S_FactorAnalysisNotOk.R	2013-09-18 05:40:20 UTC (rev 3131)
+++ pkg/Meucci/demo/S_FactorAnalysisNotOk.R	2013-09-18 08:49:26 UTC (rev 3132)
@@ -3,7 +3,7 @@
 #'
 #' @references
 #' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170},
-#' "E 111 – Hidden factors: puzzle".
+#' "E 111 - Hidden factors: puzzle".
 #'
 #' See Meucci's script for "S_FactorAnalysisNotOk.m"
 #'

Modified: pkg/Meucci/demo/S_FactorResidualCorrelation.R
===================================================================
--- pkg/Meucci/demo/S_FactorResidualCorrelation.R	2013-09-18 05:40:20 UTC (rev 3131)
+++ pkg/Meucci/demo/S_FactorResidualCorrelation.R	2013-09-18 08:49:26 UTC (rev 3132)
@@ -4,7 +4,7 @@
 #'
 #' @references
 #' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170},
-#' "E 125 – Correlation factors-residual: normal example".
+#' "E 125 - Correlation factors-residual: normal example".
 #'
 #' See Meucci's script for "S_FactorResidualCorrelation.m"
 #'

Modified: pkg/Meucci/demo/S_FixedIncomeInvariants.R
===================================================================
--- pkg/Meucci/demo/S_FixedIncomeInvariants.R	2013-09-18 05:40:20 UTC (rev 3131)
+++ pkg/Meucci/demo/S_FixedIncomeInvariants.R	2013-09-18 08:49:26 UTC (rev 3132)
@@ -3,7 +3,7 @@
 #'
 #' @references
 #' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170},
-#' "E 139 – Fixed-income market: quest for invariance".
+#' "E 139 - Fixed-income market: quest for invariance".
 #'
 #' See Meucci's script for "S_FixedIncomeInvariants.m"
 #'

Modified: pkg/Meucci/demo/S_HedgeOptions.R
===================================================================
--- pkg/Meucci/demo/S_HedgeOptions.R	2013-09-18 05:40:20 UTC (rev 3131)
+++ pkg/Meucci/demo/S_HedgeOptions.R	2013-09-18 08:49:26 UTC (rev 3132)
@@ -3,7 +3,7 @@
 #'
 #' @references
 #' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170},
-#' "E 127 – Factors on demand: no-Greek hedging".
+#' "E 127 - Factors on demand: no-Greek hedging".
 #'
 #' See Meucci's script for "S_HedgeOptions.m"
 #'

Modified: pkg/Meucci/demo/S_HorizonEffect.R
===================================================================
--- pkg/Meucci/demo/S_HorizonEffect.R	2013-09-18 05:40:20 UTC (rev 3131)
+++ pkg/Meucci/demo/S_HorizonEffect.R	2013-09-18 08:49:26 UTC (rev 3132)
@@ -14,12 +14,12 @@
 #'
 #' R = exp(X)-1 and Z = exp(F)-1 are the linear returns
 #'
-#' @note See "E 116 – Time series factors: analysis of residuals I" from 
+#' @note See "E 116 - Time series factors: analysis of residuals I" from 
 #' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170}.
 #'
 #' @references
 #' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170},
-#' "E 126 – Factors on demand: horizon effect".
+#' "E 126 - Factors on demand: horizon effect".
 #'
 #' See Meucci's script for "S_HorizonEffect.m"
 #'

Modified: pkg/Meucci/demo/S_JumpDiffusionMerton.R
===================================================================
--- pkg/Meucci/demo/S_JumpDiffusionMerton.R	2013-09-18 05:40:20 UTC (rev 3131)
+++ pkg/Meucci/demo/S_JumpDiffusionMerton.R	2013-09-18 08:49:26 UTC (rev 3132)
@@ -1,10 +1,13 @@
-#'This script simulates a jump-diffusion process, as described in A. Meucci, "Risk and Asset Allocation",
+#' This script simulates a jump-diffusion process, as described in A. Meucci, "Risk and Asset Allocation",
 #' Springer, 2005,  Chapter 3.
 #'
 #' @references
-#' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170}.
-#' See Meucci's script for "S_JumoDiffusionMerton.m"
+#' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170},
+#' "E 132 - Simulation of a jump-diffusion process".
 #'
+#' See Meucci's script for "S_JumpDiffusionMerton.m"
+#' @note see  Merton, R. C., 1976. "Option pricing when underlying stocks are discontinuous". Journal of Financial
+#' Economics 3, 125–144.
 #' @author Xavier Valls \email{flamejat@@gmail.com}
 
 ##################################################################################################################

Modified: pkg/Meucci/demo/S_LinVsLogReturn.R
===================================================================
--- pkg/Meucci/demo/S_LinVsLogReturn.R	2013-09-18 05:40:20 UTC (rev 3131)
+++ pkg/Meucci/demo/S_LinVsLogReturn.R	2013-09-18 08:49:26 UTC (rev 3132)
@@ -2,7 +2,9 @@
 #'  in A. Meucci "Risk and Asset Allocation", Springer, 2005, chapter 3.
 #'
 #' @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 137 - Equity market: linear vs. compounded returns projection I".
+#'
 #' See Meucci's script for "S_LinVsLogReturn.m"
 #'
 #' @author Xavier Valls \email{flamejat@@gmail.com}

Modified: pkg/Meucci/demo/S_MultiVarSqrRootRule.R
===================================================================
--- pkg/Meucci/demo/S_MultiVarSqrRootRule.R	2013-09-18 05:40:20 UTC (rev 3131)
+++ pkg/Meucci/demo/S_MultiVarSqrRootRule.R	2013-09-18 08:49:26 UTC (rev 3132)
@@ -2,7 +2,9 @@
 #' Described in A. Meucci,"Risk and Asset Allocation", Springer, 2005,  Chapter 3.
 #'
 #' @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 95 - Multivariate square-root rule".
+#'
 #' See Meucci's script for "S_MultiVarSqrRootRule.m"
 #
 #' @author Xavier Valls \email{flamejat@@gmail.com}
@@ -18,7 +20,6 @@
 ##################################################################################################################
 ### Plots
 Agg = list();
-#names(Agg)=c( "M_hat" , "S_hat", "M_norm", "S_norm");
 
 dev.new();
 plot( swaps$X[ , 1 ],swaps$X[ , 2], xlab = swaps$Names[[1]][1], ylab = swaps$Names[[2]][1] );
@@ -27,8 +28,6 @@
 for( s in 1 : length(Steps) )
 {
 
-    
-
     # compute series at aggregated time steps
     k = Steps[ s ];
     AggX = NULL;
@@ -36,11 +35,10 @@
     while( ( t + k + 1 ) <= T )
     {
         NewTerm = apply( matrix(swaps$X[ t : (t+k-1), ], ,ncol(swaps$X) ),2,sum);
-        AggX = rbind( AggX, NewTerm ); ##ok<AGROW>
+        AggX = rbind( AggX, NewTerm ); 
         t = t + k;
     }
 
-
     # empirical mean/covariance
     
     if(s==1)
@@ -64,6 +62,4 @@
     h1 = TwoDimEllipsoid( Agg[[ s ]]$M_norm, Agg[[ s ]]$S_norm, 1, 0, 0 );
     
     h2 = TwoDimEllipsoid( Agg[[ s ]]$M_hat, Agg[[ s ]]$S_hat, 1, 0, 0 );
-
-    
 }

Modified: pkg/Meucci/demo/S_ProjectNPriceMvGarch.R
===================================================================
--- pkg/Meucci/demo/S_ProjectNPriceMvGarch.R	2013-09-18 05:40:20 UTC (rev 3131)
+++ pkg/Meucci/demo/S_ProjectNPriceMvGarch.R	2013-09-18 08:49:26 UTC (rev 3132)
@@ -4,7 +4,9 @@
 #'"Risk and Asset Allocation", Springer, 2005,  Chapter 3.
 #'
 #' @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 136 - Equity market: multivariate GARCH process".
+#'
 #' See Meucci's script for "S_ProjectNPriceMvGarch.m"
 #'
 #' @author Xavier Valls \email{flamejat@@gmail.com}
@@ -19,9 +21,9 @@
 ### Inputs
 
 Prices = Equities$Prices[ , c(4, 5)];
-J = 10000; # numbers of MC scenarios
+J = 10000;        # numbers of MC scenarios
 N = ncol(Prices); # numbers of securities 
-T = 22; # projection horizon 
+T = 22;           # projection horizon 
 
 ##################################################################################################################
 ### Estimation of daily compounded returns distribution

Modified: pkg/Meucci/demo/S_ProjectSummaryStatistics.R
===================================================================
--- pkg/Meucci/demo/S_ProjectSummaryStatistics.R	2013-09-18 05:40:20 UTC (rev 3131)
+++ pkg/Meucci/demo/S_ProjectSummaryStatistics.R	2013-09-18 08:49:26 UTC (rev 3132)
@@ -3,7 +3,9 @@
 #' "Risk and Asset Allocation", Springer, 2005, chapter 3.
 #'
 #' @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 97 - Projection of skewness, kurtosis, and all standardized summary statistics".
+#'
 #' See Meucci's script for "S_ProjectSummaryStatistics.m"
 #'
 #' @author Xavier Valls \email{flamejat@@gmail.com}

Modified: pkg/Meucci/demo/S_PureResidualBonds.R
===================================================================
--- pkg/Meucci/demo/S_PureResidualBonds.R	2013-09-18 05:40:20 UTC (rev 3131)
+++ pkg/Meucci/demo/S_PureResidualBonds.R	2013-09-18 08:49:26 UTC (rev 3132)
@@ -1,9 +1,10 @@
-
 #' 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
-#' 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 112 - Pure residual models: duration/curve attribution".
+#'
 #' See Meucci's script for "S_PureResidualBonds.m"
 #'
 #' @author Xavier Valls \email{flamejat@@gmail.com}

Modified: pkg/Meucci/demo/S_ResidualAnalysisTheory.R
===================================================================
--- pkg/Meucci/demo/S_ResidualAnalysisTheory.R	2013-09-18 05:40:20 UTC (rev 3131)
+++ pkg/Meucci/demo/S_ResidualAnalysisTheory.R	2013-09-18 08:49:26 UTC (rev 3132)
@@ -2,9 +2,12 @@
 #' Springer, 2005,  Chapter 3.
 #'
 #' @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 117 - Time series factors: analysis of residuals II".
+#'
 #' See Meucci's script for "S_ResidualAnalysisTheory.m"
-#'
+#' @note See #' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170},
+#' "E 116 - Time series factors: analysis of residuals I".
 #' @author Xavier Valls \email{flamejat@@gmail.com}
 #' 
 

Modified: pkg/Meucci/demo/S_SelectionHeuristics.R
===================================================================
--- pkg/Meucci/demo/S_SelectionHeuristics.R	2013-09-18 05:40:20 UTC (rev 3131)
+++ pkg/Meucci/demo/S_SelectionHeuristics.R	2013-09-18 08:49:26 UTC (rev 3132)
@@ -7,7 +7,9 @@
 #'  @return g   : [scalar] r-square for the selected factors
 #'
 #' @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 128 - Factors on demand: selection heuristics".
+#'
 #' See Meucci's script for "SelectGoodness.m"
 #'
 #' @author Xavier Valls \email{flamejat@@gmail.com}
@@ -38,7 +40,9 @@
 #'  @note sorted by ascending order
 #'
 #' @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 128 - Factors on demand: selection heuristics".
+#'
 #' See Meucci's script for "SelectNaive.m"
 #'
 #' @author Xavier Valls \email{flamejat@@gmail.com}
@@ -82,7 +86,9 @@
 #'  @note same than recursive rejection, but it starts from the empty set, instead of from the full set
 #'
 #' @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 128 - Factors on demand: selection heuristics".
+#'
 #' See Meucci's script for "SelectAcceptByS.m"
 #'
 #' @author Xavier Valls \email{flamejat@@gmail.com}
@@ -137,7 +143,9 @@
 #'     	  problem by eliminating the factors one at a time starting from the full set
 #'
 #' @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 128 - Factors on demand: selection heuristics".
+#'
 #' See Meucci's script for "SelectRejectByS.m"
 #'
 #' @author Xavier Valls \email{flamejat@@gmail.com}
@@ -184,7 +192,9 @@
 #'     	  o !!! extremely time consuming !!!
 #'
 #' @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 128 - Factors on demand: selection heuristics".
+#'
 #' See Meucci's script for "SelectRejectByS.m"
 #'
 #' @author Xavier Valls \email{flamejat@@gmail.com}
@@ -211,7 +221,9 @@
 #' as described in A. Meucci, "Risk and Asset Allocation", Springer, 2005,  Chapter 3.
 #'
 #' @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 128 - Factors on demand: selection heuristics".
+#'
 #' See Meucci's script for "S_SelectionHeuristics.m"
 #'
 #' @author Xavier Valls \email{flamejat@@gmail.com}

Modified: pkg/Meucci/demo/S_StatArbSwaps.R
===================================================================
--- pkg/Meucci/demo/S_StatArbSwaps.R	2013-09-18 05:40:20 UTC (rev 3131)
+++ pkg/Meucci/demo/S_StatArbSwaps.R	2013-09-18 08:49:26 UTC (rev 3132)
@@ -2,9 +2,11 @@
 #' "Risk and Asset Allocation", Springer, 2005,  Chapter 3.
 #'
 #' @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 144 – Statistical arbitrage: co-integration trading ".
 #' See Meucci's script for "S_StatArbSwaps.m"
 #'
+#' A. Meucci - "Review of statistical arbitrage, cointegration, and multivariate Ornstein-Uhlenbeck", 2009. \url{http://symmys.com/node/132}
 #' @author Xavier Valls \email{flamejat@@gmail.com}
 
 # TODO: Check the loadings of the principal components analysis, fix the date ticks on the plots.
@@ -19,6 +21,7 @@
 PC  = princomp( covmat=S );
 E   = PC$loadings
 Lam = ( PC$sdev )^2
+
 ##################################################################################################################
 ### Set up dates ticks
 dev.new(); 
@@ -26,7 +29,6 @@
 XTick = NULL;
 years = as.numeric(format(swapParRates$Dates[1],"%Y")) : as.numeric(format(swapParRates$Dates[length(swapParRates$Dates)],"%Y"))
 
-
 for( n in years )
 {
     XTick = cbind( XTick, datenum(n,1,1) ); ##ok<AGROW>
@@ -61,8 +63,6 @@
     
     #set(gca(), 'xlim', X_Lim, 'XTick', XTick);
     #datetick('x','yy','keeplimits','keepticks');
-    #grid off;
-    #title(['eigendirection n. ' num2str(n) ',    theta = ' num2str(Theta)],'FontWeight','bold');
 }
 
 dev.new();

Modified: pkg/Meucci/demo/S_SwapPca2Dim.R
===================================================================
--- pkg/Meucci/demo/S_SwapPca2Dim.R	2013-09-18 05:40:20 UTC (rev 3131)
+++ pkg/Meucci/demo/S_SwapPca2Dim.R	2013-09-18 08:49:26 UTC (rev 3132)
@@ -1,31 +1,40 @@
 #' This script performs the principal component analysis of a simplified two-point swap curve.
 #' it computes and plots, among others, 
-#' 1. the invariants, namely rate changes
-#' 2. the location-dispersion ellipsoid of rates along with the 2-d location-dispersion ellipsoid
-#' 3. the effect on the curve of the two uncorrelated principal factors 
-#' Described in A. Meucci, "Risk and Asset Allocation", Springer, 2005,  Chapter 3.
+#' 		1. the invariants, namely rate changes
 #'
+#' 		2. the location-dispersion ellipsoid of rates along with the 2-d location-dispersion ellipsoid
+#'
+#' 		3. the effect on the curve of the two uncorrelated principal factors 
+#'
+#' Described in A. Meucci, "Risk and Asset Allocation", Springer, 2005,  Chapter 3. 
+#'
 #' @references
-#' \url{http://}
-#' See Meucci's script for "S_AutocorrelatedProcess.m"
+#' A. Meucci - "Exercises in Advanced Risk and Portfolio Management" \url{http://symmys.com/node/170},
+#' "E 110 – Hidden factors: principal component analysis of a two-point swap curve".
 #'
+#' See Meucci's script for "S_SwapPca2Dim.m"
+#'
 #' @author Xavier Valls \email{flamejat@@gmail.com}
+
 ##################################################################################################################
 ### Load data
+
 data("swap2y4y.mat" );
 
 ##################################################################################################################
 ### Current curve
+
 Current_Curve = swap2y4y$Rates[ nrow( swap2y4y$Rates ), ];
 dev.new();
 plot(c( 2, 4 ), Current_Curve, type = "l", main = "Current_Curve", xlab = "time to maturity, years", ylab = "par swap rate, #" );
 
 ##################################################################################################################
 ### Determine weekly invariants (changes in rates)
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/returnanalytics -r 3132


More information about the Returnanalytics-commits mailing list