[Returnanalytics-commits] r2625 - in pkg/PortfolioAnalytics: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jul 23 01:51:40 CEST 2013


Author: rossbennett34
Date: 2013-07-23 01:51:40 +0200 (Tue, 23 Jul 2013)
New Revision: 2625

Added:
   pkg/PortfolioAnalytics/man/random_portfolios_v1.Rd
   pkg/PortfolioAnalytics/man/randomize_portfolio_v1.Rd
Modified:
   pkg/PortfolioAnalytics/NAMESPACE
   pkg/PortfolioAnalytics/R/random_portfolios.R
   pkg/PortfolioAnalytics/man/random_portfolios.Rd
   pkg/PortfolioAnalytics/man/randomize_portfolio.Rd
Log:
alias _v2 of random portfolios functions and add _v1 to old random portfolios functions

Modified: pkg/PortfolioAnalytics/NAMESPACE
===================================================================
--- pkg/PortfolioAnalytics/NAMESPACE	2013-07-22 23:44:43 UTC (rev 2624)
+++ pkg/PortfolioAnalytics/NAMESPACE	2013-07-22 23:51:40 UTC (rev 2625)
@@ -51,11 +51,11 @@
 export(print.optimize.portfolio.pso)
 export(print.optimize.portfolio.random)
 export(print.optimize.portfolio.ROI)
+export(random_portfolios_v1)
 export(random_portfolios_v2)
-export(random_portfolios)
 export(random_walk_portfolios)
+export(randomize_portfolio_v1)
 export(randomize_portfolio_v2)
-export(randomize_portfolio)
 export(return_objective)
 export(risk_budget_objective)
 export(rp_transform)

Modified: pkg/PortfolioAnalytics/R/random_portfolios.R
===================================================================
--- pkg/PortfolioAnalytics/R/random_portfolios.R	2013-07-22 23:44:43 UTC (rev 2624)
+++ pkg/PortfolioAnalytics/R/random_portfolios.R	2013-07-22 23:51:40 UTC (rev 2625)
@@ -53,7 +53,7 @@
 #' @return named weighting vector
 #' @author Peter Carl, Brian G. Peterson, (based on an idea by Pat Burns)
 #' @export
