[GSoC-PortA] chart.* as generics

Brian G. Peterson brian at braverock.com
Sat Aug 24 19:53:43 CEST 2013


Of course, you can call plot() on the output object of any optimization 
and get the standard scatter and weights chart.

Additionally, you can call

chart.RiskReward (to get just the scatter plot)

chart.Weights (to get just the weights plot)

chart.EfficientFrontier (to get a plot of the efficient frontier)

chart.Weights.EF (to get a stacked bar of weights along the efficient 
frontier)

As for usage, for plot() and all the chart.* functions above, defaults 
will be set appropriately if you just pass the optimization output 
object as the first argument.

Currently, he only use of the charting functions is in the script 
sandbox/testing_efficient_frontier.R  and briefly in the ROI vignette.

I think it would be good to update the other vignettes with charts where 
appropriate.

Given Ross's recent work to properly define the generics, it shouldn't 
be necessary to call any of the sub-functions for the particular type of 
optimization solver that was used.  Calling plot or any of the functions 
above sholud be possible with any optimize.portfolio output right now.

Regards,

Brian


On 08/24/2013 12:10 PM, Doug Martin wrote:
> Ross,
>
> Is there a vignette yet for using these chart functions?  If not, a
> couple of code examples?
>
> 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:* Monday, August 19, 2013 10:17 PM
> *To:* PortfolioAnalytics
> *Subject:* Re: [GSoC-PortA] chart.* as generics
>
> Brian,
>
> I have just a couple quick questions regarding chart.Weights and
> chart.RiskReward as generic functions and cleaning up the documentation
> as you did with the versioned functions.
>
> My plan is to use an alias for the chart.Weights.* functions for the
> different classes and then have a generic chart.Weights function with a
> call to UseMethod("chart.Weights"). The first argument is RP for
> chart.Weights.RP, DE for chart.Weights.DE <http://chart.Weights.DE>, and
> so on. Should the arguments of the chart.Weights.* functions be the same?
>
> Should we have the @param and other tags only for one function? Would
> that go on the generic chart.Weights function?
>
> My approach would be the same for the chart.Scatter.* functions.
>
> Thanks,
>
> Ross
>
> On Sun, Aug 18, 2013 at 1:21 PM, Brian G. Peterson <brian at braverock.com
> <mailto:brian at braverock.com>> wrote:
>
> Sounds good.  - Brian
>
>
>
> On 08/18/2013 03:06 PM, Ross Bennett wrote:
>
>     Brian,
>
>     Thanks for clarifying, I was worried that might be the case. I could add
>     a new function named chart.RiskReward and make that our generic function
>     and use an alias for the existing chart.Scatter.* functions. It could
>     look something like this:
>
>     chart.RiskReward.optimize.portfolio.ROI <- chart.Scatter.ROI
>     chart.RiskReward.optimize.portfolio.random <- chart.Scatter.RP
>
>     Would that be ok and worthwhile to do?
>
>     Ross
>
>
>
>     On Sun, Aug 18, 2013 at 12:05 PM, Brian G. Peterson
>     <brian at braverock.com <mailto:brian at braverock.com>
>
>     <mailto:brian at braverock.com <mailto:brian at braverock.com>>> wrote:
>
>          On 08/18/2013 01:35 PM, Ross Bennett wrote:
>
>
>              The PerformanceAnalytics packages already has a chart.Scatter
>              function.
>              Will we have any naming or masking issues if I make
>     chart.Scatter a
>              function for the different optimize.portfolio.objects?
>
>
>          It's easy to make chart.Weights a generic, but it will be much
>          harder with chart.Scatter.*
>
>          Because PerformanceAnalytics is on CRAN and much more widely used,
>
>
>          we'd need to match the argument list, and create a
>          chart.Scatter.default in PerfA.  I don't see any way to match the
>          argument list though.
>
>          --
>          Brian
>
> _______________________________________________
> GSoC-PortA mailing list
> GSoC-PortA at lists.r-forge.r-project.org
> <mailto: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
>


-- 
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock


More information about the GSoC-PortA mailing list