[Returnanalytics-commits] r2066 - pkg/PerformanceAnalytics/sandbox/Meucci/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Jun 24 23:47:21 CEST 2012


Author: mkshah
Date: 2012-06-24 23:47:21 +0200 (Sun, 24 Jun 2012)
New Revision: 2066

Modified:
   pkg/PerformanceAnalytics/sandbox/Meucci/R/HermiteGrid.R
Log:
Moving common functions prior2Posterior and pHist to EntropyProg.R 

Modified: pkg/PerformanceAnalytics/sandbox/Meucci/R/HermiteGrid.R
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Meucci/R/HermiteGrid.R	2012-06-24 21:45:55 UTC (rev 2065)
+++ pkg/PerformanceAnalytics/sandbox/Meucci/R/HermiteGrid.R	2012-06-24 21:47:21 UTC (rev 2066)
@@ -1,33 +1,3 @@
-pHist = function( X , p , nBins )    
-{      
-  if ( length( match.call() ) < 3 )
-  {
-    J = size( X , 1 )        
-    nBins = round( 10 * log(J) )
-  }
-    
-  dist = hist( x = X , breaks = nBins , freq = FALSE , main = "Portfolio return distribution" )
-  n = dist$counts
-  x = dist$breaks    
-  D = x[2] - x[1]
-    
-  N = length(x)
-  np = zeros(N , 1)
-    
-  for (s in 1:N)
-  {
-    # The boolean Index is true is X is within the interval centered at x(s) and within a half-break distance
-    Index = ( X >= x[s] - D/2 ) & ( X <= x[s] + D/2 )    
-    # np = new probabilities?
-    np[ s ] = sum( p[ Index ] )
-    f = np/D
-  }
-    
-  barplot( f , x , 1 )
-    
-  return( list( f = f , x = x ) )
-}
-
 normalizeProb = function( p )
 {
   tol = 1e-20
@@ -64,20 +34,6 @@
   return( p )
 }
 
-Prior2Posterior = function( M , Q , M_Q , S , G , S_G )
-{
-  # Compute posterior moments
-    
-  if ( Q != 0 ) { M_ = M + S %*% t(Q) %*% solve( Q %*% S %*% t(Q) ) %*% ( M_Q - Q %*% M) }
-  else { M_ = M }
-    
-  if ( G != 0 ) { S_ = S + (S %*% t(G)) %*% ( solve(G %*% S %*% t(G)) %*% S_G %*% solve(G %*% S %*% t(G)) - solve( G %*% S %*% t(G)) ) %*% (G %*% S) }
-  else { S_ = S }
-    
-  return( list( M_ = M_ , S_ = S_ ) )
-}
-
-
 hermitePolynomial = function( n )
 {
   # convert last object to matrix



More information about the Returnanalytics-commits mailing list