[Returnanalytics-commits] r3101 - pkg/PortfolioAnalytics/sandbox

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Sep 14 01:06:42 CEST 2013


Author: rossbennett34
Date: 2013-09-14 01:06:41 +0200 (Sat, 14 Sep 2013)
New Revision: 3101

Modified:
   pkg/PortfolioAnalytics/sandbox/rp_method_comparison.R
Log:
Added graphs to compare different fev biasing values for simplex method.

Modified: pkg/PortfolioAnalytics/sandbox/rp_method_comparison.R
===================================================================
--- pkg/PortfolioAnalytics/sandbox/rp_method_comparison.R	2013-09-13 22:30:18 UTC (rev 3100)
+++ pkg/PortfolioAnalytics/sandbox/rp_method_comparison.R	2013-09-13 23:06:41 UTC (rev 3101)
@@ -31,4 +31,17 @@
 # sample has pretty even coverage of feasible space
 # simplex is concentrated around the assets
 # grid is 'pushed'/concentrated to the interior due to normalization
+
+# demonstrate how different values of fev influence the random portfolios of
+# the simplex method
 # This could be a really good example with Shiny for an interactive example
+fev <- 0:5
+par(mfrow=c(2, 3))
+for(i in 1:length(fev)){
+  rp <- random_portfolios(portfolio=pspec, permutations=2000, rp_method='simplex', fev=fev[i])
+  tmp.mean <- apply(rp, 1, function(x) mean(R %*% x))
+  tmp.StdDev <- apply(rp, 1, function(x) StdDev(R=R, weights=x))
+  plot(x=tmp.StdDev, y=tmp.mean, main=paste("FEV =", fev[i]),
+       ylab="mean", xlab="StdDev", col=rgb(0, 0, 100, 50, maxColorValue=255))
+}
+par(mfrow=c(1,1))



More information about the Returnanalytics-commits mailing list