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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jun 18 14:29:27 CEST 2013


Author: xavierv
Date: 2013-06-18 14:29:27 +0200 (Tue, 18 Jun 2013)
New Revision: 2352

Added:
   pkg/Meucci/R/LognormalParameters2Statistics.R
   pkg/Meucci/inst/
   pkg/Meucci/man/LognormalMoments2Parameters.Rd
   pkg/Meucci/man/LognormalParam2Statistics.Rd
Modified:
   pkg/Meucci/DESCRIPTION
   pkg/Meucci/NAMESPACE
Log:
- added more demos for Meucci's book chapter 2 and the functions required. Problems with 3d histogram axis representation

Modified: pkg/Meucci/DESCRIPTION
===================================================================
--- pkg/Meucci/DESCRIPTION	2013-06-18 09:52:27 UTC (rev 2351)
+++ pkg/Meucci/DESCRIPTION	2013-06-18 12:29:27 UTC (rev 2352)
@@ -59,3 +59,5 @@
     'Prior2Posterior.R'
     'RankingInformation.R'
     'RobustBayesianAllocation.R'
+    'LognormalMoments2Parameters.R'
+    'LognormalParameters2Statistics.R'

Modified: pkg/Meucci/NAMESPACE
===================================================================
--- pkg/Meucci/NAMESPACE	2013-06-18 09:52:27 UTC (rev 2351)
+++ pkg/Meucci/NAMESPACE	2013-06-18 12:29:27 UTC (rev 2352)
@@ -11,6 +11,8 @@
 export(hermitePolynomial)
 export(integrateSubIntervals)
 export(linreturn)
+export(LognormalMoments2Parameters)
+export(LognormalParam2Statistics)
 export(MvnRnd)
 export(NoisyObservations)
 export(normalizeProb)

Added: pkg/Meucci/R/LognormalParameters2Statistics.R
===================================================================
--- pkg/Meucci/R/LognormalParameters2Statistics.R	                        (rev 0)
+++ pkg/Meucci/R/LognormalParameters2Statistics.R	2013-06-18 12:29:27 UTC (rev 2352)
@@ -0,0 +1,29 @@
+#' Compute expectation, Cov, standard deviation and Corr for a lognormal distribution, as described in 
+#' A. Meucci "Risk and Asset Allocation", Springer, 2005
+#'
+#'	@param Mu    : [vector] (N x 1) location parameter
+#'	@param Sigma : [matrix] (N x N) scale parameter
+#'
+#'  
+#'	@return Exp   : [vector] (N x 1) expectation
+#'	@return Cov   : [matrix] (N x N) covariance
+#'	@return Std   : [vector] (N x 1) standard deviation
+#'	@return	Corr  : [matrix] (N x N) correlation
+#'
+#' @references
+#' \url{http://}
+#' See Meucci's script for "LognormalParam2Statistics.m"
+#'
+#' @author Xavier Valls \email{flamejat@@gmail.com}
+#' @export
+
+LognormalParam2Statistics = function(Mu, Sigma)
+{
+
+	Exp = exp( Mu + (1/2) * diag( Sigma ) );
+	Cov = exp( Mu + (1/2) * diag( Sigma ) ) %*% t( exp( Mu + (1/2) * diag( Sigma ) ) ) * ( exp( Sigma ) - 1 );
+	Std = sqrt( diag( Cov ) );
+	Corr = diag( 1 / Std ) %*% Cov %*% diag( 1 / Std );
+
+	return( list( Exp = Exp, Covariance = Cov, Standard_Deviation = Std, Correlation = Corr ));
+}
\ No newline at end of file

Added: pkg/Meucci/man/LognormalMoments2Parameters.Rd
===================================================================
--- pkg/Meucci/man/LognormalMoments2Parameters.Rd	                        (rev 0)
+++ pkg/Meucci/man/LognormalMoments2Parameters.Rd	2013-06-18 12:29:27 UTC (rev 2352)
@@ -0,0 +1,37 @@
+\name{LognormalMoments2Parameters}
+\alias{LognormalMoments2Parameters}
+\title{Compute the mean and standard deviation of a lognormal distribution from its parameters, as described in
+A. Meucci, "Risk and Asset Allocation", Springer, 2005,  Chapter 1.}
+\usage{
+  LognormalMoments2Parameters(e, v)
+}
+\arguments{
+  \item{e}{: [scalar] expected value of the lognormal
+  distribution}
+
+  \item{v}{: [scalar] variance of the lognormal
+  distribution}
+}
+\value{
+  mu : [scalar] expected value of the normal distribution
+
+  sig2 : [scalar] variance of the normal distribution
+}
+\description{
+  Compute the mean and standard deviation of a lognormal
+  distribution from its parameters, as described in A.
+  Meucci, "Risk and Asset Allocation", Springer, 2005,
+  Chapter 1.
+}
+\note{
+  Inverts the formulas (1.98)-(1.99) in Risk and Asset
+  Allocation", Springer, 2005.
+}
+\author{
+  Xavier Valls \email{flamejat at gmail.com}
+}
+\references{
+  \url{http://} See Meucci's script for
+  "LognormalMoments2Parameters"
+}
+

Added: pkg/Meucci/man/LognormalParam2Statistics.Rd
===================================================================
--- pkg/Meucci/man/LognormalParam2Statistics.Rd	                        (rev 0)
+++ pkg/Meucci/man/LognormalParam2Statistics.Rd	2013-06-18 12:29:27 UTC (rev 2352)
@@ -0,0 +1,34 @@
+\name{LognormalParam2Statistics}
+\alias{LognormalParam2Statistics}
+\title{Compute expectation, Cov, standard deviation and Corr for a lognormal distribution, as described in
+A. Meucci "Risk and Asset Allocation", Springer, 2005}
+\usage{
+  LognormalParam2Statistics(Mu, Sigma)
+}
+\arguments{
+  \item{Mu}{: [vector] (N x 1) location parameter}
+
+  \item{Sigma}{: [matrix] (N x N) scale parameter}
+}
+\value{
+  Exp : [vector] (N x 1) expectation
+
+  Cov : [matrix] (N x N) covariance
+
+  Std : [vector] (N x 1) standard deviation
+
+  Corr : [matrix] (N x N) correlation
+}
+\description{
+  Compute expectation, Cov, standard deviation and Corr for
+  a lognormal distribution, as described in A. Meucci "Risk
+  and Asset Allocation", Springer, 2005
+}
+\author{
+  Xavier Valls \email{flamejat at gmail.com}
+}
+\references{
+  \url{http://} See Meucci's script for
+  "LognormalParam2Statistics.m"
+}
+



More information about the Returnanalytics-commits mailing list