-randomize_portfolio <- function (rpconstraints, max_permutations=200, rounding=3)
+randomize_portfolio_v1 <- function (rpconstraints, max_permutations=200, rounding=3)
 
 { # @author: Peter Carl, Brian Peterson (based on an idea by Pat Burns)
   # generate random permutations of a portfolio seed meeting your constraints on the weights of each asset
@@ -173,7 +173,7 @@
 #' rpconstraint<-constraint(assets=10, min_mult=-Inf, max_mult=Inf, min_sum=.99, max_sum=1.01, min=.01, max=.4, weight_seq=generatesequence())
 #' rp<- random_portfolios(rpconstraints=rpconstraint,permutations=1000)
 #' head(rp)
-random_portfolios <- function (rpconstraints,permutations=100,...)
+random_portfolios_v1 <- function (rpconstraints,permutations=100,...)
 { # 
   # this function generates a series of portfolios that are a "random walk" from the current portfolio
   seed=rpconstraints$assets
@@ -203,9 +203,10 @@
 #' @param rounding integer how many decimals should we round to
 #' @return named weighting vector
 #' @author Peter Carl, Brian G. Peterson, (based on an idea by Pat Burns)
+#' @aliases randomize_portfolio
+#' @rdname randomize_portfolio
 #' @export
 randomize_portfolio_v2 <- function (portfolio, max_permutations=200) { 
-  # @author: Peter Carl, Brian Peterson (based on an idea by Pat Burns)
   # generate random permutations of a portfolio seed meeting your constraints on the weights of each asset
   # set the portfolio to the seed
   seed <- portfolio$assets
@@ -324,6 +325,8 @@
 #' @return matrix of random portfolio weights
 #' @seealso \code{\link{portfolio.spec}}, \code{\link{objective}}, \code{\link{randomize_portfolio_v2}}
 #' @author Peter Carl, Brian G. Peterson, (based on an idea by Pat Burns)
+#' @aliases random_portfolios
+#' @rdname random_portfolios
 #' @export
 random_portfolios_v2 <- function( portfolio, permutations=100, ...)
 { # 
@@ -348,6 +351,12 @@
   return(result)
 }
 
+# Alias randomize_portfolio_v2 to randomize_portfolio
+randomize_portfolio <- randomize_portfolio_v2
+
+# Alias random_portfolios_v2 to random_portfolios
+random_portfolios <- random_portfolios_v2
+
 # EXAMPLE: start_t<- Sys.time(); x=random_walk_portfolios(rep(1/5,5), generatesequence(min=0.01, max=0.30, by=0.01), max_permutations=500, permutations=5000, min_sum=.99, max_sum=1.01); end_t<-Sys.time(); end_t-start_t;
 # > nrow(unique(x))
 # [1] 4906

Modified: pkg/PortfolioAnalytics/man/random_portfolios.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/random_portfolios.Rd	2013-07-22 23:44:43 UTC (rev 2624)
+++ pkg/PortfolioAnalytics/man/random_portfolios.Rd	2013-07-22 23:51:40 UTC (rev 2625)
@@ -1,12 +1,13 @@
-\name{random_portfolios}
+\name{random_portfolios_v2}
 \alias{random_portfolios}
-\title{generate an arbitary number of constrained random portfolios}
+\alias{random_portfolios_v2}
+\title{version 2 generate an arbitary number of constrained random portfolios}
 \usage{
-  random_portfolios(rpconstraints, permutations = 100, ...)
+  random_portfolios_v2(portfolio, permutations = 100, ...)
 }
 \arguments{
-  \item{rpconstraints}{an object of type "constraints"
-  specifying the constraints for the optimization, see
+  \item{portfolio}{an object of type "portfolio" specifying
+  the constraints for the optimization, see
   \code{\link{constraint}}}
 
   \item{permutations}{integer: number of unique constrained
@@ -22,17 +23,12 @@
   generate an arbitrary number of constrained random
   portfolios.
 }
-\examples{
-rpconstraint<-constraint(assets=10, min_mult=-Inf, max_mult=Inf, min_sum=.99, max_sum=1.01, min=.01, max=.4, weight_seq=generatesequence())
-rp<- random_portfolios(rpconstraints=rpconstraint,permutations=1000)
-head(rp)
-}
 \author{
   Peter Carl, Brian G. Peterson, (based on an idea by Pat
   Burns)
 }
 \seealso{
-  \code{\link{constraint}}, \code{\link{objective}},
-  \code{\link{randomize_portfolio}}
+  \code{\link{portfolio.spec}}, \code{\link{objective}},
+  \code{\link{randomize_portfolio_v2}}
 }
 

Added: pkg/PortfolioAnalytics/man/random_portfolios_v1.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/random_portfolios_v1.Rd	                        (rev 0)
+++ pkg/PortfolioAnalytics/man/random_portfolios_v1.Rd	2013-07-22 23:51:40 UTC (rev 2625)
@@ -0,0 +1,39 @@
+\name{random_portfolios_v1}
+\alias{random_portfolios_v1}
+\title{generate an arbitary number of constrained random portfolios}
+\usage{
+  random_portfolios_v1(rpconstraints, permutations = 100,
+    ...)
+}
+\arguments{
+  \item{rpconstraints}{an object of type "constraints"
+  specifying the constraints for the optimization, see
+  \code{\link{constraint}}}
+
+  \item{permutations}{integer: number of unique constrained
+  random portfolios to generate}
+
+  \item{\dots}{any other passthru parameters}
+}
+\value{
+  matrix of random portfolio weights
+}
+\description{
+  repeatedly calls \code{\link{randomize_portfolio}} to
+  generate an arbitrary number of constrained random
+  portfolios.
+}
+\examples{
+rpconstraint<-constraint(assets=10, min_mult=-Inf, max_mult=Inf, min_sum=.99, max_sum=1.01, min=.01, max=.4, weight_seq=generatesequence())
+rp<- random_portfolios(rpconstraints=rpconstraint,permutations=1000)
+head(rp)
+}
+\author{
+  Peter Carl, Brian G. Peterson, (based on an idea by Pat
+  Burns)
+}
+\seealso{
+  \code{\link{constraint}}, \code{\link{objective}},
+  \code{\link{randomize_portfolio}}
+}
+

Modified: pkg/PortfolioAnalytics/man/randomize_portfolio.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/randomize_portfolio.Rd	2013-07-22 23:44:43 UTC (rev 2624)
+++ pkg/PortfolioAnalytics/man/randomize_portfolio.Rd	2013-07-22 23:51:40 UTC (rev 2625)
@@ -1,14 +1,14 @@
-\name{randomize_portfolio}
+\name{randomize_portfolio_v2}
 \alias{randomize_portfolio}
-\title{generate random permutations of a portfolio seed meeting your constraints on the weights of each asset}
+\alias{randomize_portfolio_v2}
+\title{version 2 generate random permutations of a portfolio seed meeting your constraints on the weights of each asset}
 \usage{
-  randomize_portfolio(rpconstraints,
-    max_permutations = 200, rounding = 3)
+  randomize_portfolio_v2(portfolio, max_permutations = 200)
 }
 \arguments{
-  \item{rpconstraints}{an object of type "constraints"
-  specifying the constraints for the optimization, see
-  \code{\link{constraint}}}
+  \item{portfolio}{an object of type "portfolio" specifying
+  the constraints for the optimization, see
+  \code{\link{portfolio.spec}}}
 
   \item{max_permutations}{integer: maximum number of
   iterations to try for a valid portfolio, default 200}
@@ -20,8 +20,9 @@
   named weighting vector
 }
 \description{
-  generate random permutations of a portfolio seed meeting
-  your constraints on the weights of each asset
+  version 2 generate random permutations of a portfolio
+  seed meeting your constraints on the weights of each
+  asset
 }
 \author{
   Peter Carl, Brian G. Peterson, (based on an idea by Pat

Added: pkg/PortfolioAnalytics/man/randomize_portfolio_v1.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/randomize_portfolio_v1.Rd	                        (rev 0)
+++ pkg/PortfolioAnalytics/man/randomize_portfolio_v1.Rd	2013-07-22 23:51:40 UTC (rev 2625)
@@ -0,0 +1,30 @@
+\name{randomize_portfolio_v1}
+\alias{randomize_portfolio_v1}
+\title{generate random permutations of a portfolio seed meeting your constraints on the weights of each asset}
+\usage{
+  randomize_portfolio_v1(rpconstraints,
+    max_permutations = 200, rounding = 3)
+}
+\arguments{
+  \item{rpconstraints}{an object of type "constraints"
+  specifying the constraints for the optimization, see
+  \code{\link{constraint}}}
+
+  \item{max_permutations}{integer: maximum number of
+  iterations to try for a valid portfolio, default 200}
+
+  \item{rounding}{integer how many decimals should we round
+  to}
+}
+\value{
+  named weighting vector
+}
+\description{
+  generate random permutations of a portfolio seed meeting
+  your constraints on the weights of each asset
+}
+\author{
+  Peter Carl, Brian G. Peterson, (based on an idea by Pat
+  Burns)
+}
+



More information about the Returnanalytics-commits mailing list