[Returnanalytics-commits] r2034 - pkg/PortfolioAnalytics/sandbox/attribution/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jun 18 19:33:25 CEST 2012


Author: ababii
Date: 2012-06-18 19:33:25 +0200 (Mon, 18 Jun 2012)
New Revision: 2034

Modified:
   pkg/PortfolioAnalytics/sandbox/attribution/R/attribution.R
Log:
- fixed bug with output when geometric attribution is selected

Modified: pkg/PortfolioAnalytics/sandbox/attribution/R/attribution.R
===================================================================
--- pkg/PortfolioAnalytics/sandbox/attribution/R/attribution.R	2012-06-18 17:11:29 UTC (rev 2033)
+++ pkg/PortfolioAnalytics/sandbox/attribution/R/attribution.R	2012-06-18 17:33:25 UTC (rev 2034)
@@ -169,7 +169,6 @@
     }
     
     # Annualize excess returns
-
     rp.a = prod(1 + rp) - 1              
     rb.a = prod(1 + rb) - 1
     if (geometric == FALSE){
@@ -180,11 +179,11 @@
     }
 
     # Select the appropriate result corresponding to the chosen method
-    result = list()
-    result[[1]] = excess.returns
-    result[[2]] = allocation
-    result[[3]] = selection
     if (geometric == FALSE){
+        result = list()
+        result[[1]] = excess.returns
+        result[[2]] = allocation
+        result[[3]] = selection
         if (method == "top.down"){     # Top-down attribution
             result[[3]] = result[[3]] + interaction
         }



More information about the Returnanalytics-commits mailing list