From brian at braverock.com Tue Sep 3 18:02:33 2013 From: brian at braverock.com (Brian G. Peterson) Date: Tue, 03 Sep 2013 11:02:33 -0500 Subject: [GSoC-PortA] R CMD check Message-ID: <52260819.4010703@braverock.com> I just ran R CMD check on current svn, and it's kind of a mess. 'R CMD build' runs fine, which is good. The vignettes take over 100 minutes to build using only one core on my 8 (physical) core desktop. CRAN won't like that, but I think it is necessary. I think we can make a case to CRAN that we need non-toy examples for everything, and they can get over it. The rest of check is going to need some work. By far the biggest thing is missing/incorrect parameters in the documentation. This should all be worked out by making rure the roxygen comments are up to date and that the docs are regenerated. Another big area of check wordiness is in the S3 methods (e.g. chart.Scatter, chart.Weights, extractStats) , which we had agreed should be collapsed into a single main entry as I had done with optimize.portfolio, etc. We might need to add some @method tags to the roxygen comments. I think it's rather important to start cleaning this stuff up, we've only got a few weeks left in GSoC. Full results of 'R CMD check --no-vignettes' and the generated manual attached. Regards, Brian -- Brian G. Peterson http://braverock.com/brian/ Ph: 773-459-4973 IM: bgpbraverock -------------- next part -------------- A non-text attachment was scrubbed... Name: 00check.log Type: text/x-log Size: 26874 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: PortfolioAnalytics-manual.pdf Type: application/pdf Size: 269272 bytes Desc: not available URL: From rossbennett34 at gmail.com Tue Sep 3 18:30:56 2013 From: rossbennett34 at gmail.com (Ross Bennett) Date: Tue, 3 Sep 2013 09:30:56 -0700 Subject: [GSoC-PortA] R CMD check In-Reply-To: <52260819.4010703@braverock.com> References: <52260819.4010703@braverock.com> Message-ID: Brian, Thanks for the note. Regarding the S3 generic methods. My intention with the chart.Weights.EF function was that it would be a generic method for optimize.portfolio and efficient.frontier objects. Since chart.Weights is already a generic method for optimize.portfolio objects, I don't think chart.Weights can be used a generic function to chart weights along the efficient frontier. I think I should just rename chart.Weights.EF to chart.WeightsEF. Regarding the other documentation issues, I'll get to work on cleaning those up. Thanks, Ross On Tue, Sep 3, 2013 at 9:02 AM, Brian G. Peterson wrote: > I just ran R CMD check on current svn, and it's kind of a mess. > > 'R CMD build' runs fine, which is good. > > The vignettes take over 100 minutes to build using only one core on my 8 > (physical) core desktop. CRAN won't like that, but I think it is > necessary. I think we can make a case to CRAN that we need non-toy examples > for everything, and they can get over it. > > The rest of check is going to need some work. > > By far the biggest thing is missing/incorrect parameters in the > documentation. This should all be worked out by making rure the roxygen > comments are up to date and that the docs are regenerated. > > Another big area of check wordiness is in the S3 methods (e.g. > chart.Scatter, chart.Weights, extractStats) , which we had agreed should be > collapsed into a single main entry as I had done with optimize.portfolio, > etc. We might need to add some @method tags to the roxygen comments. > > I think it's rather important to start cleaning this stuff up, we've only > got a few weeks left in GSoC. > > Full results of 'R CMD check --no-vignettes' and the generated manual > attached. > > Regards, > > Brian > > -- > Brian G. Peterson > http://braverock.com/brian/ > Ph: 773-459-4973 > IM: bgpbraverock > > _______________________________________________ > GSoC-PortA mailing list > GSoC-PortA at lists.r-forge.r-project.org > http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From brian at braverock.com Tue Sep 3 19:26:59 2013 From: brian at braverock.com (Brian G. Peterson) Date: Tue, 03 Sep 2013 12:26:59 -0500 Subject: [GSoC-PortA] R CMD check In-Reply-To: References: <52260819.4010703@braverock.com> Message-ID: <52261BE3.5040500@braverock.com> On 09/03/2013 11:30 AM, Ross Bennett wrote: > > Regarding the S3 generic methods. My intention with the chart.Weights.EF > function was that it would be a generic method for optimize.portfolio > and efficient.frontier objects. Since chart.Weights is already a generic > method for optimize.portfolio objects, I don't think chart.Weights can > be used a generic function to chart weights along the efficient > frontier. I think I should just rename chart.Weights.EF to chart.WeightsEF. Can the efficient.frontier opbjects be subclassed from the optimize.portfolio objects? (I haven't looked closely at the structure there, so I don't know) -- Brian From rossbennett34 at gmail.com Wed Sep 4 06:53:40 2013 From: rossbennett34 at gmail.com (Ross Bennett) Date: Tue, 3 Sep 2013 21:53:40 -0700 Subject: [GSoC-PortA] R CMD check In-Reply-To: <52261BE3.5040500@braverock.com> References: <52260819.4010703@braverock.com> <52261BE3.5040500@braverock.com> Message-ID: Brian, I'm not entirely sure how to do that or if it is doable with the structure I have. If you have a minute and would be able to take a closer look to see if that is possible would be greatly appreciated. Maybe another option would be to remove chart.Weights.EF.optimize.portfolio and change chart.Weights.EF.efficient.frontier to chart.Weights.efficient.frontier so chart.Weights is a generic function for optimize.portfolio.* and efficient.frontier objects. Although we would lose the ability to plot an efficient frontier directly from an optimize.portfolio, the chart.Weights function would be more consistent. Please advise what you think is the best way to proceed. Thanks, Ross On Tue, Sep 3, 2013 at 10:26 AM, Brian G. Peterson wrote: > On 09/03/2013 11:30 AM, Ross Bennett wrote: > >> >> Regarding the S3 generic methods. My intention with the chart.Weights.EF >> function was that it would be a generic method for optimize.portfolio >> and efficient.frontier objects. Since chart.Weights is already a generic >> method for optimize.portfolio objects, I don't think chart.Weights can >> be used a generic function to chart weights along the efficient >> frontier. I think I should just rename chart.Weights.EF to >> chart.WeightsEF. >> > > Can the efficient.frontier opbjects be subclassed from the > optimize.portfolio objects? (I haven't looked closely at the structure > there, so I don't know) > > -- > Brian > > ______________________________**_________________ > GSoC-PortA mailing list > GSoC-PortA at lists.r-forge.r-**project.org > http://lists.r-forge.r-**project.org/cgi-bin/mailman/**listinfo/gsoc-porta > -------------- next part -------------- An HTML attachment was scrubbed... URL: From brian at braverock.com Sun Sep 8 13:20:37 2013 From: brian at braverock.com (Brian G. Peterson) Date: Sun, 08 Sep 2013 06:20:37 -0500 Subject: [GSoC-PortA] testing scripts to demo ? Message-ID: <522C5D85.6080908@braverock.com> I'm wondering if many/most of the testing_* scripts should lose their testing_ prefix and get 'svn move'd to the demo/ directory. Thoughts? -- Brian From rossbennett34 at gmail.com Sun Sep 8 23:01:15 2013 From: rossbennett34 at gmail.com (Ross Bennett) Date: Sun, 8 Sep 2013 14:01:15 -0700 Subject: [GSoC-PortA] testing scripts to demo ? In-Reply-To: <522C5D85.6080908@braverock.com> References: <522C5D85.6080908@braverock.com> Message-ID: Brian, I agree that several of the testing scripts in the sandbox could be moved to the demo directory. Some could probably be added to existing demos. I'll move or add to existing demos where appropriate. Thanks, Ross On Sun, Sep 8, 2013 at 4:20 AM, Brian G. Peterson wrote: > I'm wondering if many/most of the testing_* scripts should lose their > testing_ prefix and get 'svn move'd to the demo/ directory. > > Thoughts? > > > -- > Brian > ______________________________**_________________ > GSoC-PortA mailing list > GSoC-PortA at lists.r-forge.r-**project.org > http://lists.r-forge.r-**project.org/cgi-bin/mailman/**listinfo/gsoc-porta > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rossbennett34 at gmail.com Mon Sep 16 23:53:00 2013 From: rossbennett34 at gmail.com (Ross Bennett) Date: Mon, 16 Sep 2013 14:53:00 -0700 Subject: [GSoC-PortA] R CMD check info` Message-ID: Brian and others, I ran R CMD check and I only get 3 warnings and 3 notes. The log file is attached. Under the "checking R code for possible problems", there are several lines with something like "no visible binding for global variable 'strategy' ". Is this something that should be addressed? If so, what is the best way to correct this? On a side note, I have made multiple commits over the last two days, but have not received any [Returnanalytics-commits] emails from r-forge. The last email I received was for commit r3107 and my latest commit is r3125.Have any of you received the commit emails recently? Thanks, Ross -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 00check.log Type: application/octet-stream Size: 5797 bytes Desc: not available URL: From brian at braverock.com Tue Sep 17 21:29:22 2013 From: brian at braverock.com (Brian G. Peterson) Date: Tue, 17 Sep 2013 14:29:22 -0500 Subject: [GSoC-PortA] R CMD check info` In-Reply-To: References: Message-ID: Ross, We should chase all warnings. I'll take a look at the log. It looks like R-Forge just fixed their email listserv... Regards, Brian Ross Bennett wrote: >Brian and others, > >I ran R CMD check and I only get 3 warnings and 3 notes. The log file >is >attached. > >Under the "checking R code for possible problems", there are several >lines >with something like "no visible binding for global variable 'strategy' >". >Is this something that should be addressed? If so, what is the best way >to >correct this? > >On a side note, I have made multiple commits over the last two days, >but >have not received any [Returnanalytics-commits] emails from r-forge. >The >last email I received was for commit r3107 and my latest commit is >r3125.Have any of you received the commit emails recently? > >Thanks, >Ross > > >------------------------------------------------------------------------ > >_______________________________________________ >GSoC-PortA mailing list >GSoC-PortA at lists.r-forge.r-project.org >http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. -------------- next part -------------- An HTML attachment was scrubbed... URL: From peter at braverock.com Wed Sep 18 03:53:02 2013 From: peter at braverock.com (Peter Carl) Date: Tue, 17 Sep 2013 20:53:02 -0500 Subject: [GSoC-PortA] Error in plot method Message-ID: Ross, You might already know about this, given that I'm a day behind on svn. Sorry for the lack of detail, I can do more debugging if you need. > R = edhec[,c("Convertible Arbitrage", "Equity Market Neutral","Fixed Income Arbitrage", "Event Driven", "CTA Global", "Global Macro", "Long/Short Equity")] > init.portf <- portfolio.spec(assets=colnames(R)) > init.portf <- add.constraint(portfolio=init.portf, + type="leverage", + min_sum=1, + max_sum=1) > # Add box constraint > init.portf <- add.constraint(portfolio=init.portf, + type="box", + min=0.05, + max=0.3) > > # Add group constraint > init.portf <- add.constraint(portfolio=init.portf, type="group", + groups=list(c(1:4), + c(5:7)), + group_min=c(0.1,.05), + group_max=c(0.85,0.75) + ) > #Add measure 1, annualized return > init.portf <- add.objective(portfolio=init.portf, + type="return", # the kind of objective this is + name="mean", # name of the function + enabled=TRUE, # enable or disable the objective + multiplier=0 # calculate it but don't use it in the objective + ) > > # Add measure 2, annualized standard deviation > init.portf <- add.objective(portfolio=init.portf, + type="risk", # the kind of objective this is + name="var", # to minimize from the sample + enabled=TRUE, # enable or disable the objective + multiplier=0 # calculate it but don't use it in the objective + ) > > # Add measure 3, ES > init.portf <- add.objective(portfolio=init.portf, + type="risk", # the kind of objective this is + name="ES", # the function to minimize + enabled=FALSE, # enable or disable the objective + multiplier=0, # calculate it but don't use it in the objective + arguments=list(p=p) + ) > MeanVar.portf <- init.portf # Turn back on the return and sd objectives > MeanVar.portf$objectives[[1]]$multiplier = -1 # mean > MeanVar.portf$objectives[[2]]$multiplier = 1 # var > MeanVar.ROI<-optimize.portfolio(R=R, + portfolio=MeanVar.portf, + optimize_method='ROI' + ) > summary(MeanVar.ROI) ************************************************** PortfolioAnalytics Optimization Summary ************************************************** Call: optimize.portfolio(R = R, portfolio = MeanVar.portf, optimize_method = "ROI") Optimal Weights: Convertible Arbitrage Equity Market Neutral Fixed Income Arbitrage Event Driven CTA Global Global Macro 0.0500 0.0500 0.0500 0.2134 0.0500 0.3000 Long/Short Equity 0.2866 Objective Measures: mean 0.007309 StdDev 0.01561 Portfolio Assets and Initial Weights: Convertible Arbitrage Equity Market Neutral Fixed Income Arbitrage Event Driven CTA Global Global Macro 0.1428571 0.1428571 0.1428571 0.1428571 0.1428571 0.1428571 Long/Short Equity 0.1428571 ************************************************** PortfolioAnalytics Portfolio Specification ************************************************** Call: portfolio.spec(assets = colnames(R)) Assets Number of assets: 7 Asset Names [1] "Convertible Arbitrage" "Equity Market Neutral" "Fixed Income Arbitrage" "Event Driven" "CTA Global" [6] "Global Macro" "Long/Short Equity" Constraints Number of constraints: 3 Number of enabled constraints: 3 Enabled constraint types - leverage - box - group Number of disabled constraints: 0 Objectives Number of objectives: 3 Number of enabled objectives: 2 Enabled objective names - mean - var Number of disabled objectives: 1 Disabled objective types - ES **************************************** Constraints **************************************** Leverage Constraint: min_sum = 1 max_sum = 1 Box Constraints: min: Convertible Arbitrage Equity Market Neutral Fixed Income Arbitrage Event Driven CTA Global Global Macro 0.05 0.05 0.05 0.05 0.05 0.05 Long/Short Equity 0.05 max: Convertible Arbitrage Equity Market Neutral Fixed Income Arbitrage Event Driven CTA Global Global Macro 0.3 0.3 0.3 0.3 0.3 0.3 Long/Short Equity 0.3 Group Constraints: Groups: $group1 [1] 1 2 3 4 $group2 [1] 5 6 7 Lower bound on group weights, group_min: group1 group2 0.10 0.05 Upper bound on group weights, group_max: group1 group2 0.85 0.75 Group position limits, group_pos: NULL Group Weights: group1 group2 0.3633993 0.6366007 Position Limit Constraints: Maximum number of non-zero weights, max_pos: NULL Realized number of non-zero weights (i.e. positions): [1] 7 Maximum number of long positions, max_pos_long: NULL Realized number of long positions: [1] 7 Maximum number of short positions, max_pos_short: NULL Realized number of short positions: [1] 0 Diversification Target Constraint: NULL Realized diversification: [1] 0.7723208 Turnover Target Constraint: NULL Realized turnover from initial weights: [1] 0.1061224 **************************************** Objectives **************************************** Objective: return_objective $name [1] "mean" $target NULL $arguments list() $enabled [1] TRUE $multiplier [1] -1 $call add.objective(portfolio = init.portf, type = "return", name = "mean", enabled = TRUE, multiplier = 0) attr(,"class") [1] "return_objective" "objective" **************************************** Objective: portfolio_risk_objective $name [1] "var" $target NULL $arguments $arguments$portfolio_method [1] "single" $enabled [1] TRUE $multiplier [1] 1 $call add.objective(portfolio = init.portf, type = "risk", name = "var", enabled = TRUE, multiplier = 0) attr(,"class") [1] "portfolio_risk_objective" "objective" **************************************** Objective: portfolio_risk_objective $name [1] "ES" $target NULL $arguments $arguments$p [1] 0.9166667 $arguments$portfolio_method [1] "single" $enabled [1] FALSE $multiplier [1] 0 $call add.objective(portfolio = init.portf, type = "risk", name = "ES", arguments = list(p = p), enabled = FALSE, multiplier = 0) attr(,"class") [1] "portfolio_risk_objective" "objective" **************************************** Elapsed Time: Time difference of 0.5688059 secs > plot(MeanVar.ROI) Error in apply(R, 2, "mean") : dim(X) must have a positive length > traceback() 10: stop("dim(X) must have a positive length") 9: apply(R, 2, "mean") 8: as.vector(apply(R, 2, "mean")) 7: matrix(as.vector(apply(R, 2, "mean")), ncol = 1) 6: moments(R) 5: applyFUN(R = R, weights = rp, FUN = return.col, ... = ...) 4: chart.Scatter.ROI(object = ROI, rp = rp, return.col = return.col, risk.col = risk.col, ..., chart.assets = chart.assets, element.color = element.color, cex.axis = cex.axis, main = main, xlim = xlim, ylim = ylim) 3: charts.ROI(ROI = x, rp = rp, risk.col = risk.col, return.col = return.col, chart.assets = chart.assets, main = main, xlim = xlim, ylim = ylim, ...) 2: plot.optimize.portfolio.ROI(MeanVar.ROI) 1: plot(MeanVar.ROI) pcc -- Peter Carl http://www.braverock.com/peter From rossbennett34 at gmail.com Wed Sep 18 04:01:26 2013 From: rossbennett34 at gmail.com (Ross Bennett) Date: Tue, 17 Sep 2013 19:01:26 -0700 Subject: [GSoC-PortA] Error in plot method In-Reply-To: References: Message-ID: Peter, Thanks for the note. The error is because you ran optimize.portfolio without trace=TRUE so the returns object, R, is not available. I'll add a check to the function that will throw an error with a more informative message if the R object is missing. Thanks, Ross On Tue, Sep 17, 2013 at 6:53 PM, Peter Carl wrote: > Ross, > > You might already know about this, given that I'm a day behind on svn. > Sorry for the lack of detail, I can do more debugging if you need. > > > R = edhec[,c("Convertible Arbitrage", "Equity Market Neutral","Fixed > Income Arbitrage", "Event Driven", "CTA Global", "Global Macro", > "Long/Short Equity")] > > init.portf <- portfolio.spec(assets=colnames(R)) > > init.portf <- add.constraint(portfolio=init.portf, > + type="leverage", > + min_sum=1, > + max_sum=1) > > # Add box constraint > > init.portf <- add.constraint(portfolio=init.portf, > + type="box", > + min=0.05, > + max=0.3) > > > > # Add group constraint > > init.portf <- add.constraint(portfolio=init.portf, type="group", > + groups=list(c(1:4), > + c(5:7)), > + group_min=c(0.1,.05), > + group_max=c(0.85,0.75) > + ) > > #Add measure 1, annualized return > > init.portf <- add.objective(portfolio=init.portf, > + type="return", # the kind of objective this > is > + name="mean", # name of the function > + enabled=TRUE, # enable or disable the > objective > + multiplier=0 # calculate it but don't use it > in the objective > + ) > > > > # Add measure 2, annualized standard deviation > > init.portf <- add.objective(portfolio=init.portf, > + type="risk", # the kind of objective this is > + name="var", # to minimize from the sample > + enabled=TRUE, # enable or disable the > objective > + multiplier=0 # calculate it but don't use it > in the objective > + ) > > > > # Add measure 3, ES > > init.portf <- add.objective(portfolio=init.portf, > + type="risk", # the kind of objective this is > + name="ES", # the function to minimize > + enabled=FALSE, # enable or disable the > objective > + multiplier=0, # calculate it but don't use > it in the objective > + arguments=list(p=p) > + ) > > MeanVar.portf <- init.portf > # Turn back on the return and sd objectives > > MeanVar.portf$objectives[[1]]$multiplier = -1 # mean > > MeanVar.portf$objectives[[2]]$multiplier = 1 # var > > MeanVar.ROI<-optimize.portfolio(R=R, > + portfolio=MeanVar.portf, > + optimize_method='ROI' > + ) > > summary(MeanVar.ROI) > ************************************************** > PortfolioAnalytics Optimization Summary > ************************************************** > > Call: > optimize.portfolio(R = R, portfolio = MeanVar.portf, optimize_method = > "ROI") > > Optimal Weights: > Convertible Arbitrage Equity Market Neutral Fixed Income Arbitrage > Event Driven CTA Global Global Macro > 0.0500 0.0500 0.0500 > 0.2134 0.0500 > 0.3000 > Long/Short Equity > 0.2866 > > Objective Measures: > mean > 0.007309 > > > StdDev > 0.01561 > > > > Portfolio Assets and Initial Weights: > Convertible Arbitrage Equity Market Neutral Fixed Income Arbitrage > Event Driven CTA Global Global Macro > 0.1428571 0.1428571 0.1428571 > 0.1428571 0.1428571 > 0.1428571 > Long/Short Equity > 0.1428571 > > ************************************************** > PortfolioAnalytics Portfolio Specification > ************************************************** > > Call: > portfolio.spec(assets = colnames(R)) > > Assets > Number of assets: 7 > > Asset Names > [1] "Convertible Arbitrage" "Equity Market Neutral" "Fixed Income > Arbitrage" "Event Driven" "CTA Global" > [6] "Global Macro" "Long/Short Equity" > > Constraints > Number of constraints: 3 > Number of enabled constraints: 3 > Enabled constraint types > - leverage > - box > - group > Number of disabled constraints: 0 > > Objectives > Number of objectives: 3 > Number of enabled objectives: 2 > Enabled objective names > - mean > - var > Number of disabled objectives: 1 > Disabled objective types > - ES > > **************************************** > Constraints > **************************************** > Leverage Constraint: > min_sum = 1 > max_sum = 1 > > Box Constraints: > min: > Convertible Arbitrage Equity Market Neutral Fixed Income Arbitrage > Event Driven CTA Global Global Macro > 0.05 0.05 0.05 > 0.05 0.05 > 0.05 > Long/Short Equity > 0.05 > max: > Convertible Arbitrage Equity Market Neutral Fixed Income Arbitrage > Event Driven CTA Global Global Macro > 0.3 0.3 0.3 > 0.3 0.3 > 0.3 > Long/Short Equity > 0.3 > > Group Constraints: > Groups: > $group1 > [1] 1 2 3 4 > > $group2 > [1] 5 6 7 > > > Lower bound on group weights, group_min: > group1 group2 > 0.10 0.05 > > Upper bound on group weights, group_max: > group1 group2 > 0.85 0.75 > > Group position limits, group_pos: > NULL > > Group Weights: > group1 group2 > 0.3633993 0.6366007 > > Position Limit Constraints: > Maximum number of non-zero weights, max_pos: > NULL > Realized number of non-zero weights (i.e. positions): > [1] 7 > > Maximum number of long positions, max_pos_long: > NULL > Realized number of long positions: > [1] 7 > > Maximum number of short positions, max_pos_short: > NULL > Realized number of short positions: > [1] 0 > > > Diversification Target Constraint: > NULL > > Realized diversification: > [1] 0.7723208 > > Turnover Target Constraint: > NULL > > Realized turnover from initial weights: > [1] 0.1061224 > > **************************************** > Objectives > **************************************** > > Objective: return_objective > $name > [1] "mean" > > $target > NULL > > $arguments > list() > > $enabled > [1] TRUE > > $multiplier > [1] -1 > > $call > add.objective(portfolio = init.portf, type = "return", name = "mean", > enabled = TRUE, multiplier = 0) > > attr(,"class") > [1] "return_objective" "objective" > > **************************************** > Objective: portfolio_risk_objective > $name > [1] "var" > > $target > NULL > > $arguments > $arguments$portfolio_method > [1] "single" > > > $enabled > [1] TRUE > > $multiplier > [1] 1 > > $call > add.objective(portfolio = init.portf, type = "risk", name = "var", > enabled = TRUE, multiplier = 0) > > attr(,"class") > [1] "portfolio_risk_objective" "objective" > > **************************************** > Objective: portfolio_risk_objective > $name > [1] "ES" > > $target > NULL > > $arguments > $arguments$p > [1] 0.9166667 > > $arguments$portfolio_method > [1] "single" > > > $enabled > [1] FALSE > > $multiplier > [1] 0 > > $call > add.objective(portfolio = init.portf, type = "risk", name = "ES", > arguments = list(p = p), enabled = FALSE, multiplier = 0) > > attr(,"class") > [1] "portfolio_risk_objective" "objective" > > **************************************** > > Elapsed Time: > Time difference of 0.5688059 secs > > > plot(MeanVar.ROI) > Error in apply(R, 2, "mean") : dim(X) must have a positive length > > traceback() > 10: stop("dim(X) must have a positive length") > 9: apply(R, 2, "mean") > 8: as.vector(apply(R, 2, "mean")) > 7: matrix(as.vector(apply(R, 2, "mean")), ncol = 1) > 6: moments(R) > 5: applyFUN(R = R, weights = rp, FUN = return.col, ... = ...) > 4: chart.Scatter.ROI(object = ROI, rp = rp, return.col = return.col, > risk.col = risk.col, ..., chart.assets = chart.assets, > element.color = element.color, > cex.axis = cex.axis, main = main, xlim = xlim, ylim = ylim) > 3: charts.ROI(ROI = x, rp = rp, risk.col = risk.col, return.col = > return.col, > chart.assets = chart.assets, main = main, xlim = xlim, ylim = ylim, > ...) > 2: plot.optimize.portfolio.ROI(MeanVar.ROI) > 1: plot(MeanVar.ROI) > > pcc > -- > Peter Carl > http://www.braverock.com/peter > > > _______________________________________________ > GSoC-PortA mailing list > GSoC-PortA at lists.r-forge.r-project.org > http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rossbennett34 at gmail.com Wed Sep 18 07:46:45 2013 From: rossbennett34 at gmail.com (Ross Bennett) Date: Tue, 17 Sep 2013 22:46:45 -0700 Subject: [GSoC-PortA] R CMD check info` In-Reply-To: References: Message-ID: Brian, See updated log file attached. Only 1 warning for checking package vignettes in ?inst/doc?, but there is no inst folder. Ross On Tue, Sep 17, 2013 at 12:29 PM, Brian G. Peterson wrote: > Ross, > > We should chase all warnings. I'll take a look at the log. > > It looks like R-Forge just fixed their email listserv... > > Regards, > > Brian > > Ross Bennett wrote: >> >> Brian and others, >> >> I ran R CMD check and I only get 3 warnings and 3 notes. The log file is >> attached. >> >> Under the "checking R code for possible problems", there are several >> lines with something like "no visible binding for global variable >> 'strategy' ". Is this something that should be addressed? If so, what is >> the best way to correct this? >> >> On a side note, I have made multiple commits over the last two days, but >> have not received any [Returnanalytics-commits] emails from r-forge. The >> last email I received was for commit r3107 and my latest commit is >> r3125.Have any of you received the commit emails recently? >> >> Thanks, >> Ross >> >> ------------------------------ >> >> GSoC-PortA mailing list >> GSoC-PortA at lists.r-forge.r-project.org >> http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta >> >> > -- > Sent from my Android phone with K-9 Mail. Please excuse my brevity. > > _______________________________________________ > GSoC-PortA mailing list > GSoC-PortA at lists.r-forge.r-project.org > http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 00check.log Type: application/octet-stream Size: 5473 bytes Desc: not available URL: From brian at braverock.com Wed Sep 18 16:54:33 2013 From: brian at braverock.com (Brian G. Peterson) Date: Wed, 18 Sep 2013 09:54:33 -0500 Subject: [GSoC-PortA] error in demo_efficient_frontier Message-ID: <5239BEA9.5010909@braverock.com> I see: > # mean-var efficient frontier > meanvar.ef <- create.EfficientFrontier(R=R, portfolio=meanvar.portf, type="mean-StdDev") Error in (dir == "<=") | (dir = q = "<") : operations are possible only for numeric, logical or complex types > traceback() 13: which((dir == "<=") | (dir = q = "<")) 12: .quadprog_solve_QP(Q = terms(objective(x))$Q, L = terms(objective(x))$L, mat = constraints(x)$L, dir = constraints(x)$dir, rhs = constraints(x)$rhs, max = x$maximum) 11: SOLVE(x, control) 10: ROI_solve(x = opt.prob, solver = "quadprog") 9: gmv_opt(R = R, constraints = constraints, moments = moments, lambda = lambda, target = target, lambda_hhi = lambda_hhi, conc_groups = conc_groups) 8: optimize.portfolio(R = R, portfolio = portfolio, optimize_method = "ROI") 7: meanvar.efficient.frontier(portfolio = portfolio, R = R, n.portfolios = n.portfolios, risk_aversion = risk_aversion) 6: create.EfficientFrontier(R = R, portfolio = meanvar.portf, type = "mean-StdDev") at demo_efficient_frontier.R#42 5: eval(expr, envir, enclos) 4: eval(ei, envir) 3: withVisible(eval(ei, envir)) 2: source(available, echo = echo, max.deparse.length = Inf, keep.source = TRUE, encoding = encoding) 1: demo("demo_efficient_frontier", ask = FALSE) I'm pretty sure this is current code. Thoughts? -- Brian G. Peterson http://braverock.com/brian/ Ph: 773-459-4973 IM: bgpbraverock From rossbennett34 at gmail.com Wed Sep 18 17:07:24 2013 From: rossbennett34 at gmail.com (Ross Bennett) Date: Wed, 18 Sep 2013 08:07:24 -0700 Subject: [GSoC-PortA] error in demo_efficient_frontier In-Reply-To: <5239BEA9.5010909@braverock.com> References: <5239BEA9.5010909@braverock.com> Message-ID: Brian, That is an error with ROI. The ROI.plugin.quadprog version on CRAN is broken, the version on R-forge works correctly. Ross On Wed, Sep 18, 2013 at 7:54 AM, Brian G. Peterson wrote: > I see: > > > # mean-var efficient frontier > > meanvar.ef <- create.EfficientFrontier(R=R, portfolio=meanvar.portf, > type="mean-StdDev") > Error in (dir == "<=") | (dir = q = "<") : > operations are possible only for numeric, logical or complex types > > traceback() > 13: which((dir == "<=") | (dir = q = "<")) > 12: .quadprog_solve_QP(Q = terms(objective(x))$Q, L = > terms(objective(x))$L, > mat = constraints(x)$L, dir = constraints(x)$dir, rhs = > constraints(x)$rhs, > max = x$maximum) > 11: SOLVE(x, control) > 10: ROI_solve(x = opt.prob, solver = "quadprog") > 9: gmv_opt(R = R, constraints = constraints, moments = moments, > lambda = lambda, target = target, lambda_hhi = lambda_hhi, > conc_groups = conc_groups) > 8: optimize.portfolio(R = R, portfolio = portfolio, optimize_method = > "ROI") > 7: meanvar.efficient.frontier(**portfolio = portfolio, R = R, > n.portfolios = n.portfolios, > risk_aversion = risk_aversion) > 6: create.EfficientFrontier(R = R, portfolio = meanvar.portf, type = > "mean-StdDev") at demo_efficient_frontier.R#42 > 5: eval(expr, envir, enclos) > 4: eval(ei, envir) > 3: withVisible(eval(ei, envir)) > 2: source(available, echo = echo, max.deparse.length = Inf, keep.source = > TRUE, > encoding = encoding) > 1: demo("demo_efficient_frontier"**, ask = FALSE) > > I'm pretty sure this is current code. > > Thoughts? > > -- > Brian G. Peterson > http://braverock.com/brian/ > Ph: 773-459-4973 > IM: bgpbraverock > ______________________________**_________________ > GSoC-PortA mailing list > GSoC-PortA at lists.r-forge.r-**project.org > http://lists.r-forge.r-**project.org/cgi-bin/mailman/**listinfo/gsoc-porta > -------------- next part -------------- An HTML attachment was scrubbed... URL: From martinrd at comcast.net Wed Sep 18 18:01:37 2013 From: martinrd at comcast.net (Doug Martin) Date: Wed, 18 Sep 2013 09:01:37 -0700 Subject: [GSoC-PortA] error in demo_efficient_frontier In-Reply-To: References: <5239BEA9.5010909@braverock.com> Message-ID: <002a01ceb488$64b46920$2e1d3b60$@comcast.net> Brian, Do I recall correctly that this is an old problem from last year that Theussel, etc., was informed about but never fixed? Doug From: gsoc-porta-bounces at lists.r-forge.r-project.org [mailto:gsoc-porta-bounces at lists.r-forge.r-project.org] On Behalf Of Ross Bennett Sent: Wednesday, September 18, 2013 8:07 AM To: PortfolioAnalytics Subject: Re: [GSoC-PortA] error in demo_efficient_frontier Brian, That is an error with ROI. The ROI.plugin.quadprog version on CRAN is broken, the version on R-forge works correctly. Ross On Wed, Sep 18, 2013 at 7:54 AM, Brian G. Peterson wrote: I see: > # mean-var efficient frontier > meanvar.ef <- create.EfficientFrontier(R=R, portfolio=meanvar.portf, type="mean-StdDev") Error in (dir == "<=") | (dir = q = "<") : operations are possible only for numeric, logical or complex types > traceback() 13: which((dir == "<=") | (dir = q = "<")) 12: .quadprog_solve_QP(Q = terms(objective(x))$Q, L = terms(objective(x))$L, mat = constraints(x)$L, dir = constraints(x)$dir, rhs = constraints(x)$rhs, max = x$maximum) 11: SOLVE(x, control) 10: ROI_solve(x = opt.prob, solver = "quadprog") 9: gmv_opt(R = R, constraints = constraints, moments = moments, lambda = lambda, target = target, lambda_hhi = lambda_hhi, conc_groups = conc_groups) 8: optimize.portfolio(R = R, portfolio = portfolio, optimize_method = "ROI") 7: meanvar.efficient.frontier(portfolio = portfolio, R = R, n.portfolios = n.portfolios, risk_aversion = risk_aversion) 6: create.EfficientFrontier(R = R, portfolio = meanvar.portf, type = "mean-StdDev") at demo_efficient_frontier.R#42 5: eval(expr, envir, enclos) 4: eval(ei, envir) 3: withVisible(eval(ei, envir)) 2: source(available, echo = echo, max.deparse.length = Inf, keep.source = TRUE, encoding = encoding) 1: demo("demo_efficient_frontier", ask = FALSE) I'm pretty sure this is current code. Thoughts? -- Brian G. Peterson http://braverock.com/brian/ Ph: 773-459-4973 IM: bgpbraverock _______________________________________________ GSoC-PortA mailing list GSoC-PortA at lists.r-forge.r-project.org http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta -------------- next part -------------- An HTML attachment was scrubbed... URL: From brian at braverock.com Wed Sep 18 18:34:50 2013 From: brian at braverock.com (Brian G. Peterson) Date: Wed, 18 Sep 2013 11:34:50 -0500 Subject: [GSoC-PortA] error in demo_efficient_frontier In-Reply-To: <002a01ceb488$64b46920$2e1d3b60$@comcast.net> References: <5239BEA9.5010909@braverock.com> <002a01ceb488$64b46920$2e1d3b60$@comcast.net> Message-ID: <5239D62A.5010305@braverock.com> Thanks Ross. Fixed but not pushed to CRAN. I'll open the conversation with Stefan and Kurt about pushing an updated version to CRAN. On 09/18/2013 11:01 AM, Doug Martin wrote: > Do I recall correctly that this is an old problem from last year that > Theussel, etc., was informed about but never fixed? > > Doug > > *From:*gsoc-porta-bounces at lists.r-forge.r-project.org > [mailto:gsoc-porta-bounces at lists.r-forge.r-project.org] *On Behalf Of > *Ross Bennett > *Sent:* Wednesday, September 18, 2013 8:07 AM > *To:* PortfolioAnalytics > *Subject:* Re: [GSoC-PortA] error in demo_efficient_frontier > > Brian, > > That is an error with ROI. The ROI.plugin.quadprog version on CRAN is > broken, the version on R-forge works correctly. > -- Brian G. Peterson http://braverock.com/brian/ Ph: 773-459-4973 IM: bgpbraverock From martinrd at comcast.net Wed Sep 18 18:51:24 2013 From: martinrd at comcast.net (Doug Martin) Date: Wed, 18 Sep 2013 09:51:24 -0700 Subject: [GSoC-PortA] error in demo_efficient_frontier In-Reply-To: <5239D62A.5010305@braverock.com> References: <5239BEA9.5010909@braverock.com> <002a01ceb488$64b46920$2e1d3b60$@comcast.net> <5239D62A.5010305@braverock.com> Message-ID: <005301ceb48f$58d15580$0a740080$@comcast.net> Just a reminder that I will be in Vienna in late October and Bernd is going to arrange a meeting time with Kurt. Doug -----Original Message----- From: gsoc-porta-bounces at lists.r-forge.r-project.org [mailto:gsoc-porta-bounces at lists.r-forge.r-project.org] On Behalf Of Brian G. Peterson Sent: Wednesday, September 18, 2013 9:35 AM To: gsoc-porta at r-forge.wu-wien.ac.at Subject: Re: [GSoC-PortA] error in demo_efficient_frontier Thanks Ross. Fixed but not pushed to CRAN. I'll open the conversation with Stefan and Kurt about pushing an updated version to CRAN. On 09/18/2013 11:01 AM, Doug Martin wrote: > Do I recall correctly that this is an old problem from last year that > Theussel, etc., was informed about but never fixed? > > Doug > > *From:*gsoc-porta-bounces at lists.r-forge.r-project.org > [mailto:gsoc-porta-bounces at lists.r-forge.r-project.org] *On Behalf Of > *Ross Bennett > *Sent:* Wednesday, September 18, 2013 8:07 AM > *To:* PortfolioAnalytics > *Subject:* Re: [GSoC-PortA] error in demo_efficient_frontier > > Brian, > > That is an error with ROI. The ROI.plugin.quadprog version on CRAN is > broken, the version on R-forge works correctly. > -- Brian G. Peterson http://braverock.com/brian/ Ph: 773-459-4973 IM: bgpbraverock _______________________________________________ GSoC-PortA mailing list GSoC-PortA at lists.r-forge.r-project.org http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta From brian at braverock.com Wed Sep 18 21:16:53 2013 From: brian at braverock.com (Brian G. Peterson) Date: Wed, 18 Sep 2013 14:16:53 -0500 Subject: [GSoC-PortA] error in demo_efficient_frontier In-Reply-To: References: <5239BEA9.5010909@braverock.com> Message-ID: <5239FC25.6040502@braverock.com> On 09/18/2013 10:07 AM, Ross Bennett wrote: > That is an error with ROI. The ROI.plugin.quadprog version on CRAN is > broken, the version on R-forge works correctly. > That was it, thanks. I'm not sure why I had the CRAN version of that one on this machine... We should update the Suggests to have the correct version of ROI.plugin.quadprog, so that the user will get a warning at install time or a failure at check time. Regards, -- Brian G. Peterson http://braverock.com/brian/ Ph: 773-459-4973 IM: bgpbraverock From rossbennett34 at gmail.com Wed Sep 18 23:05:40 2013 From: rossbennett34 at gmail.com (Ross Bennett) Date: Wed, 18 Sep 2013 14:05:40 -0700 Subject: [GSoC-PortA] error in demo_efficient_frontier In-Reply-To: <5239FC25.6040502@braverock.com> References: <5239BEA9.5010909@braverock.com> <5239FC25.6040502@braverock.com> Message-ID: Got it. I just made a commit to update the suggests for ROI.plugin.quadprog. The CRAN versions of ROI and ROI.plugin.glpk are working correctly with the package. Thanks, Ross On Wed, Sep 18, 2013 at 12:16 PM, Brian G. Peterson wrote: > On 09/18/2013 10:07 AM, Ross Bennett wrote: > >> That is an error with ROI. The ROI.plugin.quadprog version on CRAN is >> broken, the version on R-forge works correctly. >> >> > That was it, thanks. I'm not sure why I had the CRAN version of that one > on this machine... > > We should update the Suggests to have the correct version of > ROI.plugin.quadprog, so that the user will get a warning at install time or > a failure at check time. > > Regards, > > -- > Brian G. Peterson > http://braverock.com/brian/ > Ph: 773-459-4973 > IM: bgpbraverock > ______________________________**_________________ > GSoC-PortA mailing list > GSoC-PortA at lists.r-forge.r-**project.org > http://lists.r-forge.r-**project.org/cgi-bin/mailman/**listinfo/gsoc-porta > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rossbennett34 at gmail.com Wed Sep 18 23:38:30 2013 From: rossbennett34 at gmail.com (Ross Bennett) Date: Wed, 18 Sep 2013 14:38:30 -0700 Subject: [GSoC-PortA] Portfolio Vignette Message-ID: All, In commit r3130, I added a lot of content and charts to the portfolio_vignette. I'm still working on the placement and formatting of some of the charts, but overall I think this is a pretty good introduction to specify the portfolio object, add constraints and objectives, and run a few example optimizations. If anyone has a chance to read through it, I would appreciate any and all feedback about existing content or any content that should be added. The compiled pdf is in the vignettes folder as portfolio_vignette.pdf. Thanks, Ross -------------- next part -------------- An HTML attachment was scrubbed... URL: From brian at braverock.com Thu Sep 19 11:20:21 2013 From: brian at braverock.com (Brian G. Peterson) Date: Thu, 19 Sep 2013 04:20:21 -0500 Subject: [GSoC-PortA] Portfolio Vignette In-Reply-To: References: Message-ID: <523AC1D5.1000208@braverock.com> On 09/18/2013 04:38 PM, Ross Bennett wrote: > All, > > In commit r3130, I added a lot of content and charts to the > portfolio_vignette. I'm still working on the placement and formatting of > some of the charts, but overall I think this is a pretty good > introduction to specify the portfolio object, add constraints and > objectives, and run a few example optimizations. > > If anyone has a chance to read through it, I would appreciate any and > all feedback about existing content or any content that should be added. > > The compiled pdf is in the vignettes folder as portfolio_vignette.pdf. Ross, Thanks for doing this, it's looking very good. I'm impressed by the comparison of the different random portfolio methods. It's pretty clear that at fev=0.05 the simplex method will concentrate more towards the individual assets while the sample method will get a more even distribution in the interior and near the edges. It's key to note that depending on your objective, you may very well not have an optimal solution along the vertexes. For example, risk contribution or risk budget objectives will likely place the optimal portfolio somewhere in the interior. The min-ERC portfolio lies along a line between the minimum variance portfolio and the EW portfolio. I wonder why you're using all the page space you are to separate the weights plot from the scatter plot. Maybe once to demonstrate that they are separate functions, but it seems that when you want to display both right next to each other, just calling plot() on the output of optimize.portfolio would be s more efficient use of space. e.g. Fig 4/5, 6/7, 8/9, 10/11, 12/13, 15/16 etc. I also wonder if most of section 5.2 could be separated into a separate vignette specifically discussing the different methods of doing random portfolios, the algorithms themselves, and more completely describing the differences, but that can always happen after GSoC. -- Brian G. Peterson http://braverock.com/brian/ Ph: 773-459-4973 IM: bgpbraverock From peter at braverock.com Thu Sep 19 15:58:57 2013 From: peter at braverock.com (=?utf-8?B?UGV0ZXIgQ2FybA==?=) Date: Thu, 19 Sep 2013 08:58:57 -0500 Subject: [GSoC-PortA] =?utf-8?q?Portfolio_Vignette?= Message-ID: <201309191358.r8JDwflh006753@ethos.braverock.com> Ross, this looks fantastic. I'll follow up with some thoughts, but I think this is very impressive overall. You've had a great summer! pcc Sent from my HTC Inspire? 4G on AT&T ----- Reply message ----- From: "Brian G. Peterson" To: "PortfolioAnalytics" Subject: [GSoC-PortA] Portfolio Vignette Date: Thu, Sep 19, 2013 4:20 am On 09/18/2013 04:38 PM, Ross Bennett wrote: > All, > > In commit r3130, I added a lot of content and charts to the > portfolio_vignette. I'm still working on the placement and formatting of > some of the charts, but overall I think this is a pretty good > introduction to specify the portfolio object, add constraints and > objectives, and run a few example optimizations. > > If anyone has a chance to read through it, I would appreciate any and > all feedback about existing content or any content that should be added. > > The compiled pdf is in the vignettes folder as portfolio_vignette.pdf. Ross, Thanks for doing this, it's looking very good. I'm impressed by the comparison of the different random portfolio methods. It's pretty clear that at fev=0.05 the simplex method will concentrate more towards the individual assets while the sample method will get a more even distribution in the interior and near the edges. It's key to note that depending on your objective, you may very well not have an optimal solution along the vertexes. For example, risk contribution or risk budget objectives will likely place the optimal portfolio somewhere in the interior. The min-ERC portfolio lies along a line between the minimum variance portfolio and the EW portfolio. I wonder why you're using all the page space you are to separate the weights plot from the scatter plot. Maybe once to demonstrate that they are separate functions, but it seems that when you want to display both right next to each other, just calling plot() on the output of optimize.portfolio would be s more efficient use of space. e.g. Fig 4/5, 6/7, 8/9, 10/11, 12/13, 15/16 etc. I also wonder if most of section 5.2 could be separated into a separate vignette specifically discussing the different methods of doing random portfolios, the algorithms themselves, and more completely describing the differences, but that can always happen after GSoC. -- Brian G. Peterson http://braverock.com/brian/ Ph: 773-459-4973 IM: bgpbraverock _______________________________________________ GSoC-PortA mailing list GSoC-PortA at lists.r-forge.r-project.org http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta -------------- next part -------------- An HTML attachment was scrubbed... URL: From rossbennett34 at gmail.com Thu Sep 19 17:43:06 2013 From: rossbennett34 at gmail.com (Ross Bennett) Date: Thu, 19 Sep 2013 08:43:06 -0700 Subject: [GSoC-PortA] Portfolio Vignette In-Reply-To: <523AC1D5.1000208@braverock.com> References: <523AC1D5.1000208@braverock.com> Message-ID: On Thu, Sep 19, 2013 at 2:20 AM, Brian G. Peterson wrote: > > > Ross, > > Thanks for doing this, it's looking very good. > > I'm impressed by the comparison of the different random portfolio methods. > It's pretty clear that at fev=0.05 the simplex method will concentrate > more towards the individual assets while the sample method will get a more > even distribution in the interior and near the edges. It's key to note that > depending on your objective, you may very well not have an optimal solution > along the vertexes. For example, risk contribution or risk budget > objectives will likely place the optimal portfolio somewhere in the > interior. The min-ERC portfolio lies along a line between the minimum > variance portfolio and the EW portfolio. > Agreed, I think it is very interesting to look at the feasible space with different values for the fev biasing. Good point about the portfolios with risk budget objectives being on the interior. I'll add that to the vignette. > > I wonder why you're using all the page space you are to separate the > weights plot from the scatter plot. Maybe once to demonstrate that they > are separate functions, but it seems that when you want to display both > right next to each other, just calling plot() on the output of > optimize.portfolio would be s more efficient use of space. e.g. Fig 4/5, > 6/7, 8/9, 10/11, 12/13, 15/16 etc. > I did it once to show that they can be plotted separately, but then got a little carried away with copy/paste. I'll edit and just use the plot function. > > I also wonder if most of section 5.2 could be separated into a separate > vignette specifically discussing the different methods of doing random > portfolios, the algorithms themselves, and more completely describing the > differences, but that can always happen after GSoC. This would be interesting to expand on the material in this section including some benchmarking, looking at different constraints, impact of handling constraints by elimination, etc. Thanks, Ross > > > > > > -- > Brian G. Peterson > http://braverock.com/brian/ > Ph: 773-459-4973 > IM: bgpbraverock > ______________________________**_________________ > GSoC-PortA mailing list > GSoC-PortA at lists.r-forge.r-**project.org > http://lists.r-forge.r-**project.org/cgi-bin/mailman/**listinfo/gsoc-porta > -------------- next part -------------- An HTML attachment was scrubbed... URL: From peter at braverock.com Mon Sep 23 01:41:35 2013 From: peter at braverock.com (Peter Carl) Date: Sun, 22 Sep 2013 18:41:35 -0500 Subject: [GSoC-PortA] Some feedback... Message-ID: <6077558330b1a022003470c2092bae1b.squirrel@mail.braverock.com> Ross, I've been working through your vignette to hopefully give you some more detailed feedback, including on your questions from a few days ago. Sorry this has taken so long, but I wanted to spend some focused time on the package. I realize that you've got different plot methods for each type, and I appreciate what a hassle it is to keep such methods relatively consistent. In chart.RiskReturn.DE, when the function doesn't find anything that fits its defaults: > plot(RiskBudget.DE) Error in plot.window(...) : need finite 'xlim' values In addition: Warning messages: 1: In chart.Scatter.DE(object = DE, risk.col = risk.col, return.col = return.col, : mean or ES do not match extractStats output of $objective_measures slot 2: In min(x) : no non-missing arguments to min; returning Inf 3: In max(x) : no non-missing arguments to max; returning -Inf It's a risk budget on ETL, so if I tell it that, it works: > plot(RiskBudget.DE, risk.col="ETL", return.col="mean") ...but it doesn't recover well when I try to plot the results in variance space: > plot(RiskBudget.DE, risk.col="StdDev", return.col="mean") Error in plot.window(...) : need finite 'xlim' values In addition: Warning messages: 1: In chart.Scatter.DE(object = DE, risk.col = risk.col, return.col = return.col, : mean or StdDev do not match extractStats output of $objective_measures slot 2: In min(x) : no non-missing arguments to min; returning Inf 3: In max(x) : no non-missing arguments to max; returning -Inf I'm not exactly sure what the issue is here, but maybe it's related: > chart.RiskBudget(RiskBudget.DE, risk.type="percentage", neighbors=5) Error in subsetx[i, riskcols] : incorrect number of dimensions > traceback() 3: points(subsetx[i, riskcols], type = "b", col = "lightblue") 2: chart.RiskBudget.optimize.portfolio(RiskBudget.DE, risk.type = "percentage", neighbors = 5) 1: chart.RiskBudget(RiskBudget.DE, risk.type = "percentage", neighbors = 5) In chart.RiskReturnScatter.RP, it looks like 'rp' is being passed into plot through dots. > plot(EqmETL.RND, risk.col="StdDev", return.col="mean", rp=1000, chart.assets=TRUE) There were 13 warnings (use warnings() to see them) > warnings() Warning messages: 1: "rp" is not a graphical parameter 2: "rp" is not a graphical parameter 3: "rp" is not a graphical parameter > extractWeights(buoys) Convertible Arbitrage Equity Market Neutral Fixed Income Arbitrage Event Driven CTA Global Global Macro Long/Short Equity MeanSD 0.05000000 0.050 0.050 0.30000000 0.0500000 0.2000000 0.300 MeanmETL 0.05000000 0.300 0.050 0.05000000 0.2000000 0.3000000 0.050 MinSD 0.06042904 0.300 0.300 0.05234676 0.1735858 0.0636384 0.050 MinmETL 0.05000000 0.300 0.050 0.05000000 0.2000000 0.3000000 0.050 EqSD 0.12500000 0.240 0.200 0.08500000 0.1050000 0.1700000 0.075 EqmETL 0.06000000 0.265 0.165 0.09000000 0.2050000 0.1300000 0.080 RB 0.05200000 0.410 0.060 0.05200000 0.1438995 0.2220000 0.058 ...but this doesn't: > extractObjectiveMeasures(buoys) mean StdDev ES StdDev.contribution1 StdDev.contribution2 StdDev.contribution3 StdDev.contribution4 MeanSD 0.006782814 0.01546759 NA NA NA NA NA MeanmETL 0.005897789 NA 0.01505626 NA NA NA NA MinSD NA 0.01009001 NA NA NA NA NA MinmETL NA NA 0.01505626 NA NA NA NA EqSD NA 0.01113716 NA 0.001763096 0.001565752 0.001886988 0.001258567 EqmETL NA NA 0.01646509 NA NA NA NA RB 0.005812997 NA NA NA NA NA NA StdDev.contribution5 StdDev.contribution6 StdDev.contribution7 StdDev.pct_contrib_StdDev1 StdDev.pct_contrib_StdDev2 MeanSD NA NA NA NA NA MeanmETL NA NA NA NA NA MinSD NA NA NA NA NA MinmETL NA NA NA NA NA EqSD 0.001039908 0.002296903 0.001325947 0.1583075 0.1405881 EqmETL NA NA NA NA NA RB NA NA NA NA NA ...snip... As a consequence, only one portfolio appears in the following plot (MeanSD): > chart.RiskReward(buoys) All in all, this is all looking good. I've got some scripts checked in under sandbox/symposium2013 if you want to follow along. pcc -- Peter Carl http://www.braverock.com/peter From peter at braverock.com Mon Sep 23 01:46:21 2013 From: peter at braverock.com (Peter Carl) Date: Sun, 22 Sep 2013 18:46:21 -0500 Subject: [GSoC-PortA] Some feedback... In-Reply-To: <6077558330b1a022003470c2092bae1b.squirrel@mail.braverock.com> References: <6077558330b1a022003470c2092bae1b.squirrel@mail.braverock.com> Message-ID: Sorry, prior to the > extractWeights(buoys) line below, I should have said that combining the portfolios isn't quite going smoothly yet. I can get the weights out fine... (as shown) ...but not the objective measures (as shown). pcc -- Peter Carl http://www.braverock.com/peter > Ross, > > I've been working through your vignette to hopefully give you some more > detailed feedback, including on your questions from a few days ago. Sorry > this has taken so long, but I wanted to spend some focused time on the > package. > > I realize that you've got different plot methods for each type, and I > appreciate what a hassle it is to keep such methods relatively consistent. > In chart.RiskReturn.DE, when the function doesn't find anything that fits > its defaults: >> plot(RiskBudget.DE) > Error in plot.window(...) : need finite 'xlim' values > In addition: Warning messages: > 1: In chart.Scatter.DE(object = DE, risk.col = risk.col, return.col = > return.col, : > mean or ES do not match extractStats output of $objective_measures slot > 2: In min(x) : no non-missing arguments to min; returning Inf > 3: In max(x) : no non-missing arguments to max; returning -Inf > > It's a risk budget on ETL, so if I tell it that, it works: >> plot(RiskBudget.DE, risk.col="ETL", return.col="mean") > > ...but it doesn't recover well when I try to plot the results in variance > space: >> plot(RiskBudget.DE, risk.col="StdDev", return.col="mean") > Error in plot.window(...) : need finite 'xlim' values > In addition: Warning messages: > 1: In chart.Scatter.DE(object = DE, risk.col = risk.col, return.col = > return.col, : > mean or StdDev do not match extractStats output of $objective_measures > slot > 2: In min(x) : no non-missing arguments to min; returning Inf > 3: In max(x) : no non-missing arguments to max; returning -Inf > > > I'm not exactly sure what the issue is here, but maybe it's related: >> chart.RiskBudget(RiskBudget.DE, risk.type="percentage", neighbors=5) > Error in subsetx[i, riskcols] : incorrect number of dimensions >> traceback() > 3: points(subsetx[i, riskcols], type = "b", col = "lightblue") > 2: chart.RiskBudget.optimize.portfolio(RiskBudget.DE, risk.type = > "percentage", > neighbors = 5) > 1: chart.RiskBudget(RiskBudget.DE, risk.type = "percentage", neighbors = > 5) > > In chart.RiskReturnScatter.RP, it looks like 'rp' is being passed into > plot through dots. >> plot(EqmETL.RND, risk.col="StdDev", return.col="mean", rp=1000, > chart.assets=TRUE) > There were 13 warnings (use warnings() to see them) >> warnings() > Warning messages: > 1: "rp" is not a graphical parameter > 2: "rp" is not a graphical parameter > 3: "rp" is not a graphical parameter > > >> extractWeights(buoys) > Convertible Arbitrage Equity Market Neutral Fixed Income > Arbitrage Event Driven CTA Global Global Macro Long/Short Equity > MeanSD 0.05000000 0.050 > 0.050 0.30000000 0.0500000 0.2000000 0.300 > MeanmETL 0.05000000 0.300 > 0.050 0.05000000 0.2000000 0.3000000 0.050 > MinSD 0.06042904 0.300 > 0.300 0.05234676 0.1735858 0.0636384 0.050 > MinmETL 0.05000000 0.300 > 0.050 0.05000000 0.2000000 0.3000000 0.050 > EqSD 0.12500000 0.240 > 0.200 0.08500000 0.1050000 0.1700000 0.075 > EqmETL 0.06000000 0.265 > 0.165 0.09000000 0.2050000 0.1300000 0.080 > RB 0.05200000 0.410 > 0.060 0.05200000 0.1438995 0.2220000 0.058 > > ...but this doesn't: >> extractObjectiveMeasures(buoys) > mean StdDev ES StdDev.contribution1 > StdDev.contribution2 StdDev.contribution3 > StdDev.contribution4 > MeanSD 0.006782814 0.01546759 NA NA > NA NA NA > MeanmETL 0.005897789 NA 0.01505626 NA > NA NA NA > MinSD NA 0.01009001 NA NA > NA NA NA > MinmETL NA NA 0.01505626 NA > NA NA NA > EqSD NA 0.01113716 NA 0.001763096 > 0.001565752 0.001886988 0.001258567 > EqmETL NA NA 0.01646509 NA > NA NA NA > RB 0.005812997 NA NA NA > NA NA NA > StdDev.contribution5 StdDev.contribution6 StdDev.contribution7 > StdDev.pct_contrib_StdDev1 StdDev.pct_contrib_StdDev2 > MeanSD NA NA NA > NA NA > MeanmETL NA NA NA > NA NA > MinSD NA NA NA > NA NA > MinmETL NA NA NA > NA NA > EqSD 0.001039908 0.002296903 0.001325947 > 0.1583075 0.1405881 > EqmETL NA NA NA > NA NA > RB NA NA NA > NA NA > ...snip... > > As a consequence, only one portfolio appears in the following plot > (MeanSD): >> chart.RiskReward(buoys) > > All in all, this is all looking good. I've got some scripts checked in > under sandbox/symposium2013 if you want to follow along. > > pcc > -- > Peter Carl > http://www.braverock.com/peter > > > _______________________________________________ > GSoC-PortA mailing list > GSoC-PortA at lists.r-forge.r-project.org > http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta > From rossbennett34 at gmail.com Mon Sep 23 03:16:12 2013 From: rossbennett34 at gmail.com (Ross Bennett) Date: Sun, 22 Sep 2013 18:16:12 -0700 Subject: [GSoC-PortA] Some feedback... In-Reply-To: <6077558330b1a022003470c2092bae1b.squirrel@mail.braverock.com> References: <6077558330b1a022003470c2092bae1b.squirrel@mail.braverock.com> Message-ID: Peter, Thanks for the feedback, I really appreciate it. see comments in line. On Sun, Sep 22, 2013 at 4:41 PM, Peter Carl wrote: > Ross, > > I've been working through your vignette to hopefully give you some more > detailed feedback, including on your questions from a few days ago. Sorry > this has taken so long, but I wanted to spend some focused time on the > package. > > I realize that you've got different plot methods for each type, and I > appreciate what a hassle it is to keep such methods relatively consistent. > In chart.RiskReturn.DE, when the function doesn't find anything that fits > its defaults: > > plot(RiskBudget.DE) > Error in plot.window(...) : need finite 'xlim' values > In addition: Warning messages: > 1: In chart.Scatter.DE(object = DE, risk.col = risk.col, return.col = > return.col, : > mean or ES do not match extractStats output of $objective_measures slot > 2: In min(x) : no non-missing arguments to min; returning Inf > 3: In max(x) : no non-missing arguments to max; returning -Inf > > It's a risk budget on ETL, so if I tell it that, it works: > > plot(RiskBudget.DE, risk.col="ETL", return.col="mean") > The default is risk.col="ES". Because your objective name is "ETL", you need to explicitly do risk.col="ETL". > > ...but it doesn't recover well when I try to plot the results in variance > space: > > plot(RiskBudget.DE, risk.col="StdDev", return.col="mean") > Error in plot.window(...) : need finite 'xlim' values > In addition: Warning messages: > 1: In chart.Scatter.DE(object = DE, risk.col = risk.col, return.col = > return.col, : > mean or StdDev do not match extractStats output of $objective_measures > slot > 2: In min(x) : no non-missing arguments to min; returning Inf > 3: In max(x) : no non-missing arguments to max; returning -Inf > > > I'm not exactly sure what the issue is here, but maybe it's related: > > chart.RiskBudget(RiskBudget.DE, risk.type="percentage", neighbors=5) > Error in subsetx[i, riskcols] : incorrect number of dimensions > > traceback() > 3: points(subsetx[i, riskcols], type = "b", col = "lightblue") > 2: chart.RiskBudget.optimize.portfolio(RiskBudget.DE, risk.type = > "percentage", > neighbors = 5) > 1: chart.RiskBudget(RiskBudget.DE, risk.type = "percentage", neighbors = 5) > Not sure either what the issue is, but I'll take a look. > In chart.RiskReturnScatter.RP, it looks like 'rp' is being passed into > plot through dots. > > plot(EqmETL.RND, risk.col="StdDev", return.col="mean", rp=1000, > chart.assets=TRUE) > There were 13 warnings (use warnings() to see them) > > warnings() > Warning messages: > 1: "rp" is not a graphical parameter > 2: "rp" is not a graphical parameter > 3: "rp" is not a graphical parameter > The 'rp' argument is meant for optimize.portfolio.ROI and optimize.portfolio.GenSA objects. Since ROI and GenSA do not return trace information like DEoptim or random portfolios, I added this as an option to generate random portfolios to plot the feasible space. If you are already passing in an optimize.portfolio.random object, there is no need to pass in rp as an argument. > > > > extractWeights(buoys) > Convertible Arbitrage Equity Market Neutral Fixed Income > Arbitrage Event Driven CTA Global Global Macro Long/Short Equity > MeanSD 0.05000000 0.050 > 0.050 0.30000000 0.0500000 0.2000000 0.300 > MeanmETL 0.05000000 0.300 > 0.050 0.05000000 0.2000000 0.3000000 0.050 > MinSD 0.06042904 0.300 > 0.300 0.05234676 0.1735858 0.0636384 0.050 > MinmETL 0.05000000 0.300 > 0.050 0.05000000 0.2000000 0.3000000 0.050 > EqSD 0.12500000 0.240 > 0.200 0.08500000 0.1050000 0.1700000 0.075 > EqmETL 0.06000000 0.265 > 0.165 0.09000000 0.2050000 0.1300000 0.080 > RB 0.05200000 0.410 > 0.060 0.05200000 0.1438995 0.2220000 0.058 > > ...but this doesn't: > > extractObjectiveMeasures(buoys) > mean StdDev ES StdDev.contribution1 > StdDev.contribution2 StdDev.contribution3 > StdDev.contribution4 > MeanSD 0.006782814 0.01546759 NA NA > NA NA NA > MeanmETL 0.005897789 NA 0.01505626 NA > NA NA NA > MinSD NA 0.01009001 NA NA > NA NA NA > MinmETL NA NA 0.01505626 NA > NA NA NA > EqSD NA 0.01113716 NA 0.001763096 > 0.001565752 0.001886988 0.001258567 > EqmETL NA NA 0.01646509 NA > NA NA NA > RB 0.005812997 NA NA NA > NA NA NA > StdDev.contribution5 StdDev.contribution6 StdDev.contribution7 > StdDev.pct_contrib_StdDev1 StdDev.pct_contrib_StdDev2 > MeanSD NA NA NA > NA NA > MeanmETL NA NA NA > NA NA > MinSD NA NA NA > NA NA > MinmETL NA NA NA > NA NA > EqSD 0.001039908 0.002296903 0.001325947 > 0.1583075 0.1405881 > EqmETL NA NA NA > NA NA > RB NA NA NA > NA NA > ...snip... > > It is tough to tell with the formatting on the email, but I'll take a closer look at the script in the sandbox to see if I can tell what is going on. The idea is that extractObjectiveMeasures will return a matrix of the objective measures for all optimize.portfolio objects in the opt.list object. For example, the meanSD row should have NAs under the ETL and ETL component contribution columns. I am only stitching together the objective measures, I do not re-calculate StdDev or component StdDev for the portfolios with ETL as an objective. Basically, I just take whatever objectives are in the $objective_measures slot of each optimize.portfolio object. Should I be doing something such that all cells in the matrix have values? > As a consequence, only one portfolio appears in the following plot > (MeanSD): > > chart.RiskReward(buoys) > This relates to my comment above about how I am not recalculating anything. Before the portfolios are plotted in risk-return space, I omit rows that have NA values. For example, if you wanted to plot all the portfolios in mean-ETL space, all portfolios should have mean and ETL as an objective. You could set the multiplier to 0 so it does not affect the optimization, but is returned in the $objective_measures slot. > > All in all, this is all looking good. I've got some scripts checked in > under sandbox/symposium2013 if you want to follow along. > I'll take a closer look and follow along, thanks! > > pcc > -- > Peter Carl > http://www.braverock.com/peter > > > _______________________________________________ > GSoC-PortA mailing list > GSoC-PortA at lists.r-forge.r-project.org > http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta > -------------- next part -------------- An HTML attachment was scrubbed... URL: From peter at braverock.com Mon Sep 23 04:18:56 2013 From: peter at braverock.com (Peter Carl) Date: Sun, 22 Sep 2013 21:18:56 -0500 Subject: [GSoC-PortA] RP issue? Message-ID: <3c8573bd96cbcd6186f9060240b05a7d.squirrel@mail.braverock.com> Ok, I'm now up to revision 3170. ### Construct BUOY 5: Constrained Equal Variance Contribution Portfolio - using RP EqSD.portf <- add.objective(portfolio=init.portf, type="risk_budget", name="StdDev", enabled=TRUE, min_concentration=TRUE, arguments = list(p=(1-1/12), clean=clean) ) # Without a sub-objective, we get a somewhat undefined result, since there are (potentially) many Equal SD contribution portfolios. EqSD.portf <- add.objective(portfolio=EqSD.portf, type="risk", name="StdDev" ) EqSD.portf$constraints[[1]]$min_sum = 0.99 # set to speed up RP EqSD.portf$constraints[[1]]$max_sum = 1.01 Now I'm evaluating it: > EqSD.RND<-optimize.portfolio(R=R, + portfolio=EqSD.portf, + optimize_method='random', + search_size=1000, trace=TRUE + ) Warning message: In constrained_objective(w = min_objective_weights, R = R, portfolio = portfolio, : some arguments stored for StdDev do not match I'm not sure why I'd get that warning... or maybe I'm not understanding the meaning of the message. > plot(EqSD.RND, risk.col="StdDev", return.col="mean", rp=permutations, chart.assets=TRUE, main="Equal Volatility Contribution Portfolio") There were 13 warnings (use warnings() to see them) > warnings() Warning messages: 1: In chart.Scatter.RP(object = RP, risk.col = risk.col, ... : mean or StdDev do not match extractStats output of $objective_measures slot That's probably a repeat of the above message. Then this chart broke: > chart.RiskBudget(EqSD.RND) Error in contrib[[idx[ii]]] : attempt to select less than one element Thanks, pcc -- Peter Carl http://www.braverock.com/peter From rossbennett34 at gmail.com Mon Sep 23 08:37:20 2013 From: rossbennett34 at gmail.com (Ross Bennett) Date: Sun, 22 Sep 2013 23:37:20 -0700 Subject: [GSoC-PortA] RP issue? In-Reply-To: <3c8573bd96cbcd6186f9060240b05a7d.squirrel@mail.braverock.com> References: <3c8573bd96cbcd6186f9060240b05a7d.squirrel@mail.braverock.com> Message-ID: Peter, See comments in line On Sun, Sep 22, 2013 at 7:18 PM, Peter Carl wrote: > Ok, I'm now up to revision 3170. > > ### Construct BUOY 5: Constrained Equal Variance Contribution Portfolio - > using RP > EqSD.portf <- add.objective(portfolio=init.portf, > type="risk_budget", > name="StdDev", > enabled=TRUE, > min_concentration=TRUE, > arguments = list(p=(1-1/12), clean=clean) > ) > # Without a sub-objective, we get a somewhat undefined result, since there > are (potentially) many Equal SD contribution portfolios. > EqSD.portf <- add.objective(portfolio=EqSD.portf, > type="risk", > name="StdDev" > ) > EqSD.portf$constraints[[1]]$min_sum = 0.99 # set to speed up RP > EqSD.portf$constraints[[1]]$max_sum = 1.01 > > > Now I'm evaluating it: > > EqSD.RND<-optimize.portfolio(R=R, > + portfolio=EqSD.portf, > + optimize_method='random', > + search_size=1000, trace=TRUE > + ) > Warning message: > In constrained_objective(w = min_objective_weights, R = R, portfolio = > portfolio, : > some arguments stored for StdDev do not match > > I'm not sure why I'd get that warning... or maybe I'm not understanding > the meaning of the message. > I believe you are getting that warning because p is not a formal argument for StdDev. > > > plot(EqSD.RND, risk.col="StdDev", return.col="mean", rp=permutations, > chart.assets=TRUE, main="Equal Volatility Contribution Portfolio") > There were 13 warnings (use warnings() to see them) > > warnings() > Warning messages: > 1: In chart.Scatter.RP(object = RP, risk.col = risk.col, ... : > mean or StdDev do not match extractStats output of $objective_measures > slot > You are getting this message because mean is not an objective, so we are calculating mean to plot in mean-StdDev space. > > That's probably a repeat of the above message. > > Then this chart broke: > > > chart.RiskBudget(EqSD.RND) > Error in contrib[[idx[ii]]] : attempt to select less than one element > I ran the script and noticed that EqSD.RND does not have the component StdDev in the $objective_measures slot. I'm not sure why this is, but I'll look into it tomorrow. > > Thanks, > > pcc > -- > Peter Carl > http://www.braverock.com/peter > > > _______________________________________________ > GSoC-PortA mailing list > GSoC-PortA at lists.r-forge.r-project.org > http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rossbennett34 at gmail.com Mon Sep 23 16:32:48 2013 From: rossbennett34 at gmail.com (Ross Bennett) Date: Mon, 23 Sep 2013 07:32:48 -0700 Subject: [GSoC-PortA] Odd Behavior Depending on Order of Objectives Message-ID: All, After running Peter's script in the sandbox/symposium2013, I noticed that portfolio component ES and component StdDev were not being returned in the $objective_measures slot. I did some testing and it appears that if a "risk" objective is added after a "risk_budget" objective with the same name (e.g. "ES" or "StdDev"), the portfolio component contribution is not returned. This seems odd to me because constrained_objective loops through the objectives and calculates each one separately. I attached an example script to demonstrate this. Any thoughts on what is going on here? Thanks, Ross -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: objective_order.R Type: application/octet-stream Size: 1145 bytes Desc: not available URL: From brian at braverock.com Mon Sep 23 16:38:34 2013 From: brian at braverock.com (Brian G. Peterson) Date: Mon, 23 Sep 2013 09:38:34 -0500 Subject: [GSoC-PortA] Odd Behavior Depending on Order of Objectives In-Reply-To: References: Message-ID: <5240526A.1070403@braverock.com> On 09/23/2013 09:32 AM, Ross Bennett wrote: > After running Peter's script in the sandbox/symposium2013, I noticed > that portfolio component ES and component StdDev were not being returned > in the $objective_measures slot. > > I did some testing and it appears that if a "risk" objective is added > after a "risk_budget" objective with the same name (e.g. "ES" or > "StdDev"), the portfolio component contribution is not returned. This > seems odd to me because constrained_objective loops through the > objectives and calculates each one separately. > > I attached an example script to demonstrate this. > > Any thoughts on what is going on here? The returned object is a named list. As such, the second objective with the same name overwrites the first. Both are calculated, but only one will get written. Dealing with this could be tricky. On the one hand, the component risk measures *do* calculate the univariate portfolio risk too. So if we know that they have the same name, we can just get the correct info from the slots. On the other hand, it may make for simpler code to rename the second defined objective, or to rename all objectives to be objectivetype.name e.g. risk_budget.ETL, risk.ETL or alternately, making the list multi-level, with objective types being a heirarchy above the individual objectives. Without spending time poking at it, I don't know which makes more sense, special-casing for the risk_budget functions which all have a common form, or trying to general-case the naming conventions inside the list. -- Brian G. Peterson http://braverock.com/brian/ Ph: 773-459-4973 IM: bgpbraverock From peter at braverock.com Mon Sep 23 22:19:39 2013 From: peter at braverock.com (Peter Carl) Date: Mon, 23 Sep 2013 15:19:39 -0500 Subject: [GSoC-PortA] Some feedback... In-Reply-To: References: <6077558330b1a022003470c2092bae1b.squirrel@mail.braverock.com> Message-ID: Here's your comment from below: "It is tough to tell with the formatting on the email, but I'll take a closer look at the script in the sandbox to see if I can tell what is going on. The idea is that extractObjectiveMeasures will return a matrix of the objective measures for all optimize.portfolio objects in the opt.list object. For example, the meanSD row should have NAs under the ETL and ETL component contribution columns. I am only stitching together the objective measures, I do not re-calculate StdDev or component StdDev for the portfolios with ETL as an objective. Basically, I just take whatever objectives are in the $objective_measures slot of each optimize.portfolio object. Should I be doing something such that all cells in the matrix have values? " I think so, although I doubt this has been well spelled out before. The question is: can we anticipate how to fill in these values given the information in each object? When I do this by hand, I'm just calculating for the list of optimal weights of each objective for each measure. At that point, I can make comparisons I couldn't otherwise. Note that the objectives can be vastly different, as long as the assets are the same and the parameters for each of the metrics are the same. Does that make sense? pcc -- Peter Carl http://www.braverock.com/peter > Peter, > > Thanks for the feedback, I really appreciate it. > > see comments in line. > > > On Sun, Sep 22, 2013 at 4:41 PM, Peter Carl wrote: > >> Ross, >> >> I've been working through your vignette to hopefully give you some more >> detailed feedback, including on your questions from a few days ago. >> Sorry >> this has taken so long, but I wanted to spend some focused time on the >> package. >> >> I realize that you've got different plot methods for each type, and I >> appreciate what a hassle it is to keep such methods relatively >> consistent. >> In chart.RiskReturn.DE, when the function doesn't find anything that >> fits >> its defaults: >> > plot(RiskBudget.DE) >> Error in plot.window(...) : need finite 'xlim' values >> In addition: Warning messages: >> 1: In chart.Scatter.DE(object = DE, risk.col = risk.col, return.col = >> return.col, : >> mean or ES do not match extractStats output of $objective_measures >> slot >> 2: In min(x) : no non-missing arguments to min; returning Inf >> 3: In max(x) : no non-missing arguments to max; returning -Inf >> >> It's a risk budget on ETL, so if I tell it that, it works: >> > plot(RiskBudget.DE, risk.col="ETL", return.col="mean") >> > > The default is risk.col="ES". Because your objective name is "ETL", you > need to explicitly do risk.col="ETL". > > >> >> ...but it doesn't recover well when I try to plot the results in >> variance >> space: >> > plot(RiskBudget.DE, risk.col="StdDev", return.col="mean") >> Error in plot.window(...) : need finite 'xlim' values >> In addition: Warning messages: >> 1: In chart.Scatter.DE(object = DE, risk.col = risk.col, return.col = >> return.col, : >> mean or StdDev do not match extractStats output of >> $objective_measures >> slot >> 2: In min(x) : no non-missing arguments to min; returning Inf >> 3: In max(x) : no non-missing arguments to max; returning -Inf >> >> >> I'm not exactly sure what the issue is here, but maybe it's related: >> > chart.RiskBudget(RiskBudget.DE, risk.type="percentage", neighbors=5) >> Error in subsetx[i, riskcols] : incorrect number of dimensions >> > traceback() >> 3: points(subsetx[i, riskcols], type = "b", col = "lightblue") >> 2: chart.RiskBudget.optimize.portfolio(RiskBudget.DE, risk.type = >> "percentage", >> neighbors = 5) >> 1: chart.RiskBudget(RiskBudget.DE, risk.type = "percentage", neighbors = >> 5) >> > > Not sure either what the issue is, but I'll take a look. > > >> In chart.RiskReturnScatter.RP, it looks like 'rp' is being passed into >> plot through dots. >> > plot(EqmETL.RND, risk.col="StdDev", return.col="mean", rp=1000, >> chart.assets=TRUE) >> There were 13 warnings (use warnings() to see them) >> > warnings() >> Warning messages: >> 1: "rp" is not a graphical parameter >> 2: "rp" is not a graphical parameter >> 3: "rp" is not a graphical parameter >> > > The 'rp' argument is meant for optimize.portfolio.ROI and > optimize.portfolio.GenSA objects. Since ROI and GenSA do not return trace > information like DEoptim or random portfolios, I added this as an option > to > generate random portfolios to plot the feasible space. If you are already > passing in an optimize.portfolio.random object, there is no need to pass > in > rp as an argument. > > >> >> >> > extractWeights(buoys) >> Convertible Arbitrage Equity Market Neutral Fixed Income >> Arbitrage Event Driven CTA Global Global Macro Long/Short Equity >> MeanSD 0.05000000 0.050 >> 0.050 0.30000000 0.0500000 0.2000000 0.300 >> MeanmETL 0.05000000 0.300 >> 0.050 0.05000000 0.2000000 0.3000000 0.050 >> MinSD 0.06042904 0.300 >> 0.300 0.05234676 0.1735858 0.0636384 0.050 >> MinmETL 0.05000000 0.300 >> 0.050 0.05000000 0.2000000 0.3000000 0.050 >> EqSD 0.12500000 0.240 >> 0.200 0.08500000 0.1050000 0.1700000 0.075 >> EqmETL 0.06000000 0.265 >> 0.165 0.09000000 0.2050000 0.1300000 0.080 >> RB 0.05200000 0.410 >> 0.060 0.05200000 0.1438995 0.2220000 0.058 >> >> ...but this doesn't: >> > extractObjectiveMeasures(buoys) >> mean StdDev ES StdDev.contribution1 >> StdDev.contribution2 StdDev.contribution3 >> StdDev.contribution4 >> MeanSD 0.006782814 0.01546759 NA NA >> NA NA NA >> MeanmETL 0.005897789 NA 0.01505626 NA >> NA NA NA >> MinSD NA 0.01009001 NA NA >> NA NA NA >> MinmETL NA NA 0.01505626 NA >> NA NA NA >> EqSD NA 0.01113716 NA 0.001763096 >> 0.001565752 0.001886988 0.001258567 >> EqmETL NA NA 0.01646509 NA >> NA NA NA >> RB 0.005812997 NA NA NA >> NA NA NA >> StdDev.contribution5 StdDev.contribution6 StdDev.contribution7 >> StdDev.pct_contrib_StdDev1 StdDev.pct_contrib_StdDev2 >> MeanSD NA NA NA >> NA NA >> MeanmETL NA NA NA >> NA NA >> MinSD NA NA NA >> NA NA >> MinmETL NA NA NA >> NA NA >> EqSD 0.001039908 0.002296903 0.001325947 >> 0.1583075 0.1405881 >> EqmETL NA NA NA >> NA NA >> RB NA NA NA >> NA NA >> ...snip... >> >> > It is tough to tell with the formatting on the email, but I'll take a > closer look at the script in the sandbox to see if I can tell what is > going > on. The idea is that extractObjectiveMeasures will return a matrix of the > objective measures for all optimize.portfolio objects in the opt.list > object. For example, the meanSD row should have NAs under the ETL and ETL > component contribution columns. I am only stitching together the objective > measures, I do not re-calculate StdDev or component StdDev for the > portfolios with ETL as an objective. Basically, I just take whatever > objectives are in the $objective_measures slot of each optimize.portfolio > object. Should I be doing something such that all cells in the matrix have > values? > > >> As a consequence, only one portfolio appears in the following plot >> (MeanSD): >> > chart.RiskReward(buoys) >> > > This relates to my comment above about how I am not recalculating > anything. > Before the portfolios are plotted in risk-return space, I omit rows that > have NA values. For example, if you wanted to plot all the portfolios in > mean-ETL space, all portfolios should have mean and ETL as an objective. > You could set the multiplier to 0 so it does not affect the optimization, > but is returned in the $objective_measures slot. > > >> >> All in all, this is all looking good. I've got some scripts checked in >> under sandbox/symposium2013 if you want to follow along. >> > > I'll take a closer look and follow along, thanks! > > >> >> pcc >> -- >> Peter Carl >> http://www.braverock.com/peter >> >> >> _______________________________________________ >> GSoC-PortA mailing list >> GSoC-PortA at lists.r-forge.r-project.org >> http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta >> > From rossbennett34 at gmail.com Tue Sep 24 05:28:26 2013 From: rossbennett34 at gmail.com (Ross Bennett) Date: Mon, 23 Sep 2013 20:28:26 -0700 Subject: [GSoC-PortA] Odd Behavior Depending on Order of Objectives In-Reply-To: <5240526A.1070403@braverock.com> References: <5240526A.1070403@braverock.com> Message-ID: On Mon, Sep 23, 2013 at 7:38 AM, Brian G. Peterson wrote: > > > The returned object is a named list. > > As such, the second objective with the same name overwrites the first. > Both are calculated, but only one will get written. > > Dealing with this could be tricky. > > On the one hand, the component risk measures *do* calculate the univariate > portfolio risk too. So if we know that they have the same name, we can > just get the correct info from the slots. > > On the other hand, it may make for simpler code to rename the second > defined objective, or to rename all objectives to be objectivetype.namee.g. risk_budget.ETL, risk.ETL or alternately, making the list multi-level, > with objective types being a heirarchy above the individual objectives. > I think that might be the best approach to rename the objectives to be objectivetype.name. The main area that will be affected is the functions that depend on the extractStats output, mainly the charting and generic functions. I think we'll still want the user to specify risk.col="ES" and not risk.col="risk.ES". A good solution might be to rename the objective as suggested above and then deal with the column naming in extractStats. Thoughts? -------------- next part -------------- An HTML attachment was scrubbed... URL: From rossbennett34 at gmail.com Tue Sep 24 06:09:56 2013 From: rossbennett34 at gmail.com (Ross Bennett) Date: Mon, 23 Sep 2013 21:09:56 -0700 Subject: [GSoC-PortA] Some feedback... In-Reply-To: References: <6077558330b1a022003470c2092bae1b.squirrel@mail.braverock.com> Message-ID: On Mon, Sep 23, 2013 at 1:19 PM, Peter Carl wrote: > Here's your comment from below: > > "It is tough to tell with the formatting on the email, but I'll take a > closer look at the script in the sandbox to see if I can tell what is > going on. The idea is that extractObjectiveMeasures will return a matrix > of the objective measures for all optimize.portfolio objects in the > opt.list object. For example, the meanSD row should have NAs under the ETL > and ETL component contribution columns. I am only stitching together the > objective measures, I do not re-calculate StdDev or component StdDev for > the portfolios with ETL as an objective. Basically, I just take whatever > objectives are in the $objective_measures slot of each optimize.portfolio > object. Should I be doing something such that all cells in the matrix have > values? " > > I think so, although I doubt this has been well spelled out before. The > question is: can we anticipate how to fill in these values given the > information in each object? > I think we might be able to depending on how the objective measures are calculated on the weights. One way would be to pick out the objective names, match the name to the function, and then calculate the objectives on the weights. The parameters could be pulled from the $arguments list in each objective. This might be tricky if there are multiple arguments with different arguments. This is likely the simplest solution. If "ES" is an objective name, we could by default calculate it with portfolio_method="component" since the univariate ES also calculated. Another way is to combine all the objectives from each object, try to detect and remove duplicate objectives objects, then pass that portfolio object to constrained_objective to calculate over the weights. Not sure which way is better, I'll have to give this some thought and try out a few things. > > When I do this by hand, I'm just calculating for the list of optimal > weights of each objective for each measure. At that point, I can make > comparisons I couldn't otherwise. > > Note that the objectives can be vastly different, as long as the assets > are the same and the parameters for each of the metrics are the same. > I could add a check to make sure that the assets and returns are the same in each optimize.portfolio object. I think this will only work if that is the case. It would be nice to have the flexibility to have different assets and returns, but that may not be doable. > > Does that make sense? > It does make sense, thanks for the feedback. > > pcc > -- > Peter Carl > http://www.braverock.com/peter > > > Peter, > > > > Thanks for the feedback, I really appreciate it. > > > > see comments in line. > > > > > > On Sun, Sep 22, 2013 at 4:41 PM, Peter Carl wrote: > > > >> Ross, > >> > >> I've been working through your vignette to hopefully give you some more > >> detailed feedback, including on your questions from a few days ago. > >> Sorry > >> this has taken so long, but I wanted to spend some focused time on the > >> package. > >> > >> I realize that you've got different plot methods for each type, and I > >> appreciate what a hassle it is to keep such methods relatively > >> consistent. > >> In chart.RiskReturn.DE, when the function doesn't find anything that > >> fits > >> its defaults: > >> > plot(RiskBudget.DE) > >> Error in plot.window(...) : need finite 'xlim' values > >> In addition: Warning messages: > >> 1: In chart.Scatter.DE(object = DE, risk.col = risk.col, return.col = > >> return.col, : > >> mean or ES do not match extractStats output of $objective_measures > >> slot > >> 2: In min(x) : no non-missing arguments to min; returning Inf > >> 3: In max(x) : no non-missing arguments to max; returning -Inf > >> > >> It's a risk budget on ETL, so if I tell it that, it works: > >> > plot(RiskBudget.DE, risk.col="ETL", return.col="mean") > >> > > > > The default is risk.col="ES". Because your objective name is "ETL", you > > need to explicitly do risk.col="ETL". > > > > > >> > >> ...but it doesn't recover well when I try to plot the results in > >> variance > >> space: > >> > plot(RiskBudget.DE, risk.col="StdDev", return.col="mean") > >> Error in plot.window(...) : need finite 'xlim' values > >> In addition: Warning messages: > >> 1: In chart.Scatter.DE(object = DE, risk.col = risk.col, return.col = > >> return.col, : > >> mean or StdDev do not match extractStats output of > >> $objective_measures > >> slot > >> 2: In min(x) : no non-missing arguments to min; returning Inf > >> 3: In max(x) : no non-missing arguments to max; returning -Inf > >> > >> > >> I'm not exactly sure what the issue is here, but maybe it's related: > >> > chart.RiskBudget(RiskBudget.DE, risk.type="percentage", neighbors=5) > >> Error in subsetx[i, riskcols] : incorrect number of dimensions > >> > traceback() > >> 3: points(subsetx[i, riskcols], type = "b", col = "lightblue") > >> 2: chart.RiskBudget.optimize.portfolio(RiskBudget.DE, risk.type = > >> "percentage", > >> neighbors = 5) > >> 1: chart.RiskBudget(RiskBudget.DE, risk.type = "percentage", neighbors = > >> 5) > >> > > > > Not sure either what the issue is, but I'll take a look. > > > > > >> In chart.RiskReturnScatter.RP, it looks like 'rp' is being passed into > >> plot through dots. > >> > plot(EqmETL.RND, risk.col="StdDev", return.col="mean", rp=1000, > >> chart.assets=TRUE) > >> There were 13 warnings (use warnings() to see them) > >> > warnings() > >> Warning messages: > >> 1: "rp" is not a graphical parameter > >> 2: "rp" is not a graphical parameter > >> 3: "rp" is not a graphical parameter > >> > > > > The 'rp' argument is meant for optimize.portfolio.ROI and > > optimize.portfolio.GenSA objects. Since ROI and GenSA do not return trace > > information like DEoptim or random portfolios, I added this as an option > > to > > generate random portfolios to plot the feasible space. If you are already > > passing in an optimize.portfolio.random object, there is no need to pass > > in > > rp as an argument. > > > > > >> > >> > >> > extractWeights(buoys) > >> Convertible Arbitrage Equity Market Neutral Fixed Income > >> Arbitrage Event Driven CTA Global Global Macro Long/Short Equity > >> MeanSD 0.05000000 0.050 > >> 0.050 0.30000000 0.0500000 0.2000000 0.300 > >> MeanmETL 0.05000000 0.300 > >> 0.050 0.05000000 0.2000000 0.3000000 0.050 > >> MinSD 0.06042904 0.300 > >> 0.300 0.05234676 0.1735858 0.0636384 0.050 > >> MinmETL 0.05000000 0.300 > >> 0.050 0.05000000 0.2000000 0.3000000 0.050 > >> EqSD 0.12500000 0.240 > >> 0.200 0.08500000 0.1050000 0.1700000 0.075 > >> EqmETL 0.06000000 0.265 > >> 0.165 0.09000000 0.2050000 0.1300000 0.080 > >> RB 0.05200000 0.410 > >> 0.060 0.05200000 0.1438995 0.2220000 0.058 > >> > >> ...but this doesn't: > >> > extractObjectiveMeasures(buoys) > >> mean StdDev ES StdDev.contribution1 > >> StdDev.contribution2 StdDev.contribution3 > >> StdDev.contribution4 > >> MeanSD 0.006782814 0.01546759 NA NA > >> NA NA NA > >> MeanmETL 0.005897789 NA 0.01505626 NA > >> NA NA NA > >> MinSD NA 0.01009001 NA NA > >> NA NA NA > >> MinmETL NA NA 0.01505626 NA > >> NA NA NA > >> EqSD NA 0.01113716 NA 0.001763096 > >> 0.001565752 0.001886988 0.001258567 > >> EqmETL NA NA 0.01646509 NA > >> NA NA NA > >> RB 0.005812997 NA NA NA > >> NA NA NA > >> StdDev.contribution5 StdDev.contribution6 StdDev.contribution7 > >> StdDev.pct_contrib_StdDev1 StdDev.pct_contrib_StdDev2 > >> MeanSD NA NA NA > >> NA NA > >> MeanmETL NA NA NA > >> NA NA > >> MinSD NA NA NA > >> NA NA > >> MinmETL NA NA NA > >> NA NA > >> EqSD 0.001039908 0.002296903 0.001325947 > >> 0.1583075 0.1405881 > >> EqmETL NA NA NA > >> NA NA > >> RB NA NA NA > >> NA NA > >> ...snip... > >> > >> > > It is tough to tell with the formatting on the email, but I'll take a > > closer look at the script in the sandbox to see if I can tell what is > > going > > on. The idea is that extractObjectiveMeasures will return a matrix of the > > objective measures for all optimize.portfolio objects in the opt.list > > object. For example, the meanSD row should have NAs under the ETL and ETL > > component contribution columns. I am only stitching together the > objective > > measures, I do not re-calculate StdDev or component StdDev for the > > portfolios with ETL as an objective. Basically, I just take whatever > > objectives are in the $objective_measures slot of each optimize.portfolio > > object. Should I be doing something such that all cells in the matrix > have > > values? > > > > > >> As a consequence, only one portfolio appears in the following plot > >> (MeanSD): > >> > chart.RiskReward(buoys) > >> > > > > This relates to my comment above about how I am not recalculating > > anything. > > Before the portfolios are plotted in risk-return space, I omit rows that > > have NA values. For example, if you wanted to plot all the portfolios in > > mean-ETL space, all portfolios should have mean and ETL as an objective. > > You could set the multiplier to 0 so it does not affect the optimization, > > but is returned in the $objective_measures slot. > > > > > >> > >> All in all, this is all looking good. I've got some scripts checked in > >> under sandbox/symposium2013 if you want to follow along. > >> > > > > I'll take a closer look and follow along, thanks! > > > > > >> > >> pcc > >> -- > >> Peter Carl > >> http://www.braverock.com/peter > >> > >> > >> _______________________________________________ > >> GSoC-PortA mailing list > >> GSoC-PortA at lists.r-forge.r-project.org > >> http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta > >> > > > > _______________________________________________ > GSoC-PortA mailing list > GSoC-PortA at lists.r-forge.r-project.org > http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta > -------------- next part -------------- An HTML attachment was scrubbed... URL: From peter at braverock.com Tue Sep 24 13:00:57 2013 From: peter at braverock.com (Peter Carl) Date: Tue, 24 Sep 2013 06:00:57 -0500 Subject: [GSoC-PortA] Some feedback... In-Reply-To: References: <6077558330b1a022003470c2092bae1b.squirrel@mail.braverock.com> Message-ID: <30c9e004e0cf5f5dfda0cd17ef50ea01.squirrel@mail.braverock.com> Now that I think about it a bit more, I think that returns and assets CAN differ, as long as the measures are calculable at the portfolio level. I'm not sure which of the processes you outlined below are preferable, but they are definitely in the right direction. pcc -- Peter Carl http://www.braverock.com/peter > On Mon, Sep 23, 2013 at 1:19 PM, Peter Carl wrote: > >> Here's your comment from below: >> >> "It is tough to tell with the formatting on the email, but I'll take a >> closer look at the script in the sandbox to see if I can tell what is >> going on. The idea is that extractObjectiveMeasures will return a matrix >> of the objective measures for all optimize.portfolio objects in the >> opt.list object. For example, the meanSD row should have NAs under the >> ETL >> and ETL component contribution columns. I am only stitching together the >> objective measures, I do not re-calculate StdDev or component StdDev for >> the portfolios with ETL as an objective. Basically, I just take whatever >> objectives are in the $objective_measures slot of each >> optimize.portfolio >> object. Should I be doing something such that all cells in the matrix >> have >> values? " >> >> I think so, although I doubt this has been well spelled out before. The >> question is: can we anticipate how to fill in these values given the >> information in each object? >> > > I think we might be able to depending on how the objective measures are > calculated on the weights. > > One way would be to pick out the objective names, match the name to the > function, and then calculate the objectives on the weights. The parameters > could be pulled from the $arguments list in each objective. This might be > tricky if there are multiple arguments with different arguments. This is > likely the simplest solution. If "ES" is an objective name, we could by > default calculate it with portfolio_method="component" since the > univariate > ES also calculated. > > Another way is to combine all the objectives from each object, try to > detect and remove duplicate objectives objects, then pass that portfolio > object to constrained_objective to calculate over the weights. > > Not sure which way is better, I'll have to give this some thought and try > out a few things. > > >> >> When I do this by hand, I'm just calculating for the list of optimal >> weights of each objective for each measure. At that point, I can make >> comparisons I couldn't otherwise. >> >> Note that the objectives can be vastly different, as long as the assets >> are the same and the parameters for each of the metrics are the same. >> > > I could add a check to make sure that the assets and returns are the same > in each optimize.portfolio object. I think this will only work if that is > the case. It would be nice to have the flexibility to have different > assets > and returns, but that may not be doable. > > >> >> Does that make sense? >> > > It does make sense, thanks for the feedback. > > >> >> pcc >> -- >> Peter Carl >> http://www.braverock.com/peter >> >> > Peter, >> > >> > Thanks for the feedback, I really appreciate it. >> > >> > see comments in line. >> > >> > >> > On Sun, Sep 22, 2013 at 4:41 PM, Peter Carl >> wrote: >> > >> >> Ross, >> >> >> >> I've been working through your vignette to hopefully give you some >> more >> >> detailed feedback, including on your questions from a few days ago. >> >> Sorry >> >> this has taken so long, but I wanted to spend some focused time on >> the >> >> package. >> >> >> >> I realize that you've got different plot methods for each type, and I >> >> appreciate what a hassle it is to keep such methods relatively >> >> consistent. >> >> In chart.RiskReturn.DE, when the function doesn't find anything that >> >> fits >> >> its defaults: >> >> > plot(RiskBudget.DE) >> >> Error in plot.window(...) : need finite 'xlim' values >> >> In addition: Warning messages: >> >> 1: In chart.Scatter.DE(object = DE, risk.col = risk.col, return.col = >> >> return.col, : >> >> mean or ES do not match extractStats output of $objective_measures >> >> slot >> >> 2: In min(x) : no non-missing arguments to min; returning Inf >> >> 3: In max(x) : no non-missing arguments to max; returning -Inf >> >> >> >> It's a risk budget on ETL, so if I tell it that, it works: >> >> > plot(RiskBudget.DE, risk.col="ETL", return.col="mean") >> >> >> > >> > The default is risk.col="ES". Because your objective name is "ETL", >> you >> > need to explicitly do risk.col="ETL". >> > >> > >> >> >> >> ...but it doesn't recover well when I try to plot the results in >> >> variance >> >> space: >> >> > plot(RiskBudget.DE, risk.col="StdDev", return.col="mean") >> >> Error in plot.window(...) : need finite 'xlim' values >> >> In addition: Warning messages: >> >> 1: In chart.Scatter.DE(object = DE, risk.col = risk.col, return.col = >> >> return.col, : >> >> mean or StdDev do not match extractStats output of >> >> $objective_measures >> >> slot >> >> 2: In min(x) : no non-missing arguments to min; returning Inf >> >> 3: In max(x) : no non-missing arguments to max; returning -Inf >> >> >> >> >> >> I'm not exactly sure what the issue is here, but maybe it's related: >> >> > chart.RiskBudget(RiskBudget.DE, risk.type="percentage", >> neighbors=5) >> >> Error in subsetx[i, riskcols] : incorrect number of dimensions >> >> > traceback() >> >> 3: points(subsetx[i, riskcols], type = "b", col = "lightblue") >> >> 2: chart.RiskBudget.optimize.portfolio(RiskBudget.DE, risk.type = >> >> "percentage", >> >> neighbors = 5) >> >> 1: chart.RiskBudget(RiskBudget.DE, risk.type = "percentage", >> neighbors = >> >> 5) >> >> >> > >> > Not sure either what the issue is, but I'll take a look. >> > >> > >> >> In chart.RiskReturnScatter.RP, it looks like 'rp' is being passed >> into >> >> plot through dots. >> >> > plot(EqmETL.RND, risk.col="StdDev", return.col="mean", rp=1000, >> >> chart.assets=TRUE) >> >> There were 13 warnings (use warnings() to see them) >> >> > warnings() >> >> Warning messages: >> >> 1: "rp" is not a graphical parameter >> >> 2: "rp" is not a graphical parameter >> >> 3: "rp" is not a graphical parameter >> >> >> > >> > The 'rp' argument is meant for optimize.portfolio.ROI and >> > optimize.portfolio.GenSA objects. Since ROI and GenSA do not return >> trace >> > information like DEoptim or random portfolios, I added this as an >> option >> > to >> > generate random portfolios to plot the feasible space. If you are >> already >> > passing in an optimize.portfolio.random object, there is no need to >> pass >> > in >> > rp as an argument. >> > >> > >> >> >> >> >> >> > extractWeights(buoys) >> >> Convertible Arbitrage Equity Market Neutral Fixed Income >> >> Arbitrage Event Driven CTA Global Global Macro Long/Short Equity >> >> MeanSD 0.05000000 0.050 >> >> 0.050 0.30000000 0.0500000 0.2000000 0.300 >> >> MeanmETL 0.05000000 0.300 >> >> 0.050 0.05000000 0.2000000 0.3000000 0.050 >> >> MinSD 0.06042904 0.300 >> >> 0.300 0.05234676 0.1735858 0.0636384 0.050 >> >> MinmETL 0.05000000 0.300 >> >> 0.050 0.05000000 0.2000000 0.3000000 0.050 >> >> EqSD 0.12500000 0.240 >> >> 0.200 0.08500000 0.1050000 0.1700000 0.075 >> >> EqmETL 0.06000000 0.265 >> >> 0.165 0.09000000 0.2050000 0.1300000 0.080 >> >> RB 0.05200000 0.410 >> >> 0.060 0.05200000 0.1438995 0.2220000 0.058 >> >> >> >> ...but this doesn't: >> >> > extractObjectiveMeasures(buoys) >> >> mean StdDev ES StdDev.contribution1 >> >> StdDev.contribution2 StdDev.contribution3 >> >> StdDev.contribution4 >> >> MeanSD 0.006782814 0.01546759 NA NA >> >> NA NA NA >> >> MeanmETL 0.005897789 NA 0.01505626 NA >> >> NA NA NA >> >> MinSD NA 0.01009001 NA NA >> >> NA NA NA >> >> MinmETL NA NA 0.01505626 NA >> >> NA NA NA >> >> EqSD NA 0.01113716 NA 0.001763096 >> >> 0.001565752 0.001886988 0.001258567 >> >> EqmETL NA NA 0.01646509 NA >> >> NA NA NA >> >> RB 0.005812997 NA NA NA >> >> NA NA NA >> >> StdDev.contribution5 StdDev.contribution6 >> StdDev.contribution7 >> >> StdDev.pct_contrib_StdDev1 StdDev.pct_contrib_StdDev2 >> >> MeanSD NA NA >> NA >> >> NA NA >> >> MeanmETL NA NA >> NA >> >> NA NA >> >> MinSD NA NA >> NA >> >> NA NA >> >> MinmETL NA NA >> NA >> >> NA NA >> >> EqSD 0.001039908 0.002296903 >> 0.001325947 >> >> 0.1583075 0.1405881 >> >> EqmETL NA NA >> NA >> >> NA NA >> >> RB NA NA >> NA >> >> NA NA >> >> ...snip... >> >> >> >> >> > It is tough to tell with the formatting on the email, but I'll take a >> > closer look at the script in the sandbox to see if I can tell what is >> > going >> > on. The idea is that extractObjectiveMeasures will return a matrix of >> the >> > objective measures for all optimize.portfolio objects in the opt.list >> > object. For example, the meanSD row should have NAs under the ETL and >> ETL >> > component contribution columns. I am only stitching together the >> objective >> > measures, I do not re-calculate StdDev or component StdDev for the >> > portfolios with ETL as an objective. Basically, I just take whatever >> > objectives are in the $objective_measures slot of each >> optimize.portfolio >> > object. Should I be doing something such that all cells in the matrix >> have >> > values? >> > >> > >> >> As a consequence, only one portfolio appears in the following plot >> >> (MeanSD): >> >> > chart.RiskReward(buoys) >> >> >> > >> > This relates to my comment above about how I am not recalculating >> > anything. >> > Before the portfolios are plotted in risk-return space, I omit rows >> that >> > have NA values. For example, if you wanted to plot all the portfolios >> in >> > mean-ETL space, all portfolios should have mean and ETL as an >> objective. >> > You could set the multiplier to 0 so it does not affect the >> optimization, >> > but is returned in the $objective_measures slot. >> > >> > >> >> >> >> All in all, this is all looking good. I've got some scripts checked >> in >> >> under sandbox/symposium2013 if you want to follow along. >> >> >> > >> > I'll take a closer look and follow along, thanks! >> > >> > >> >> >> >> pcc >> >> -- >> >> Peter Carl >> >> http://www.braverock.com/peter >> >> >> >> >> >> _______________________________________________ >> >> GSoC-PortA mailing list >> >> GSoC-PortA at lists.r-forge.r-project.org >> >> http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta >> >> >> > >> >> _______________________________________________ >> GSoC-PortA mailing list >> GSoC-PortA at lists.r-forge.r-project.org >> http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta >> > _______________________________________________ > GSoC-PortA mailing list > GSoC-PortA at lists.r-forge.r-project.org > http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta > From peter at braverock.com Tue Sep 24 16:28:07 2013 From: peter at braverock.com (Peter Carl) Date: Tue, 24 Sep 2013 09:28:07 -0500 Subject: [GSoC-PortA] Random portfolios Message-ID: <0219d0832454daa3b2ad9b43904f479f.squirrel@mail.braverock.com> The random_portfolios function isn't generating the correct number of permutations. > random_portfolios(portfolio=init.portf, permutations=1000) gives me a result with 317 weight vectors, rather than 1000. I think that there's a loop missing: when the number of lines is less than permutations, the function needs to generate more, check for unique solutions, and repeat until there are (in this case) 1000 weight vectors. Although (and it's difficult to tell), on their own the charts seem to generate about the right number? Or maybe not... pcc -- Peter Carl http://www.braverock.com/peter From brian at braverock.com Tue Sep 24 16:33:07 2013 From: brian at braverock.com (Brian G. Peterson) Date: Tue, 24 Sep 2013 09:33:07 -0500 Subject: [GSoC-PortA] Random portfolios In-Reply-To: <0219d0832454daa3b2ad9b43904f479f.squirrel@mail.braverock.com> References: <0219d0832454daa3b2ad9b43904f479f.squirrel@mail.braverock.com> Message-ID: <5241A2A3.60902@braverock.com> On 09/24/2013 09:28 AM, Peter Carl wrote: > The random_portfolios function isn't generating the correct number of > permutations. > >> >random_portfolios(portfolio=init.portf, permutations=1000) > gives me a result with 317 weight vectors, rather than 1000. > > I think that there's a loop missing: when the number of lines is less than > permutations, the function needs to generate more, check for unique > solutions, and repeat until there are (in this case) 1000 weight vectors. > > Although (and it's difficult to tell), on their own the charts seem to > generate about the right number? Or maybe not... I suspect that given your constraints you're just hitting max_permutations. All that code is still there, so it seems most likely that you just don't have max_permutations high enough, or that your granularity on the sequence is too high (e.g. you're using a step size of .01, and should try .005) -- Brian G. Peterson http://braverock.com/brian/ Ph: 773-459-4973 IM: bgpbraverock From peter at braverock.com Tue Sep 24 17:02:58 2013 From: peter at braverock.com (Peter Carl) Date: Tue, 24 Sep 2013 10:02:58 -0500 Subject: [GSoC-PortA] Random portfolios In-Reply-To: <5241A2A3.60902@braverock.com> References: <0219d0832454daa3b2ad9b43904f479f.squirrel@mail.braverock.com> <5241A2A3.60902@braverock.com> Message-ID: Fair point. I get the same result when I use high values for max_permutations. That attribute should probably be referenced in the function documentation under details, so that users know it can be passed through dots. Same result though. When I call rp_sample directly: rp_sample(init.portf, permutations=1000) ... I get 1000 rows back. So something's happening in the dispatch code? pcc -- Peter Carl http://www.braverock.com/peter > On 09/24/2013 09:28 AM, Peter Carl wrote: >> The random_portfolios function isn't generating the correct number of >> permutations. >> >>> >random_portfolios(portfolio=init.portf, permutations=1000) >> gives me a result with 317 weight vectors, rather than 1000. >> >> I think that there's a loop missing: when the number of lines is less >> than >> permutations, the function needs to generate more, check for unique >> solutions, and repeat until there are (in this case) 1000 weight >> vectors. >> >> Although (and it's difficult to tell), on their own the charts seem to >> generate about the right number? Or maybe not... > > I suspect that given your constraints you're just hitting > max_permutations. > > All that code is still there, so it seems most likely that you just > don't have max_permutations high enough, or that your granularity on the > sequence is too high (e.g. you're using a step size of .01, and should > try .005) > > -- > Brian G. Peterson > http://braverock.com/brian/ > Ph: 773-459-4973 > IM: bgpbraverock > _______________________________________________ > GSoC-PortA mailing list > GSoC-PortA at lists.r-forge.r-project.org > http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta > From rossbennett34 at gmail.com Tue Sep 24 17:15:27 2013 From: rossbennett34 at gmail.com (Ross Bennett) Date: Tue, 24 Sep 2013 08:15:27 -0700 Subject: [GSoC-PortA] Random portfolios In-Reply-To: References: <0219d0832454daa3b2ad9b43904f479f.squirrel@mail.braverock.com> <5241A2A3.60902@braverock.com> Message-ID: Thanks for making me aware of this. I'll take a closer look and try to figure out what is going on. Ross On Sep 24, 2013 8:03 AM, "Peter Carl" wrote: > Fair point. I get the same result when I use high values for > max_permutations. That attribute should probably be referenced in the > function documentation under details, so that users know it can be passed > through dots. > > Same result though. When I call rp_sample directly: > rp_sample(init.portf, permutations=1000) > ... I get 1000 rows back. > > So something's happening in the dispatch code? > > pcc > -- > Peter Carl > http://www.braverock.com/peter > > > On 09/24/2013 09:28 AM, Peter Carl wrote: > >> The random_portfolios function isn't generating the correct number of > >> permutations. > >> > >>> >random_portfolios(portfolio=init.portf, permutations=1000) > >> gives me a result with 317 weight vectors, rather than 1000. > >> > >> I think that there's a loop missing: when the number of lines is less > >> than > >> permutations, the function needs to generate more, check for unique > >> solutions, and repeat until there are (in this case) 1000 weight > >> vectors. > >> > >> Although (and it's difficult to tell), on their own the charts seem to > >> generate about the right number? Or maybe not... > > > > I suspect that given your constraints you're just hitting > > max_permutations. > > > > All that code is still there, so it seems most likely that you just > > don't have max_permutations high enough, or that your granularity on the > > sequence is too high (e.g. you're using a step size of .01, and should > > try .005) > > > > -- > > Brian G. Peterson > > http://braverock.com/brian/ > > Ph: 773-459-4973 > > IM: bgpbraverock > > _______________________________________________ > > GSoC-PortA mailing list > > GSoC-PortA at lists.r-forge.r-project.org > > http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta > > > > > _______________________________________________ > GSoC-PortA mailing list > GSoC-PortA at lists.r-forge.r-project.org > http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rossbennett34 at gmail.com Tue Sep 24 18:17:19 2013 From: rossbennett34 at gmail.com (Ross Bennett) Date: Tue, 24 Sep 2013 09:17:19 -0700 Subject: [GSoC-PortA] Random portfolios In-Reply-To: References: <0219d0832454daa3b2ad9b43904f479f.squirrel@mail.braverock.com> <5241A2A3.60902@braverock.com> Message-ID: The reason for fewer random portfolios being generated is due to the leverage constraints in init.portf. There is a block of code in randomize_portfolio_v2 (which is called by rp_sample) that will check for a difference in min_sum and max_sum. For example, if min_sum=1 and max_sum=1, we temporarily modify min_sum=0.99 and max_sum=1.01 so that random portfolios can be generated. Then in random_portfolios, there is a block of code that eliminates portfolios that do not satisfy the constraints with the check_constraints function. This takes place for random portfolios generated by the sample, simplex, and grid method. Because rp_sample will generate portfolios with weights that sum from 0.99 to 1.01, there are several portfolios that violate leverage constraints of min_sum=1 and max_sum=1 and therefore will be eliminated. If you change the init.portf leverage constraints to min_sum=0.99 and max_sum=1.01 you should generate 1000 portfolios. I'll add some of this content to the @details in random_portfolios to explain how the function is sensitive to leverage constraints. Thanks, Ross On Tue, Sep 24, 2013 at 8:15 AM, Ross Bennett wrote: > Thanks for making me aware of this. I'll take a closer look and try to > figure out what is going on. > > Ross > On Sep 24, 2013 8:03 AM, "Peter Carl" wrote: > >> Fair point. I get the same result when I use high values for >> max_permutations. That attribute should probably be referenced in the >> function documentation under details, so that users know it can be passed >> through dots. >> >> Same result though. When I call rp_sample directly: >> rp_sample(init.portf, permutations=1000) >> ... I get 1000 rows back. >> >> So something's happening in the dispatch code? >> >> pcc >> -- >> Peter Carl >> http://www.braverock.com/peter >> >> > On 09/24/2013 09:28 AM, Peter Carl wrote: >> >> The random_portfolios function isn't generating the correct number of >> >> permutations. >> >> >> >>> >random_portfolios(portfolio=init.portf, permutations=1000) >> >> gives me a result with 317 weight vectors, rather than 1000. >> >> >> >> I think that there's a loop missing: when the number of lines is less >> >> than >> >> permutations, the function needs to generate more, check for unique >> >> solutions, and repeat until there are (in this case) 1000 weight >> >> vectors. >> >> >> >> Although (and it's difficult to tell), on their own the charts seem to >> >> generate about the right number? Or maybe not... >> > >> > I suspect that given your constraints you're just hitting >> > max_permutations. >> > >> > All that code is still there, so it seems most likely that you just >> > don't have max_permutations high enough, or that your granularity on the >> > sequence is too high (e.g. you're using a step size of .01, and should >> > try .005) >> > >> > -- >> > Brian G. Peterson >> > http://braverock.com/brian/ >> > Ph: 773-459-4973 >> > IM: bgpbraverock >> > _______________________________________________ >> > GSoC-PortA mailing list >> > GSoC-PortA at lists.r-forge.r-project.org >> > http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta >> > >> >> >> _______________________________________________ >> GSoC-PortA mailing list >> GSoC-PortA at lists.r-forge.r-project.org >> http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From peter at braverock.com Tue Sep 24 18:52:29 2013 From: peter at braverock.com (Peter Carl) Date: Tue, 24 Sep 2013 11:52:29 -0500 Subject: [GSoC-PortA] Random portfolios In-Reply-To: References: <0219d0832454daa3b2ad9b43904f479f.squirrel@mail.braverock.com> <5241A2A3.60902@braverock.com> Message-ID: <92768f15249e53f2546f32e09f48d3b7.squirrel@mail.braverock.com> Thanks, that does work. Should the check done in randomize_portfolio_v2 be moved up the chain to catch that issue earlier? -- Peter Carl http://www.braverock.com/peter > The reason for fewer random portfolios being generated is due to the > leverage constraints in init.portf. There is a block of code in > randomize_portfolio_v2 (which is called by rp_sample) that will check for > a > difference in min_sum and max_sum. For example, if min_sum=1 and > max_sum=1, > we temporarily modify min_sum=0.99 and max_sum=1.01 so that random > portfolios can be generated. > > Then in random_portfolios, there is a block of code that eliminates > portfolios that do not satisfy the constraints with the check_constraints > function. This takes place for random portfolios generated by the sample, > simplex, and grid method. Because rp_sample will generate portfolios with > weights that sum from 0.99 to 1.01, there are several portfolios that > violate leverage constraints of min_sum=1 and max_sum=1 and therefore will > be eliminated. > > If you change the init.portf leverage constraints to min_sum=0.99 and > max_sum=1.01 you should generate 1000 portfolios. > > I'll add some of this content to the @details in random_portfolios to > explain how the function is sensitive to leverage constraints. > > Thanks, > Ross > > > > > On Tue, Sep 24, 2013 at 8:15 AM, Ross Bennett > wrote: > >> Thanks for making me aware of this. I'll take a closer look and try to >> figure out what is going on. >> >> Ross >> On Sep 24, 2013 8:03 AM, "Peter Carl" wrote: >> >>> Fair point. I get the same result when I use high values for >>> max_permutations. That attribute should probably be referenced in the >>> function documentation under details, so that users know it can be >>> passed >>> through dots. >>> >>> Same result though. When I call rp_sample directly: >>> rp_sample(init.portf, permutations=1000) >>> ... I get 1000 rows back. >>> >>> So something's happening in the dispatch code? >>> >>> pcc >>> -- >>> Peter Carl >>> http://www.braverock.com/peter >>> >>> > On 09/24/2013 09:28 AM, Peter Carl wrote: >>> >> The random_portfolios function isn't generating the correct number >>> of >>> >> permutations. >>> >> >>> >>> >random_portfolios(portfolio=init.portf, permutations=1000) >>> >> gives me a result with 317 weight vectors, rather than 1000. >>> >> >>> >> I think that there's a loop missing: when the number of lines is >>> less >>> >> than >>> >> permutations, the function needs to generate more, check for unique >>> >> solutions, and repeat until there are (in this case) 1000 weight >>> >> vectors. >>> >> >>> >> Although (and it's difficult to tell), on their own the charts seem >>> to >>> >> generate about the right number? Or maybe not... >>> > >>> > I suspect that given your constraints you're just hitting >>> > max_permutations. >>> > >>> > All that code is still there, so it seems most likely that you just >>> > don't have max_permutations high enough, or that your granularity on >>> the >>> > sequence is too high (e.g. you're using a step size of .01, and >>> should >>> > try .005) >>> > >>> > -- >>> > Brian G. Peterson >>> > http://braverock.com/brian/ >>> > Ph: 773-459-4973 >>> > IM: bgpbraverock >>> > _______________________________________________ >>> > GSoC-PortA mailing list >>> > GSoC-PortA at lists.r-forge.r-project.org >>> > http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta >>> > >>> >>> >>> _______________________________________________ >>> GSoC-PortA mailing list >>> GSoC-PortA at lists.r-forge.r-project.org >>> http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta >>> >> > _______________________________________________ > GSoC-PortA mailing list > GSoC-PortA at lists.r-forge.r-project.org > http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta > From rossbennett34 at gmail.com Tue Sep 24 19:59:19 2013 From: rossbennett34 at gmail.com (Ross Bennett) Date: Tue, 24 Sep 2013 10:59:19 -0700 Subject: [GSoC-PortA] Random portfolios In-Reply-To: <92768f15249e53f2546f32e09f48d3b7.squirrel@mail.braverock.com> References: <0219d0832454daa3b2ad9b43904f479f.squirrel@mail.braverock.com> <5241A2A3.60902@braverock.com> <92768f15249e53f2546f32e09f48d3b7.squirrel@mail.braverock.com> Message-ID: The check for min_sum and max_sum is done right away in randomize_portfolio_v2. The main reason why I added this check and wiggle room for min_sum and max_sum inside of the function is to speed up generating the random portfolio and ensure that a reasonable number of portfolios can be generated. Another logical place for this check would be in the check_constraints function, this would prevent portfolios being eliminated. Even if we do this check here, constrained_objective will penalize a large number of sets of weights that do not sum to exactly 1. I think it also might make sense to add a check in optimize.portfolio and issue a warning to the user that min_sum and max_sum may be too restrictive. This will apply to optimize_method="random" and optimize_method="DEoptim" because we are using logic from random portfolios as a mapping function in DEoptim. Ross On Tue, Sep 24, 2013 at 9:52 AM, Peter Carl wrote: > Thanks, that does work. Should the check done in randomize_portfolio_v2 > be moved up the chain to catch that issue earlier? > -- > Peter Carl > http://www.braverock.com/peter > > > The reason for fewer random portfolios being generated is due to the > > leverage constraints in init.portf. There is a block of code in > > randomize_portfolio_v2 (which is called by rp_sample) that will check for > > a > > difference in min_sum and max_sum. For example, if min_sum=1 and > > max_sum=1, > > we temporarily modify min_sum=0.99 and max_sum=1.01 so that random > > portfolios can be generated. > > > > Then in random_portfolios, there is a block of code that eliminates > > portfolios that do not satisfy the constraints with the check_constraints > > function. This takes place for random portfolios generated by the sample, > > simplex, and grid method. Because rp_sample will generate portfolios with > > weights that sum from 0.99 to 1.01, there are several portfolios that > > violate leverage constraints of min_sum=1 and max_sum=1 and therefore > will > > be eliminated. > > > > If you change the init.portf leverage constraints to min_sum=0.99 and > > max_sum=1.01 you should generate 1000 portfolios. > > > > I'll add some of this content to the @details in random_portfolios to > > explain how the function is sensitive to leverage constraints. > > > > Thanks, > > Ross > > > > > > > > > > On Tue, Sep 24, 2013 at 8:15 AM, Ross Bennett > > wrote: > > > >> Thanks for making me aware of this. I'll take a closer look and try to > >> figure out what is going on. > >> > >> Ross > >> On Sep 24, 2013 8:03 AM, "Peter Carl" wrote: > >> > >>> Fair point. I get the same result when I use high values for > >>> max_permutations. That attribute should probably be referenced in the > >>> function documentation under details, so that users know it can be > >>> passed > >>> through dots. > >>> > >>> Same result though. When I call rp_sample directly: > >>> rp_sample(init.portf, permutations=1000) > >>> ... I get 1000 rows back. > >>> > >>> So something's happening in the dispatch code? > >>> > >>> pcc > >>> -- > >>> Peter Carl > >>> http://www.braverock.com/peter > >>> > >>> > On 09/24/2013 09:28 AM, Peter Carl wrote: > >>> >> The random_portfolios function isn't generating the correct number > >>> of > >>> >> permutations. > >>> >> > >>> >>> >random_portfolios(portfolio=init.portf, permutations=1000) > >>> >> gives me a result with 317 weight vectors, rather than 1000. > >>> >> > >>> >> I think that there's a loop missing: when the number of lines is > >>> less > >>> >> than > >>> >> permutations, the function needs to generate more, check for unique > >>> >> solutions, and repeat until there are (in this case) 1000 weight > >>> >> vectors. > >>> >> > >>> >> Although (and it's difficult to tell), on their own the charts seem > >>> to > >>> >> generate about the right number? Or maybe not... > >>> > > >>> > I suspect that given your constraints you're just hitting > >>> > max_permutations. > >>> > > >>> > All that code is still there, so it seems most likely that you just > >>> > don't have max_permutations high enough, or that your granularity on > >>> the > >>> > sequence is too high (e.g. you're using a step size of .01, and > >>> should > >>> > try .005) > >>> > > >>> > -- > >>> > Brian G. Peterson > >>> > http://braverock.com/brian/ > >>> > Ph: 773-459-4973 > >>> > IM: bgpbraverock > >>> > _______________________________________________ > >>> > GSoC-PortA mailing list > >>> > GSoC-PortA at lists.r-forge.r-project.org > >>> > > http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta > >>> > > >>> > >>> > >>> _______________________________________________ > >>> GSoC-PortA mailing list > >>> GSoC-PortA at lists.r-forge.r-project.org > >>> http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta > >>> > >> > > _______________________________________________ > > GSoC-PortA mailing list > > GSoC-PortA at lists.r-forge.r-project.org > > http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta > > > > > _______________________________________________ > GSoC-PortA mailing list > GSoC-PortA at lists.r-forge.r-project.org > http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta > -------------- next part -------------- An HTML attachment was scrubbed... URL: From brian at braverock.com Tue Sep 24 21:02:11 2013 From: brian at braverock.com (Brian G. Peterson) Date: Tue, 24 Sep 2013 14:02:11 -0500 Subject: [GSoC-PortA] Random portfolios In-Reply-To: References: <0219d0832454daa3b2ad9b43904f479f.squirrel@mail.braverock.com> <5241A2A3.60902@braverock.com> <92768f15249e53f2546f32e09f48d3b7.squirrel@mail.braverock.com> Message-ID: <5241E1B3.2080704@braverock.com> On 09/24/2013 12:59 PM, Ross Bennett wrote: > The check for min_sum and max_sum is done right away in > randomize_portfolio_v2. The main reason why I added this check and > wiggle room for min_sum and max_sum inside of the function is to speed > up generating the random portfolio and ensure that a reasonable number > of portfolios can be generated. > > Another logical place for this check would be in the check_constraints > function, this would prevent portfolios being eliminated. Even if we do > this check here, constrained_objective will penalize a large number of > sets of weights that do not sum to exactly 1. I think it also might make > sense to add a check in optimize.portfolio and issue a warning to the > user that min_sum and max_sum may be too restrictive. This will apply to > optimize_method="random" and optimize_method="DEoptim" because we are > using logic from random portfolios as a mapping function in DEoptim. > I think that when using random portfolios, the leverage constraint needs to be relaxed somewhat, or the generation just takes too long. That's why those exist as parameters. a 'full_investment' constraint is nice, but rather impractical when the time to generate gets to be very high. I'd just expost the min_sum and max_sum anywhere they aren't already exposed, and I'd add a warning for the user if both are 1. -- Brian G. Peterson http://braverock.com/brian/ Ph: 773-459-4973 IM: bgpbraverock From peter at braverock.com Sat Sep 28 20:53:24 2013 From: peter at braverock.com (Peter Carl) Date: Sat, 28 Sep 2013 13:53:24 -0500 Subject: [GSoC-PortA] Problem with ROI solvers? Message-ID: <772ebf549d1163e7e03e063f8f47621e.squirrel@mail.braverock.com> I hit a bump in the road a couple of days ago when I looked at the two attached charts. One shows the mean-ETL of a set of different objectives against a cloud of random portfolios. The objectives that can be are calculated through ROI; I used RP for most of the others and DE for the risk budget objective. Note that the cloud of RP portfolios shows portfolios with lower mETL than the indicated MinmETL portfolio. Well, maybe the mETL space isn't convex? Turns out, you can see the same issue in the attached mean-SD space with the minSD portfolio. I went back and re-calculated the RP portfolios to eliminate the wiggle we usually give the boundaries (a two percent leeway to speed up portfolio generation) reasoning that those might be the issue. I generated 10K RP's, of which about 3K summed exactly to 1.0 (which is plenty). So I know that it isn't that those portfolios are out of bounds relative to the constraints objects. I've tried to make sure that every objective is using the same constraints, and I've double-checked my post processing to make sure I wasn't damaging the output from the optimization runs to get things into charts. This suggests to me that it's a deeper problem, although there still just might be an issue in my code somewhere. -- Peter Carl http://www.braverock.com/peter -------------- next part -------------- A non-text attachment was scrubbed... Name: RP-BUOYS-mETL-ExAnte.png Type: image/png Size: 143269 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: RP-BUOY-MeanSD-ExAnte.png Type: image/png Size: 145316 bytes Desc: not available URL: From peter at braverock.com Sat Sep 28 20:56:01 2013 From: peter at braverock.com (Peter Carl) Date: Sat, 28 Sep 2013 13:56:01 -0500 Subject: [GSoC-PortA] Problem with ROI solvers? Message-ID: <2c24f9bd6659bf416d8e8d995b10a6dc.squirrel@mail.braverock.com> Whoops, I hit "send" too early. That's the gist of the message, though. I'll check in all my recent changes and the RP result so that you can reproduce these results. Let me know if you have any other ideas or see issues in how I've laid out the constraint objects. Thanks in advance, pcc -- Peter Carl http://www.braverock.com/peter I hit a bump in the road a couple of days ago when I looked at the two attached charts. One shows the mean-ETL of a set of different objectives against a cloud of random portfolios. The objectives that can be are calculated through ROI; I used RP for most of the others and DE for the risk budget objective. Note that the cloud of RP portfolios shows portfolios with lower mETL than the indicated MinmETL portfolio. Well, maybe the mETL space isn't convex? Turns out, you can see the same issue in the attached mean-SD space with the minSD portfolio. I went back and re-calculated the RP portfolios to eliminate the wiggle we usually give the boundaries (a two percent leeway to speed up portfolio generation) reasoning that those might be the issue. I generated 10K RP's, of which about 3K summed exactly to 1.0 (which is plenty). So I know that it isn't that those portfolios are out of bounds relative to the constraints objects. I've tried to make sure that every objective is using the same constraints, and I've double-checked my post processing to make sure I wasn't damaging the output from the optimization runs to get things into charts. This suggests to me that it's a deeper problem, although there still just might be an issue in my code somewhere. -- Peter Carl http://www.braverock.com/peter -------------- next part -------------- A non-text attachment was scrubbed... Name: RP-BUOYS-mETL-ExAnte.png Type: image/png Size: 143269 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: RP-BUOY-MeanSD-ExAnte.png Type: image/png Size: 145316 bytes Desc: not available URL: From peter at braverock.com Sat Sep 28 22:04:48 2013 From: peter at braverock.com (Peter Carl) Date: Sat, 28 Sep 2013 15:04:48 -0500 Subject: [GSoC-PortA] Problem with ROI solvers? In-Reply-To: <2c24f9bd6659bf416d8e8d995b10a6dc.squirrel@mail.braverock.com> References: <2c24f9bd6659bf416d8e8d995b10a6dc.squirrel@mail.braverock.com> Message-ID: <02f235525a54cb5e17d11b037f1b4fd6.squirrel@mail.braverock.com> I think I might have found the issue. In the RP solvers, I was using clean="boudt", but wasn't passing in anything into the ROI solvers. That would be a big difference... I'll confirm that is the issue later, and come back if it wasn't. Thanks for listening. pcc -- Peter Carl http://www.braverock.com/peter > Whoops, I hit "send" too early. > > That's the gist of the message, though. I'll check in all my recent > changes and the RP result so that you can reproduce these results. Let me > know if you have any other ideas or see issues in how I've laid out the > constraint objects. > > Thanks in advance, > > pcc > -- > Peter Carl > http://www.braverock.com/peter > > I hit a bump in the road a couple of days ago when I looked at the two > attached charts. One shows the mean-ETL of a set of different objectives > against a cloud of random portfolios. The objectives that can be are > calculated through ROI; I used RP for most of the others and DE for the > risk budget objective. > > Note that the cloud of RP portfolios shows portfolios with lower mETL than > the indicated MinmETL portfolio. Well, maybe the mETL space isn't convex? > Turns out, you can see the same issue in the attached mean-SD space with > the minSD portfolio. > > I went back and re-calculated the RP portfolios to eliminate the wiggle we > usually give the boundaries (a two percent leeway to speed up portfolio > generation) reasoning that those might be the issue. I generated 10K > RP's, of which about 3K summed exactly to 1.0 (which is plenty). So I > know that it isn't that those portfolios are out of bounds relative to the > constraints objects. > > I've tried to make sure that every objective is using the same > constraints, and I've double-checked my post processing to make sure I > wasn't damaging the output from the optimization runs to get things into > charts. > > This suggests to me that it's a deeper problem, although there still just > might be an issue in my code somewhere. > -- > Peter Carl > http://www.braverock.com/peter > > _______________________________________________ > GSoC-PortA mailing list > GSoC-PortA at lists.r-forge.r-project.org > http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta > From rossbennett34 at gmail.com Sat Sep 28 22:54:10 2013 From: rossbennett34 at gmail.com (Ross Bennett) Date: Sat, 28 Sep 2013 13:54:10 -0700 Subject: [GSoC-PortA] Problem with ROI solvers? In-Reply-To: <02f235525a54cb5e17d11b037f1b4fd6.squirrel@mail.braverock.com> References: <2c24f9bd6659bf416d8e8d995b10a6dc.squirrel@mail.braverock.com> <02f235525a54cb5e17d11b037f1b4fd6.squirrel@mail.braverock.com> Message-ID: Peter, I suspected this might be the case and did confirm it for the results in the mean-StdDev space. The plot is using the objective measures from the extractStats output of the EqmETL.RND object and these are calculated with clean="boudt" whereas the buoys.portfmeas as well as MinSD.ROI are calculated with clean="none". >From the graph, it looks like the minimum StdDev for the random portfolios is 0.0095. This is close to the result I get with the following test: > R.clean <- Return.clean(R=R, method="boudt") > > tmpSD <- vector("numeric", length=nrow(rp)) > tmpSDcleanR <- vector("numeric", length=nrow(rp)) > for(i in 1:nrow(rp)){ + tmpSD[i] <- StdDev(R=R, weights=rp[i,]) + tmpSDcleanR[i] <- StdDev(R=R.clean, weights=rp[i,]) + } > > min(tmpSD) [1] 0.01020511 > min(tmpSDcleanR) [1] 0.009514874 > as.numeric(MinSD.ROI$objective_measures) [1] 0.01009001 Ross On Sat, Sep 28, 2013 at 1:04 PM, Peter Carl wrote: > I think I might have found the issue. In the RP solvers, I was using > clean="boudt", but wasn't passing in anything into the ROI solvers. That > would be a big difference... > > I'll confirm that is the issue later, and come back if it wasn't. > > Thanks for listening. > > pcc > -- > Peter Carl > http://www.braverock.com/peter > > > Whoops, I hit "send" too early. > > > > That's the gist of the message, though. I'll check in all my recent > > changes and the RP result so that you can reproduce these results. Let > me > > know if you have any other ideas or see issues in how I've laid out the > > constraint objects. > > > > Thanks in advance, > > > > pcc > > -- > > Peter Carl > > http://www.braverock.com/peter > > > > I hit a bump in the road a couple of days ago when I looked at the two > > attached charts. One shows the mean-ETL of a set of different objectives > > against a cloud of random portfolios. The objectives that can be are > > calculated through ROI; I used RP for most of the others and DE for the > > risk budget objective. > > > > Note that the cloud of RP portfolios shows portfolios with lower mETL > than > > the indicated MinmETL portfolio. Well, maybe the mETL space isn't > convex? > > Turns out, you can see the same issue in the attached mean-SD space with > > the minSD portfolio. > > > > I went back and re-calculated the RP portfolios to eliminate the wiggle > we > > usually give the boundaries (a two percent leeway to speed up portfolio > > generation) reasoning that those might be the issue. I generated 10K > > RP's, of which about 3K summed exactly to 1.0 (which is plenty). So I > > know that it isn't that those portfolios are out of bounds relative to > the > > constraints objects. > > > > I've tried to make sure that every objective is using the same > > constraints, and I've double-checked my post processing to make sure I > > wasn't damaging the output from the optimization runs to get things into > > charts. > > > > This suggests to me that it's a deeper problem, although there still just > > might be an issue in my code somewhere. > > -- > > Peter Carl > > http://www.braverock.com/peter > > > > _______________________________________________ > > GSoC-PortA mailing list > > GSoC-PortA at lists.r-forge.r-project.org > > http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta > > > > > _______________________________________________ > GSoC-PortA mailing list > GSoC-PortA at lists.r-forge.r-project.org > http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta > -------------- next part -------------- An HTML attachment was scrubbed... URL: