[Returnanalytics-commits] r2971 - pkg/Meucci/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Sep 2 19:24:46 CEST 2013


Author: braverock
Date: 2013-09-02 19:24:46 +0200 (Mon, 02 Sep 2013)
New Revision: 2971

Removed:
   pkg/Meucci/R/ FitOrnsteinUhlenbeck.R
Log:
- remove duplicate copy of the FitOrnSteinUhlenbeck.R script with a *leading* space in the filename


Deleted: pkg/Meucci/R/ FitOrnsteinUhlenbeck.R
===================================================================
--- pkg/Meucci/R/ FitOrnsteinUhlenbeck.R	2013-09-02 12:46:24 UTC (rev 2970)
+++ pkg/Meucci/R/ FitOrnsteinUhlenbeck.R	2013-09-02 17:24:46 UTC (rev 2971)
@@ -1,55 +0,0 @@
-#' 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)
-#'  @param  tau : [scalar] time step
-#'  
-#'  @return Mu  : [vector] long-term means
-#'  @return Th  : [matrix] whose eigenvalues have positive real part / mean reversion speed
-#'  @return Sig : [matrix] Sig = S * S', covariance matrix of Brownian motions
-#'
-#' @note
-#'	o dY_t = -Th * (Y_t - Mu) * dt + S * dB_t where
-#'	o dB_t: vector of Brownian motions
-#'
-#' @references
-#' \url{http://symmys.com/node/170}
-#' See Meucci's script for "EfficientFrontierReturns.m"
-#'
-#' @author Xavier Valls \email{flamejat@@gmail.com}
-#' @export
-
-FitOrnsteinUhlenbeck = function( Y, tau )
-{
-	T = nrow(Y);
-	N = ncol(Y);
-
-	X    = Y[ -1,  ];
-	F    = cbind( matrix( 1, T-1, 1 ), Y[ -nrow(Y), ] );
-	E_XF = t(X) %*% F / T;
-	E_FF = t(F) %*% F / T;
-	B    = E_XF %*% solve( E_FF );
-	if( length( B[ , -1 ] ) != 1 )
-	{
-		Th = -logm( B[ , -1 ] ) / tau;
-
-	}else
-	{
-		Th = -log( B[ , -1 ] ) / tau;
-	}
-
-	Mu = solve( diag( 1, N ) - B[ , -1 ] ) %*%  B[ , 1 ] ;
-
-	U  = F %*% t(B) - X;
-	
-	Sig_tau = cov(U);
-
-	N = length(Mu);
-	TsT = kron( Th, diag( 1, N ) ) + kron( diag( 1, N ), Th );
-
-	VecSig_tau = matrix(Sig_tau, N^2, 1);
-	VecSig = ( solve( diag( 1, N^2 ) - expm( -TsT * tau ) ) %*% TsT ) %*% VecSig_tau;
-	Sig = matrix( VecSig, N, N );
-
-	return( list( Mu = Mu, Theta = Th, Sigma = Sig ) )
-}
\ No newline at end of file



More information about the Returnanalytics-commits mailing list