[R-SIG-Finance] !SPAM: Re: optimization

Brian G. Peterson brian at braverock.com
Sun Jul 18 00:53:34 CEST 2010


On 07/17/2010 04:56 PM, Ben Nachtrieb wrote:
> Hello,
>
> I'm looking for the best multi-parameter optimization methods in R that:
>
> 1) Use brute force (non-genetic parameter value selection, i.e. tests all
> parameter combinations...) to see results for all combinations of parameter
> values requested by the user.

You'd need to be sure the problem was tractable given the possible numbers of 
calculations.  This number can easily get into the billions or more.

If tractable, it is just a nested loop to test all the parameters. brute force 
optimizers tend to be specific to your problem, and not very reusable, but easy 
to write.

You may also want to consider Burns-style random portfolios or a variant for 
parameters. This would allow you to cover the space and get a representative 
sample.  See Pat Burns' papers.

> 2) Use a genetic algorithm (skips some parameter value combinations via a
> genetic algorithm selection process...) to speed up the optimization
> process.

DEoptim is the best available in R for this at this point, in my opinion.

> Yes, #1 and #2 above conflict, thus I would like to test both types of
> optimizations.
>
> I am optimizing trading program parameters over time series data (package
> timeSeries) and I'd like to avoid re-inventing the wheel (save myself some
> coding time). I have a back testing function that I can use in the
> optimization function.

There is no pre-built parameter optimization mechanism tuned towards trading 
strategy parameters in R at this time.  I've done it with brute force, random 
search (see the random portfolio code in PortfolioAnalytics, it could be 
modified), and DEoptim.  I have not generalized it yet.

> I have been here:
> http://cran.r-project.org/web/views/Optimization.html
>
> And it is looking like optim() is my best bet; however, I want to double
> check with the community first.

With any non-smooth surface, optim will give local minima that may not be the 
global optimum.  See optim()'s performance on Rastrigen, for example.

Regards,

   - Brian

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



More information about the R-SIG-Finance mailing list