[R] 'gmm' package: How to pass controls to a numerical solver used in the gmm() function?
Prof J C Nash (U30A)
nashjc at uottawa.ca
Wed Feb 20 14:07:58 CET 2013
This is a quite general issue that those of us who try to prepare
optimization tools must deal with quite often. The minqa package
internal methods were designed to be used with customized controls to
the algorithm, but we had to "package" them with some more or less OK
compromise settings. If you use that package directly, you can change
the values, but not usually if it is wrapped inside something like gmm.
I'd welcome -- off list -- discussions with developers of packages like
gmm to find a consistent approach to allow the controls to be set by
those users needing to do so. A danger is that each wrapper package uses
either its own approach or none at all. My suggestion is that such
packages include a control() list as an argument with sensible defaults,
and that this list contains an item (probably also a list) of controls
to the optimizer(s). A bit ugly, but for most users, not used.
Best,
JN
On 13-02-20 06:00 AM, r-help-request at r-project.org wrote:
> Message: 2
> Date: Tue, 19 Feb 2013 19:01:35 -0800
> From: David Winsemius<dwinsemius at comcast.net>
> To: "Malikov, Emir"<emalikov at binghamton.edu>
> Cc:r-help at r-project.org
> Subject: Re: [R] 'gmm' package: How to pass controls to a numerical
> solver used in the gmm() function?
> Message-ID:<B54404CA-ACC2-441B-8A1E-B0483695BE7E at comcast.net>
> Content-Type: text/plain; charset=us-ascii
>
>
> On Feb 19, 2013, at 5:25 PM, Malikov, Emir wrote:
>
>> >Hello --
>> >
>> >The question I have is about the gmm() function from the 'gmm' package
>> >(v. 1.4-5).
>> >
>> >The manual accompanying the package says that the gmm() function is
>> >programmed to use either of four numerical solvers -- optim, optimize,
>> >constrOptim, or nlminb -- for the minimization of the GMM objective
>> >function.
>> >
>> >I wonder whether there is a way to pass controls to a solver used
>> >while calling the gmm() function?
>> >
>> >In particular, the problem that I have been having is that the gmm()
>> >fails to converge withing the default number of iteration for the
>> >'optim' solver that it uses. Ideally, I would wish to figure out a way
>> >to be able to choose controls, including the number of iterations, for
>> >the solver that I tell gmm() to use.
>> >
>> >Currently, the way I call the function is as follows:
>> >
>> >model.name <- gmm(g=g.fn, x=data, gradv=g.gr, t0=c(start),
>> >type=c("twostep"), optfct=c("optim") )
>> >
>> >I also would want the gmm() function to know that I want it to pass
>> >the following control -- maxit=1500 -- to the optim solver.
> The argument name in the manual is `itermax`. I cannot tell from lookng at the code whether that would get passed to 'optim'.
>
>> >Unfortunately, the 'gmm' manual does not tell whether this is doable.
> There is also a "..." argument which is stated in the help page to be passed to "optim". Looking at ?optim one sees that controls generally need to be in a list named 'control'. That this is the intent is supported by the sentence on page 11 of the gmm vignette:
>
> "We could try dierent starting values, increase the number of iterations in the control option of
> optim or use nlminb which allows to put restrictions on the parameter space."
>
> -- David Winsemius Alameda, CA, USA
More information about the R-help
mailing list