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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Jun 29 02:20:39 CEST 2013


Author: rossbennett34
Date: 2013-06-29 02:20:39 +0200 (Sat, 29 Jun 2013)
New Revision: 2471

Added:
   pkg/PortfolioAnalytics/sandbox/constraints_vignette.pdf
Modified:
   pkg/PortfolioAnalytics/sandbox/constraints_vignette.Rnw
Log:
adding updated constraints_vignette

Modified: pkg/PortfolioAnalytics/sandbox/constraints_vignette.Rnw
===================================================================
--- pkg/PortfolioAnalytics/sandbox/constraints_vignette.Rnw	2013-06-28 23:54:09 UTC (rev 2470)
+++ pkg/PortfolioAnalytics/sandbox/constraints_vignette.Rnw	2013-06-29 00:20:39 UTC (rev 2471)
@@ -24,17 +24,15 @@
   \item[weight\_sum] The weight\_sum constraint is used to constrain the sum of weights. Common use cases of this are to apply a full investment, dollar neutral, or leverage constraint.
   \item[box] Box constraints are used to constrain the minimum and maximum weights of assets. Standard box constraints with a single upper bound and single lower bound as well as per asset inequality constraints on weights can be specified. A special case of box constraints is a long only constraint where the minimum weight is 0 and maximum weight is 1.
   \item[group] Group constraints are used to specify the minimum and maximum weights of groups of assets. A common use case to group assets by market cap or style. Note that group constraints is only implemented for the ROI solvers. Implementing the group constraints for other solvers should be possible in \code{constrained\_objective} using the \code{constrained\_group\_tmp} function.
-  \item[turnover] Turnover can be specified as a constraint, but is not currently implemented. Turnover constraint may not be able to be implemented in the ROI glpk solver. It is implemented for the ROI quadprog solver in sandbox/testing\_turnover.gmv.R. Currently, turnover can be implemented as an objective function and the function has been added to the file \code{R/objectiveFUN.R}.
-  \item[diversification] Diversification can be specified as a constraint, but is not currently implemented in solvers. This can be done in the mapping function in the next part or implemented inside \code{constrained\_objective}. Currently the user can only specify a diversification target value. The function will try to maximize diversification, penalizing a value below the target.
-  \item[volatility] Volatility can be specified as a constraint, but it is not currently implemented. This can be done in the mapping function in the next part or implemented inside \code{constrained\_objective}. See \code{constrained\_objective} for how volatility is handled as an objective. Currently the user can specify a minimum volatility and a maximum volatility. We'll penalize if the minimum or maximum is violated.
+  \item[turnover] Turnover can be specified as a constraint, but is not currently implemented in any solvers. Turnover constraint may not be able to be implemented in the ROI glpk solver. It is implemented for the ROI quadprog solver in sandbox/testing\_turnover.gmv.R. Currently, turnover can be implemented as an objective function and the function has been added to the file \code{R/objectiveFUN.R}. The user can specify a turnover target \code{turnover.target}. Any deviation from the target will be penalized.
+  \item[diversification] Diversification can be specified as a constraint, but is not currently implemented in any solvers. This can be done in the mapping function in the next part or implemented inside \code{constrained\_objective}. The user can  specify a diversification target value \code{div.target}. Any deviation from the target will be penalized.
+  \item[volatility] Volatility can be specified as a constraint, but it is not currently implemented for any solvers. This can be done in the mapping function in the next part or implemented inside \code{constrained\_objective}. See \code{constrained\_objective} for how volatility is handled as an objective. The user can specify a volatility target value \code{vol.target}. Any deviation from the target will be penalized.
+  \item[position\_limit] Integer constraint for max position cardinality constraint. This may be able to be implemented in \code{randomize\_portfolio} by generating portfolios with the number of non-zero weights equal to \code{max.pos}, then fill in weights of zero so the length of the weights vector is equal to the number of assets, then scramble the weights vector. The number of non-zero weights could also be random so that the number of non-zero weights is not always equal to \code{max.pos}. This could be implemented in the DEoptim solver with the mapping function. This might be do-able in Rglpk for max return and min ETL. Rglpk supports mixed integer types, but solve.QP does not. May be able to use branch-and-bound technique using solve.QP.
 \end{itemize}
 
 Constraint TODO
 \begin{itemize}
