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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Aug 20 13:56:03 CEST 2013


Author: xavierv
Date: 2013-08-20 13:56:03 +0200 (Tue, 20 Aug 2013)
New Revision: 2835

Added:
   pkg/Meucci/R/CovertCompoundedReturns2Price.R
   pkg/Meucci/man/ConvertCompoundedReturns2Price.Rd
Modified:
   pkg/Meucci/DESCRIPTION
   pkg/Meucci/NAMESPACE
Log:
- added ConvertCompoundedReturns2Price function

Modified: pkg/Meucci/DESCRIPTION
===================================================================
--- pkg/Meucci/DESCRIPTION	2013-08-20 11:46:18 UTC (rev 2834)
+++ pkg/Meucci/DESCRIPTION	2013-08-20 11:56:03 UTC (rev 2835)
@@ -87,5 +87,6 @@
     'FitMultivariateGarch.R'
     'MvnRnd.R'
     'MleRecursionForStudentT.R'
+    'CovertCompoundedReturns2Price.R'
     '
     FitOrnsteinUhlenbeck.R'

Modified: pkg/Meucci/NAMESPACE
===================================================================
--- pkg/Meucci/NAMESPACE	2013-08-20 11:46:18 UTC (rev 2834)
+++ pkg/Meucci/NAMESPACE	2013-08-20 11:56:03 UTC (rev 2835)
@@ -7,6 +7,7 @@
 export(ComputeMVE)
 export(CondProbViews)
 export(ConvertChangeInYield2Price)
+export(ConvertCompoundedReturns2Price)
 export(Cumul2Raw)
 export(DetectOutliersViaMVE)
 export(EntropyProg)

Added: pkg/Meucci/R/CovertCompoundedReturns2Price.R
===================================================================
--- pkg/Meucci/R/CovertCompoundedReturns2Price.R	                        (rev 0)
+++ pkg/Meucci/R/CovertCompoundedReturns2Price.R	2013-08-20 11:56:03 UTC (rev 2835)
@@ -0,0 +1,29 @@
+#' Convert compounded returns to prices for equity-like securities, as described in 
+#' A. Meucci "Risk and Asset Allocation", Springer, 2005
+#'
+#'  @param	Exp_Comp_Rets   : [vector] (N x 1) expected values of compounded returns
+#'	@param	Cov_Comp_Rets   : [matrix] (N x N) covariance matrix of compounded returns
+#'  @param	Starting_Prices : [vector] (N x 1) 
+#'  
+#'  @return	Exp_Prices    : [vector] (N x 1) expected values of prices
+#'  @return	Cov_Prices    : [matrix] (N x N) covariance matrix of prices
+#'
+#' @references
+#' \url{http://symmys.com/node/170}
+#' See (6.77)-(6.79) in "Risk and Asset Allocation"-Springer (2005), by A. Meucci
+#' See Meucci's script for "ConvertCompoundedReturns2Price.m"
+#'
+#' @author Xavier Valls \email{flamejat@@gmail.com}
+#' @export
+
+
+ConvertCompoundedReturns2Price = function(Exp_Comp_Rets, Cov_Comp_Rets, Starting_Prices)
+{
+	Mu = log(Starting_Prices) + Exp_Comp_Rets;
+	Sigma = Cov_Comp_Rets;
+
+	Exp_Prices = exp( Mu + 0.5 * diag( Sigma ) );
+	Cov_Prices = exp( Mu + 0.5 * diag( Sigma ) ) %*% t( exp( Mu + 0.5 * diag(Sigma) )) * ( exp( Sigma ) - 1 );
+
+	return( list( Exp_Prices = Exp_Prices, Cov_Prices = Cov_Prices ) );
+}
\ No newline at end of file

Added: pkg/Meucci/man/ConvertCompoundedReturns2Price.Rd
===================================================================
--- pkg/Meucci/man/ConvertCompoundedReturns2Price.Rd	                        (rev 0)
+++ pkg/Meucci/man/ConvertCompoundedReturns2Price.Rd	2013-08-20 11:56:03 UTC (rev 2835)
@@ -0,0 +1,37 @@
+\name{ConvertCompoundedReturns2Price}
+\alias{ConvertCompoundedReturns2Price}
+\title{Convert compounded returns to prices for equity-like securities, as described in
+A. Meucci "Risk and Asset Allocation", Springer, 2005}
+\usage{
+  ConvertCompoundedReturns2Price(Exp_Comp_Rets,
+    Cov_Comp_Rets, Starting_Prices)
+}
+\arguments{
+  \item{Exp_Comp_Rets}{: [vector] (N x 1) expected values
+  of compounded returns}
+
+  \item{Cov_Comp_Rets}{: [matrix] (N x N) covariance matrix
+  of compounded returns}
+
+  \item{Starting_Prices}{: [vector] (N x 1)}
+}
+\value{
+  Exp_Prices : [vector] (N x 1) expected values of prices
+
+  Cov_Prices : [matrix] (N x N) covariance matrix of prices
+}
+\description{
+  Convert compounded returns to prices for equity-like
+  securities, 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 (6.77)-(6.79) in
+  "Risk and Asset Allocation"-Springer (2005), by A. Meucci
+  See Meucci's script for
+  "ConvertCompoundedReturns2Price.m"
+}
+



More information about the Returnanalytics-commits mailing list