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-requ...@r-project.org wrote:
Message: 2
Date: Tue, 19 Feb 2013 19:01:35 -0800
From: David Winsemius<dwinsem...@comcast.net>
To: "Malikov, Emir"<emali...@binghamton.edu>
Cc:r-help@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-b0483695b...@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

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to