-  \item[Integer] Integer constraint for cardinality max position constraint. This may be able to be implemented in \code{randomize\_portfolio} by generating portfolios with the number of non-zero weights equal to \code{max.pos} and then fill in weights of zero so the length of the weights vector is equal to the number of assets. Then scramble the weights vector. The number of non-zero weights could also be random so that the number of non-zero weights is not always equal to \code{max.pos}. This could be implemented in the DEoptim solver with the mapping function. This might be do-able in Rglpk for max return and min ETL. Rglpk supports mixed integer types, but solve.QP does not. May be able to use brance-and-bound technique using solve.QP.
-  \item[Quadratic] Need more help on this. Note that the ROI solvers quadprog and glpk do not support quadratic constraints, they only support linear constraints. The ROI pluging for cplex does support quadratic constraints, but this is a commercial product. What are some use case examples?
-  \item[Diversification] Case of quadratic constraint. Could be implemented inside \code{constrained\_objective}.
-  \item[Volatility] See email from Peter Carl. Should be able to specify this as a constraint and then implement inside \code{constrained\_objective}
+  \item[Quadratic] Need more help on this. Note that the ROI solvers quadprog and glpk do not support quadratic constraints, they only support linear constraints. The ROI pluging for cplex does support quadratic constraints, but this is a commercial product. What are some use case examples other than diversification and volatility?
 \end{itemize}
 
 <<>>=
@@ -78,10 +76,10 @@
 pspec$constraints[[2]]
 @
 
-Add group constraints
-The assets are grouped in 2 groups of 2 assets
-The asset weights of the first group must be greater than or equal to 0.15 and less than or equal to 0.65.
-The asset weights of the second group must be greater than or equal to 0.25 and less than or equal to 0.55.
+Add group constraints.
+The assets are grouped in 2 groups of 2 assets.
+The sum of asset weights of the first group must be greater than or equal to 0.15 and less than or equal to 0.65.
+The sum asset weights of the second group must be greater than or equal to 0.25 and less than or equal to 0.55.
 <<>>=
 pspec <- add.constraint(portfolio=pspec, 
                         type="group", 
@@ -92,16 +90,16 @@
 pspec$constraints[[3]]
 @
 
-Add turnover constraint. We'll penalize if \code{max.turnover} value is exceeded.
+Add turnover constraint. Any deviation from \code{turnover.target} is penalized.
 <<>>=
 pspec <- add.constraint(portfolio=pspec,
                         type="turnover", 
-                        max.turnover=0.6,
+                        turnover.target=0.6,
                         enabled=TRUE)
 pspec$constraints[[4]]
 @
 
-Add diversification constraint. We will try to maximize diversification, a diversification value of less than the \code{div.target} will be penalized. 
+Add diversification constraint. Any deviation from \code{div.target} will be penalized. 
 <<>>=
 pspec <- add.constraint(portfolio=pspec,
                         type="diversification",
@@ -110,14 +108,21 @@
 pspec$constraints[[5]]
 @
 
-Add volatility constraint. A portfolio volatility less than \code{min.vol} will be penalized and a portfolio volatility greater than \code{max.vol} will be penalized.
+Add volatility constraint. Any deviation from \code{vol.target} will be penalized.
 <<>>=
 pspec <- add.constraint(portfolio=pspec,
                         type="volatility",
-                        min.vol=0.07,
-                        max.vol=0.12,
+                        vol.target=0.035,
                         enabled=TRUE)
 pspec$constraints[[6]]
 @
 
+Add position\_limit constraint. Constraint on the maximum number of positions or number of assets with non-zero weights.
+<<>>=
+pspec <- add.constraint(portfolio=pspec,
+                        type="position_limit",
+                        max.pos=3,
+                        enabled=TRUE)
+pspec$constraints[[7]]
+@
 \end{document}
\ No newline at end of file

Added: pkg/PortfolioAnalytics/sandbox/constraints_vignette.pdf
===================================================================
(Binary files differ)


Property changes on: pkg/PortfolioAnalytics/sandbox/constraints_vignette.pdf
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream



More information about the Returnanalytics-commits mailing list