[R] selection of optim parameters
Prof. John C Nash
nashjc at uottawa.ca
Tue Jul 6 15:56:15 CEST 2010
Without the data and objective function, it is fairly difficult to tell what is going on.
However, we can note:
- no method is specified, but it would have to be L-BFGS-B as this is the only
one that can handle box constraints
- the fourth parameter is at a different scale, and you are right to think about
this, especially as you don't seem to be providing analytic gradients.
Options:
- I would definitely rescale your function i.e., in the code, so your rawpar[4] is
10000*par[4]. That gets all the scales approx. the same, assuming your start reflects the
eventual answer
- try bobyqa from minqa package once scaled -- it really doesn't like scale differences.
If you have data and a script nicely packaged that can be emailed, I'll take a look at it.
If analytic gradients can be provided, there are more possibilities too, e.g., Rvmmin. spg
from BB package also does constraints.
It may, of course, turn out that the solution really is on the boundary.
JN
> Message: 47
> Date: Mon, 05 Jul 2010 21:53:18 +0200
> From: Fabian Gehring <fabian.gehring at bluewin.ch>
> To: r-help at r-project.org
> Subject: [R] selection of optim parameters
> Message-ID: <4C32382E.3050409 at bluewin.ch>
> Content-Type: text/plain; charset=ISO-8859-15; format=flowed
>
> Hi all,
>
> I am trying to rebuild the results of a study using a different data
> set. I'm using about 450 observations. The code I've written seems to
> work well, but I have some troubles minimizing the negative of the
> LogLikelyhood function using 5 free parameters.
>
> As starting values I am using the result of the paper I am rebuiling.
> The system.time of the calculation of the function is about 0.65 sec.
> Since the free parameters should be within some boundaries I am using
> the following command:
>
> optim(fn=calculateLogLikelyhood, c(0.4, 2, 0.4, 80000, 0.8),
> lower=c(0,0,0,0,0), upper=c(1, 5, Inf, Inf, 1), control=list(trace=1,
> maxit=1000))
>
> Unfortunately the result doesn't seem to be reasonable. 3 of the
> optimized parameters are on the boundaries.
>
> Unfortunately I don't have much experience using optimizatzion methods.
> That's why I am asking you.
> Do you have any hints for me what should be taken into account when
> doing such an optimization.
>
> Is there a good way to implement the boundaries into the code (instead
> of doing it while optimizing)? I've read about parscale in the
> help-section. Unfortunately I don't really know how to use it. And
> anyways, could this help? What other points/controls should be taken
> into account?
>
> I know that this might be a bit little information about my current
> code. But I don't know what you need to give me some advise. Just let me
> know what you need to know.
>
> Thankds
>
>
More information about the R-help
mailing list