Chapter 8Function minimization tools in the base R system
The scientists who built the core R system have included a number of tools for optimization. In this chapter, we explore these and review their strengths and weaknesses. It is, however, important to note the following.
- All the methods discussed in this chapter are relatively “old.” They date from the 1970s to 1980s at the latest, even if the codes are somewhat more recent. This does not mean that they are not good tools. It is rather that there are more recent tools that take account of changing requirements, deal with larger or somewhat different problems, and include capabilities that the base tools lack.
- The base methods have been used by other R tools, so are present in some cases as support for those tools.
- It is very difficult to remove something from a working system, even if there are more suitable replacements.
8.1 optim()
optim()
is one of the most used tools in R. It incorporates five methods, three of which are derived from the author's own work (Nash, 1979). The five methods are largely independent but are all called through optim()
, using a call such as
ans<-optim(start, fn=myfn, gr=mygr, method="BFGS", X=myx, Y=myY, control=list(trace=1))
where start
is the vector of parameters that are used as the initial point of the optimization iteration, myfn
is the function to be minimized, mygr
is its gradient, and the control list specifies that we want to follow the iterations (trace
), while the elements given ...
Get Nonlinear Parameter Optimization Using R Tools now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.