[R] Restricting optimisation algorithm's parameter space

Prof. John C Nash nashjc at uottawa.ca
Sat Apr 3 15:39:38 CEST 2010


> I have a problem. I am  using the NLME library to fit a non-linear model. There is a linear  component to the model that has a couple parameter values that can only  be positive (the coefficients are embedded in a sqrt). When I try and  fit the model to data the search algorithm tries to see if a negative  value for one of these parameter values will produce an optimal fit. When  it does so, it crashes because the equation can not have a negative  value because its in a sqrt function. 
> 
> QUESTION: How do I  restrict the optimisation algorithm's  parameter space so it does not  search negative values when using GNLM? Are there other Libraries that Fit Non-linear models and allow for one to control the parameter space the search algorithm is restricted by?

There are two issues here:

1) Rendering optimization codes resistant to inadmissible parameter vectors (sqrt of 
negatives etc.)

2) Providing constraints, particularly parameter bounds, on parameter inputs to optimization.

There is quite a lot of activity going on right now with optimization in R. With Ravi 
Varadhan, Kate Mullen and Paul Gilbert, I've been putting some codes on R-forge in the 
OptimizeR project. Doug Bates has done some important kibbitzing. Stefan Theussl and 
others have the R Optimization Infrastructure. There are some differences of focus in 
these projects.

For the present poster, I cannot unfortunately help much on GNLM details, but I can say 
that there are trial versions of methods that will handle bounds (packages minqa, Rcgmin 
and Rvmmin) that accept bounds, along with existing L-BFGS-B in optim(). Rcgmin and Rvmmin 
also accept "masks", that is fixed parameters. These routines are about to go into CRAN.

It appears GNLM is not a CRAN package. Does it permit substitution of optimizer? That is 
something those of us working in optimization strongly recommend to package writers i.e., 
make the optimization a black box so any of a number of tools can be slotted in easily. 
That way, advances or even minor fixups to routines can be included in tools quickly.

However, the "bad parameters" issue, such as trying to take square root of negatives, 
requires the user or the writer of a package that the user calls to code the objective 
function to return a flag -- we are looking at an Inf or an NA, we are not yet fully 
decided on the rules -- AND the optimization package writer to then make it act 
appropriately. Mary Walker-Smith and I had this in BASIC codes in the 1980s, but we were 
maybe a bit ahead of folk and it didn't catch on generally.

If R users have some nice examples of things crashing because of such issues, I would 
really like to hear of them off-list. For us, "nice" means pretty small and easy to build 
into tests. Without such tests -- and users always provide better ones than we can think 
of -- the code is never as robust.

JN



More information about the R-help mailing list