Version 1.05 released
This is primarily a bug-fix release, but there are a couple of conveniences also. This has only been updated for R versions 2.10 and later, let us know if you need it for a more ancient version.
As always, you can get the updated version (assuming no firewall issues) with the R command:
install.packages("PortfolioProbe", repos="http://www.portfolioprobe.com/R")
Bug 1: non-random portfolios
In previous versions when forced trades caused all of the constraints to be met, all random portfolios were the same. That sort of stretches the meaning of "random". Fixed in 1.05.
Bug 2: constraints.realized
As noted in the help file for constraints.realized in version 1.04, it generally got confused when you tried to evaluate new constraints. It now works as might be expected, and more conveniently.
Bug 3: time wasting
There was essentially a typo in the code that caused some problems to waste a lot of time. Optimizations including a variance in which the number of assets traded was 25 or less were the time wasters. Random portfolios with variance constraints were also affected.
Time wasting example
The example uses the pprobeData package (see below) The commands are:
require(BurStFin)
require(pprobeData)
xassetvar250 <- var.shrink.eqcor(xassetLogReturns[1:250,])
system.time(trade.optimizer(xassetPrices[251,], xassetvar250, gross=1e6, long.only=TRUE, max.weight=.1, port.size=25))
On a decade-old machine this command takes 537 seconds (2200 portfolio evaluations per second) in version 1.04, and 16 seconds (123,000 portfolio evaluations per second) in version 1.05. (Even moderately more recent machines are three times faster.)
If the "max.weight" is replaced by "risk.fraction", then in both versions it takes 122 seconds (21,000 portfolio evaluations per second). Risk fraction constraints are inherently more computationally intense. A more rational constraint is probably often worth the price.
Convenience 1: risk.fraction
The risk.fraction argument can now be given a list with each component being the bound(s) for a variance-benchmark-style combination. In previous versions it was necessary to build a three-dimensional array if you wanted multiple risk fraction constraints. A specific use case might be to limit the fraction of variance attributed to each asset to 5% and limit the maximum correlation of any asset to the portfolio to 80%. Version 1.05 allows the specification to merely be:
risk.fraction=list(0.05, 0.8), rf.style=c("fraction", "corport")
Convenience 2: build.constraints
The build.constraints function will now accept a list where each component is the data for a constraint. The components don't have to have the assets in the same order, or even have the same assets. The result will be constraints for the assets that are in all of the components of the list.
pprobeData package
As mentioned above, there is now a package called pprobeData. This is fictionalized data that can be used for whatever purpose you like. It has a matrix of daily prices over 6 years for 350 assets (equities). It has the corresponding matrix of log returns, and it has a data frame of Country (totally made up) and Sector (real but disguised) categorizations of the assets.
To get the package do:
install.packages("pprobeData", repos="http://www.portfolioprobe.com/R")
or if you are not on Windows, you can do:
install.packages("pprobeData", type="source", repos="http://www.portfolioprobe.com/R")
Thank you
Thank you for your interest in Portfolio Probe. |